Jump to content

[Solved] a Category USD and another category EUROS, how?


gs

Recommended Posts

Good morning
I would like to make a category X has $ currency
and category Y has USD currensy.
My idea:
When you click on the category X: to run the same statement that executes "blockcurrencies"to change euros to dollars
When you click on the category Y: to run the same statement that executes "blockcurrencies"to change dollars to euros.
But not how to do this.
Or another idea?
URGENTTT!
Sorry for my bad english. I speak spanish (i from uruguay)
Thank you

Link to comment
Share on other sites

Change line 21 of category.php (in PrestaShop v1.3.5) from:

$category = new Category(intval(Tools::getValue('id_category')), intval($cookie->id_lang));



to:

$category = new Category(intval(Tools::getValue('id_category')), intval($cookie->id_lang));

if ($category->id == 3)
  $cookie->id_currency = 1;
elseif ($category->id == 4)
  $cookie->id_currency = 2;



Change 3 to the ID of the category that should change to currency 1 and 4 to the ID of the category that should change to currency 2. You can use AND to select more categories in the if statements.

Link to comment
Share on other sites

Excelent! Thank you very much.

Now, if i want change only the sign? (not the number)

For example:
T-Shirt : U$S 20
Cup: € 20

Only change currency's sign when click in the category.

Sorry for my bad english again!

Link to comment
Share on other sites

Rocky the last question..

How I can create a statement that the verification for the product in that category is housed to display currency for the product?
Because if I enter directly into the web of product from a link, it shows me another currency.

Sorry for my bad english again again again!

Link to comment
Share on other sites

Sorry, AGAIN:

when I enter directly http://www.mydomain.com/product.php?id_product=14 not change the currency of the category.
If i enter www.mydomain.com then www.mydomain.com/category.php?id_category=8 later www.mydomain.com/product.php?id_product=14
change the currency of the category.

how I can make the product page showing the correct currency? (when i enter directly, for example: http://www.mydomain.com/product.php?id_product=14)

Link to comment
Share on other sites

I understand now. Change line 110 of product.php from:

$product = new Product(intval($_GET['id_product']), true, intval($cookie->id_lang));



to:

$product = new Product(intval($_GET['id_product']), true, intval($cookie->id_lang));
if ($product->id_category_default == 3)
  $cookie->id_currency = 1;
elseif ($product->id_category_default == 4)
  $cookie->id_currency = 2;

Link to comment
Share on other sites

Great, thank Rocky!


strange thing is that when I refresh (F5) the product page, I get the currency of another product, when I refresh (F5) returned the product page I get the right currency

For Example:

Open www.mydomain.com/product=1 (U$S)
THEN www.mydomain.com/product=2 (€)

Refresh product page 1, appears €
Refresh product page 1 again, appears U$S

What could be the reason?
Cookies are not updated quickly? How to solve it?

Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...