Reputation: 5202
Before writing here, i did lots of research and testings and read too many posts on SO and other blogs, but none fixed my problem. I am developing a website with magento 1.9.2.1. It will have two languages English and Arabic and seven currencies USD, SAR, QAR etc. Lets say the domain is altaf.com ;).
Requirements:
How it can be done?
One way to do it as below:
Problems with above:
We have thousands of products and about 20 categories and other lots of contents, which will be hard to manage this way.
While entering data, it is most likely that we will miss to select about 7 store views for each content. Also, it will be more hard to enter data for products.
And some more problems can occur...
How i am doing it?
I created store views and setup appropriate urls for each. For now i only created 4 store views for en-sa.altaf.com, ar-sa.altaf.com, en-us.altaf.com, ar-us.altaf.com
Created sub folders for each store urls like en-sa, en-us, ar-sa and ar-us and placed index.php in it and changed the path to Mage.php accordingly. Made appropriate changes in nginx config files for each domain and set proper root paths. Tested them and confirmed that each sub folder index.php is executed.
Now i am trying to load english contents for each url which has en and arabic contents for each url which has ar. This way, it will be easy to manage all contents. I use MAGE_RUN_CODE
as en in all index.php
files which are placed in en-xx sub folders and similarly ar for ar-xx sub folders. I also tried to set store and currency as below for en-us.altaf.com and ar-us.altaf.com which will have usd as currency.
Mage::app()->setCurrentStore('en'); //for en
Mage::app()->getStore()->setCurrentCurrency('usd'); //Set currency for store
and
Mage::app()->setCurrentStore('ar'); //for ar
Mage::app()->getStore()->setCurrentCurrency('usd');
But it does not work, and this is my big problem.
Can any body help me out here to fix this problem or give me details for any other better solution? I will offer a 50 points bounty for a correct answer which solve my problem :).
Upvotes: 0
Views: 530
Reputation: 314
If you want to do it in this way you should add 'code' at the name of the php function for setting the currency programatically:
Mage::app()->getStore()->setCurrentCurrencyCode('USD');
in place of
Mage::app()->getStore()->setCurrentCurrency('USD');
But I don't think it's the best way though. I would create 2 websites, arabic and english and then add store views for each currency. each website should use same root category. Then set the url's, language and currency for each store view in Magento backend.
When adding a new product all you have to do is insert the content in 2 languages and check 2 checkboxes in the Catalog->Manage products->Product information->Websites.
The currency will apply automatically for each store view.
Upvotes: 1