Jump to content

Multistore and prices by shops


Recommended Posts

Hi,

 

I am creating a multistore server with Prestashop 1.6.0.9.

I have 2 shops A and B, I would like to make all prices of shop B products more expensive (+10%) than those in shop A.

I don't found anything to do this.

Could anybody help me to realise that ??

 

Thanks for your help.

 

Leo

Link to comment
Share on other sites

  • 1 year later...

Leo,

I haven't never done the same thing, but as far as I understand, you should try this:

UPDATE `product_shop` SET `price` = `price` * 1.1 WHERE `id

Leo,

I haven't never done the same thing, but as far as I understand, you should try this:

UPDATE `product_shop` SET `price` = `price` * 1.1 WHERE `id_shop` = B

Hope this helps!

Tung

 

Tung you 're a Rock Star Life Saver...you can change your avatar into this lifesavers.jpg

 

One question IF you 're aware.

 

Supposedly we wanted to automate this very same procedure, day by day -in order to change prices to reflect currency exchange rates fluctuation- what I should do?

I want to be the very same procedure for the following reason. I have created a multishop environment. The one shop is the base shop and the other is additional shop.

The base shop should have localization for Germany (default lang German, default currency Euro) and the additional shop localization for UK (default lang English, default currency GBP). So brilliantly enough you gave me the solution of how to do this, and thank you VERY much. Now I would like to automate this procedure but unfortunately I have not idea of how to do this.

Somewhere I read that maybe I can achieve this through cron jobs but its an unknown field for me. So I would appreciate any help on this matter.

Link to comment
Share on other sites

You're welcome :)

 

To automate this, yes I have no other option than setting a cron job!

But how?

 

There are approaches:

- Approach 1: If your prices reflect the real exchange rates (provided by PrestaShop), you can be easily to do that.

Just go to Localization > Currencies, scroll down and you will the cron URL.

Like this:

c8ae26a0-e77a-11e5-8791-7819d8619501.png

 

- Approach 2: If you go with the solution mentioned previously in this topic, probably you have to write your own code:

Look the file at [admin folder] / cron_currency_rates.php

Create the similar one, and not tested yet but the code should look like this:

if (!defined('_PS_ADMIN_DIR_')) {
    define('_PS_ADMIN_DIR_', getcwd());
}
include(_PS_ADMIN_DIR_ . '/../config/config.inc.php');

if (isset($_GET['secure_key'])) {
    $secureKey = md5(_COOKIE_KEY_ . Configuration::get('PS_SHOP_NAME'));
    if (!empty($secureKey) && $secureKey === $_GET['secure_key']) {
        $sql = 'UPDATE `' . _DB_PREFIX_ . 'product_shop` SET `price` = `price` * 1.1 WHERE `id_shop` = B';
        Db::getInstance()->execute($sql);
    }
}

The cron URL should be the same like the approach 1 above, except for 1 thing: change cron_currency_rates.php with your own file name.

 

 

What's next? How to set up a cron job on your server?

You can google for that, very easy. Or open a new topic.

 

Hope that helps!

Edited by Tung at RockPOS.com (see edit history)
  • Like 1
Link to comment
Share on other sites

You're welcome :)

 

To automate this, yes I have no other option than setting a cron job!

But how?

 

There are approaches:

- Approach 1: If your prices reflect the real exchange rates (provided by PrestaShop), you can be easily to do that.

Just go to Localization > Currencies, scroll down and you will the cron URL.

Like this:

c8ae26a0-e77a-11e5-8791-7819d8619501.png

 

- Approach 2: If you go with the solution mentioned previously in this topic, probably you have to write your own code:

Look the file at [admin folder] / cron_currency_rates.php

Create the similar one, and not tested yet but the code should look like this:

if (!defined('_PS_ADMIN_DIR_')) {
    define('_PS_ADMIN_DIR_', getcwd());
}
include(_PS_ADMIN_DIR_ . '/../config/config.inc.php');

if (isset($_GET['secure_key'])) {
    $secureKey = md5(_COOKIE_KEY_ . Configuration::get('PS_SHOP_NAME'));
    if (!empty($secureKey) && $secureKey === $_GET['secure_key']) {
        $sql = 'UPDATE `' . _DB_PREFIX_ . 'product_shop` SET `price` = `price` * 1.1 WHERE `id_shop` = B';
        Db::getInstance()->execute($sql);
    }
}

The cron URL should be the same like the approach 1 above, except for 1 thing: change cron_currency_rates.php with your own file name.

 

 

What's next? How to set up a cron job on your server?

You can google for that, very easy. Or open a new topic.

 

Hope that helps!

 

Thank you very much for your time. It's a great help for me. I will try to apply these suggestions.

Cheers! :)

Link to comment
Share on other sites

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...