At present the tax seems to display based on the location of the logged in customer.
This can't work for me for 2 reasons. I have an extension that auto displays the currency based on the customers ip plus there is no option for logging in, it's guest checkout only.
So I really need it to display the correct price based on the currency displayed instead.
Does anyone have any idea where the code is for this please or how to adjust the displayed price properly?
Any help is greatly appreciated.
Thanks
-James
I guess You should extend the extension You are using for displaying of currency based on IP address.
Find the line of code where the currency based on user's IP address is populated and call this:
$this->currency->set($currency_code);
where $currency_code should be a 3 character currency ISO code (e.g. USD, EUR, etc) of currency set in the administration.
This way You set the currency to use for price calculation - and that reflects the currency based on user's IP address. This currency code is then saved to session and cookie so it should work on any page within OpenCart frontend.
I think so
Returns 3-character ISO 4217 currency code for the currently set currency.
// Return when Pound Sterling is the set currency
$currency_code = $this->currency->getCode();
var_dump($currency_code); // string 'GBP' (length=3)
also you can
$this->currency->set($currency_code);
and please find currency file https://github.com/opencart/opencart/blob/master/upload/system/library/currency.php
Thanks
I think I have found the correct way to do this: Go to file system/library/tax.php.
Line 27:
if(!$reg){
if($currentCurrency == "CHF"){
$country_id = 204;
}else if($currentCurrency == "EUR"){
$country_id = 81;
}
}
This will set the country the user is in according to the selected currency and will set the country for tax calculation.
Related
I have a simple Prebid setup with 2 bidders. I donot use "Send all bids to the ad server" feature. So Prebid works RTB with returning bids and sends the winning bids to Google Ad Manager (GAM) with key/value pairs like:
hb_bidder=bidder_A
hb_pb=0.10
hb_bidder=bidder_B
hb_pb=0.20
Off course there are line-items defined in GAM with the key/value pairs with those values above.
There is no problem in this setup, if all bidders use same currency.
What if bidder_A bids in USD and bidder_B bid in TRY
Line items' currency of bidder_A were set to USD
Line items' currency of bidder_B were set to TRY
Note: It's possible to use different currencies in GAM 360)
Scenario:
1 USD = 8 TRY
Bidder
Bid
Currency
A
1
USD
B
5
TRY
In this scenario, bidder B wins which is wrong. Currencies donot affect prebid RTB if I am not wrong. When I checked the GAM request, it verifies me.
When I use Prebid Currency Module; it converts USD to TRY (1*8=8) for bidder A, and in this case winner is bidder A which is correct one.
Prebid Currency Module fixes the RTB problem but Prebid sends converted bid
hb_pb=8 (TRY), hb_bidder=bidder_A to GAM. In GAM side, line items of bidder_A defined with currency USD not TRY. So bid matches wrong line-item.
"Send all bids to the ad server" maybe solution but it's needed too much work.
I know, it's very complicated case, what do you suggest to fix problem?
While setting up Prebid Currency Module, there's a configuration parameter adServerCurrency which should match your ad server (usually GAM) currency setting.
In GAM side, line items of bidder_A defined with currency USD not TRY. So bid matches wrong line-item.
So in this case, you need to set adServerCurrency to USD because GAM line items are defined with currency USD.
We want to print internal Product Barcodes because we do not need EAN Numbers for our Products. But it's not working when i put it into the Products "Internal Reference" Field. (example code: BX06WO01)
When i enter this number into the Product/"Internal Reference" Field and "Print Product Label" our Barcode Scanner can not read the printed code, generated from Open ERP In odoo Feature
Is it possible to export and scan a code like BX06WO01(Both Letters and Numeric values) ????
Thanks in Advance.......
The label is based on a Odoo QWeb report, which can be found under Settings/Technical/User Interface/Views. You need to have the debug mode activated to see that menu.
There just search for report_simple_label. You can exchange EAN13 with for example Code128. Accepted types are:
Accepted types: 'Codabar', 'Code11', 'Code128', 'EAN13', 'EAN8', 'Extended39',
'Extended93', 'FIM', 'I2of5', 'MSI', 'POSTNET', 'QR', 'Standard39', 'Standard93',
'UPCA', 'USPS_4State'
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.
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.
How can I obtain the current exchange rate for two given currencies in matlab?
I tried this one, however it seems that the web service is no longer available.
Is there another easy way of obtaining the up-to-date currency exchange rates through a web service in matlab?
Build a local class from a currency conversion web service using CREATECLASSFROMWSDL. You can then use the web service's operations to do the conversion using the class methods. One currency conversion web service (there are many) is available at http://www.webservicex.net/CurrencyConvertor.asmx?WSDL. Here's an example of its use:
>> converter = createClassFromWsdl('http://www.webservicex.net/CurrencyConvertor.asmx?WSDL');
Retrieving document at 'http://www.webservicex.net/CurrencyConvertor.asmx?WSDL'
>> converter = CurrencyConvertor
endpoint: 'http://www.webservicex.net/CurrencyConvertor.asmx'
wsdl: 'http://www.webservicex.net/CurrencyConvertor.asmx?WSDL'
>> ConversionRate(converter, 'CAD', 'EUR')
ans =
0.7059
>> ConversionRate(converter, 'USD', 'CAD')
ans =
0.953
Note that ConversionRate returns a char array, i.e. you still have to convert the result with str2double if you want to do calculations with the exchange rate.
A list of the currency abbreviations is available at http://www.webservicex.net/ws/wsdetails.aspx?wsid=10.
This is an old question, but thought I would update the answer. I made this currency converter function in MATLAB (exchangerate.m) that utilizes the openexchangerates.org API, which is better supported and also includes historical data. Here's a description how it works (it's very simple):
This function returns exchange rates obtained from openexchangerates.org
using their API. To work correctly, one must be connected to the
Internet. The default app_id is from a free account to
openexchangerates.org, which has a limit of 1000 API requests/month. For
more flexibility, sign up for your own free or paid account and replace
the app_id value with your own id number.
Inputs:
1) base: a string denoting the base currency, which is set to have a
value of 1. If an empty string '' is provided, the default 'USD' is
used. See list of valid currency abbreviations below.
2) curr: a
string or cell array of strings denoting the currency abbreviation to
compare with the base currency. If 'all' or '' is provided as input,
then all available currencies are returned. See list of valid
currency abbreviations below.
3) date: an optional string containing
the date desired for the exchange rate (historical data may not
always be available). The input should be in the form 'YYYY-MM-DD'.
To get the latest exchange rate data, use date
= 'latest' or '', which is the default value. Historical data from 1999 and onward
Outputs:
1) rates: a number or vector indicating the exchange rate(s) between the desired currency (currencies), curr, and the base currency, base.
2) currencies: a cell array of the corresponding currency
abbreviations in rates.
3) rate_struct: a structure with field names
equal to the currency abbreviations and associated values being the
rates. This output just combines rates and currencies for
convenience.
Examples:
1) Get the latest exchange rate between Bitcoin and the US Dollar (Note: All country abbreviations are listed in the m-file)
[rates,currencies,rates_struct] = exchangerate('USD','BTC');
>> rates = 1.614e-3
>> currencies = 'BTC'
>> rates_struct =
BTC: 1.614e-3
2) Get latest exchange rates for all available currencies
[rates,currencies,rates_struct] = exchangerate();
3) Obtain exchange rates for Bitcoin, Indian rupee, and Euro using the US
Dollar as base currency on June 5, 2013
[rates,currencies,rates_struct] = exchangerate('USD',{'BTC','INR','EUR'},'2013-06-05');
>> rates = [8.246e-3; 5.672e1; 7.642e-1]
>> currencies = {'BTC';'INR';'EUR'}
>> rates_struct =
BTC: 8.246e-3
INR: 5.672e1
EUR: 7.642e-1