How to add Region / State in opencart checkout? - opencart

Please suggest a way to add an extra Region /State in checkout which is not there in Opencart default .

You can add region for any country from admin panel also.
settings->localisation->zone

The region/states are in the oc_zone table. You can add extra entries into this table but make sure you get the right country code and put that into the record too.
The country codes are in the oc_country table.
So, for example, if you wanted to add a new Region called "The People's Republic of Cleckheaton" to the United Kingdom, first look up the country code for the United Kingdom in oc_country. The code is 222.
Then you can add the new zone to oc_zone with something like the following:
INSERT INTO `oc_zone` (`zone_id`, `country_id`, `name`, `code`, `status`) VALUES (NULL, '222', 'The Peoples Republic of Cleckheaton', 'PRC', '1');
Finally there's another slight issue. Opencart actually caches all the country and zone data so if you add a new field like this it probably won't show up because the old data will be cached.
You should probably be able to fix this by clearing your browser's cache but failing that update the following line in \catalog\model\localisation\zone.php Warning: This is in opencart 1.5.6 but should be similar in 2.0
$zone_data = $this->cache->get('zone.' . (int)$country_id);
to
zone_data = false;
Once you've confirmed it's working ok update that line back to it's original content.

Related

Using RLS on secondary field to UserPrincipalName

So if I have three users: Tom, Dick, and Harry, and they have been assigned group colors. I'd like them to be able to see everyone's data in their own group.
Name Group Email
----- ----- -----
Tom Green t#acme.com
Dick Red d#acme.com
Harry Red h#acme.com
So I create a measure
RLS_SecurityKey = CALCULATE(FIRSTNONBLANK(People[Group],People[Group]),
USERPRINCIPALNAME() = People[Email])
And when I log in as the separate users, I can see in a card visual that I'm getting the expected group.
But when I set row level security on the People table, [Group] = [RLS_SecurityKey], I only get back the one row that matches the email address and not the user that matches his Group.
It seems I'm missing something fairly apparent, but I can't see it. How can I get back all the rows relating to Group and not the email?
Yep, it was pretty straight forward.
RLS_SecurityKey = CALCULATE(FIRSTNONBLANK(People[Group],People[Group]),
FILTER(ALL('PEOPLE'),USERPRINCIPALNAME() = People[Email]))
I adjusted the filter expression and made it a proper filter over the whole table.

powerBI map doesnt show cities

Im trying to show provinces and then drill down to show cities in powerbi map (Aug, 2018 version).
My problem is it does show provinces but when I drill down to get a look at cities, it doesnt show anything.
I also changed column "city" to "place", but nothing happened.
(Note: they are Iran's province/cities, maybe this problem is related to that. because when I change for example my city "Kāshān" from province of "Isfahan" to "Redcar" or "London" it loads nicely on these two cities)
So, what is the solution?
Thanks a lot in advance.
Create a new column called "Location" or "Place" by merging the City and Province columns. You can use a comma (,) as a separator. For example - "Alabama, USA".
Then change the category of the new column to Place. This will solve your issue. The map will be plotted correctly.

Tableau Custom Geocoding - Ambiguous cities

I have a lot of small towns (<15.000 population) from Germany in my data set, so Tableau (Desktop 10.3 Pro Version) has no geographical coordinates for them.
For this reason I made a .csv file (CustomGeo.csv is attached) with the following rows: Country (Name), State/Province, City, Latitude, Longitude. Also I created a schema.ini with the following content:
[CustomGeo.csv]
ColNameHeader=True
DecimalSymbol=,
Format=Delimited(;)
Col1="Country (Name)" Text
Col2="State/Province" Text
Col3="City" Text
Col4="Latitude" Double
Col5="Longitude" Double
Now, after I imported the csv file into Tableau (Map -> Geocoding -> Import Custom Gecoding), I have more than 600 ambiguous cities and I don't understand why. There are big cities like Stuttgart and München which are tagged as ambiguous. Bigger cities in Germany can have more than one Postcode (PLZ).
The possibility to select the field State/Province under Edit Locations and State/Province does not change anything.
Here you can download the csv file and my data set with for geocoding important columns [hosted on google drive]:
Custom Geocoding csv
Data set
Be careful if you want to open the csv file with Excel. Excel could change the column format so the latitude and longitude data could be fucked up :)
I hope anyone can help me with that problem. I do not know how to continue.
I have the solution:
If you use the column names (Country (Name), State/Province, City, Latitude, Longitude) then you will extend an existing role. For bigger cities (>15000 population) Tableau has geo data. So if you extend the existing role with all cities in Germany you will have the bigger cities as well in your custom geocoding file. Because of that, the error with ambiguous cities will show up and bigger cities like München (Munich) or Stuttgart can not be displayed on the map.

How to save and return to newly created item in previous page?

I have an interactive report and a form associated to it. After creating a new entry using the form, my end-users want to put the focus on that specific new entry in the interactive report (it's a lot of entrys, and today they need to scroll down a lot to see the new one).
They also want the same funcionality when updating a row of the report.
How can I do this the correct way in APEX 5.1?
Here is one aproach based on EMP table in apex.oracle.com Create interactive report with edit form. In my case this is page 6 for report and page 7 for edit. Create one hiden item on page six (P6_EMPNO). Add case to your query so in my example it's look something like:
select "ROWID",
"EMPNO",
"ENAME",
"JOB",
"MGR",
"HIREDATE",
"SAL",
"COMM",
"DEPTNO"
from "#OWNER#"."EMP"
ORDER BY CASE WHEN EMPNO = :P6_EMPNO THEN 1 ELSE 2 END, EMPNO
I'm sorting result by EMPNO.
Choose P6_EMPNO in Page Items to Submit section. Go to page 7, select branch(Go to page 6)and click on Target In set items section choose P6_EMPNO and for target &P7_EMPNO.
Now every time you go to page 7, the value of hiden item will be the EMPNO from page 7 and it will apear on top of the region. You can use jQuery to highlight the row and put some validations to update P6_EMPNO only when some data was changed.
I hope this can help you.
easy.
You don't even have to create any additional page items. Change your form DML so that it returns into the primary key page item holder. Then Create a process after your DML process but before the reset cache process. Use APEX_IR API to reset pagination on your IR page, and then set an interactive report filter based on the primary key page item you returned the new PK into. Check the documentation for exact usage.
Apex_IR.reset_report to reset the report pagination and remove any filters.
Apex_ir.add_filter to add a filter = to new primary key
Interesting question, another solution:
Create a item in your report page, something like P3_ANCHOR
Add data-anchor="#< YOUR_COLUMN_ID >#" to your report link attribute
Configure your form page to return the created/modified item id to item P3_ANCHOR in your report page.
Create a Dynamic Action on report page
Action: Execute Javascript Code
Code:
var container = $('body'),
scrollTo = $('[data-anchor="'+$v('P3_ANCHOR')+'"]');
container.animate({
scrollTop: scrollTo.offset().top - $(document).scrollTop()
}, 2000);
Simple solution:
Sort your report descending so that the last created ID will be the first in the IR

Apex5.0 choose layout and add date validation

I am building a student module application in Oracle Apex 5.0 and wanted to know how to display the details in oracle apex.
Something like this with two tabs on the 1 page:
on first tab, When input StudentID,
the first section will contain system_date and tutor name that has login
second section should contain student name and course desc & course year
third section is to display current semester module, if payment done or not (Y /N), markings %, date of payment.
2nd tab of the page to include all courses done for that student.
Which layout to choose (interactive grid/report) or any other.
How to add validation of date picker for the payment date so that upon input it insert directly in table in DD-MON-YY format and also that it takes system_date??
Note table:
student_details: the student name, address and personal details
course_detail table contains the courses for the semester
payment_detail table for the payment details
The sort of things you're going to want to look for are:
Region Display selector, for multiple tabs
Any type of report region to display data, and you can have multiple, and nest them as sub-regions.
You can define page items that are displayed as date pickers, and use default values to source today's date using the keyword SYSDATE.
You're going to need to understand SQL.