Search code examples
prestashopprestashop-1.6multistore

Prestashop Multistore - local store prices are overwritten with price from default shop


We have a serious issue in our newly developed shop.

We are running a multistore setup with different curencies and prices in each store.

Example product:

Denmark: 99 DKK
France: 9 EUR
UK: 9 GBP

When working in "All Stores" mode and we change settings on the "Information"-tab on the product the prices in all stores are set to the value from the default shop. After saving the "Information"-tab the prices are the following:

Denmark: 99 DKK
France: 99 EUR
UK: 99 GBP

We have found several others with the same problem

http://forge.prestashop.com/browse/PSCSX-8372

http://forge.prestashop.com/browse/PSCSX-4644

And even a pull-request from a Prestashop Core-developer

https://github.com/PrestaShop/PrestaShop/pull/4601

He has later closed the pull as it introduced other bugs and quote: "...it's more and more difficult to fix something without broke something. To be honest, this patch sounds risky"

It seems like this is a "known bug" but the dev-team behind Prestashop hos no intension of fixing the bug.

I have a sincere hope, that someone out there has been able to solve this problem.

Thank you in advance!

Update: I made a clean shop and recorded a video of how to show the bug: https://youtu.be/LTITadt6D-k


Solution

  • Friend, really hard to find and fix this issue. I will try to explain myself as best as possible:

    1. When you are in All shops context Prestashop process edition as you where editing in all shops at the same time.
    2. price and whosale_price are shop's associated fields. So, if you are in All shops context you are editing this values for all shops too.
    3. You can avoid this with the following code. But take into account that with this code if you want to update prices in all shops at the same time, you won't be abble to do it. You will have to update prices only in Single/Specific shop context.

      if (Shop::getContext() != Shop::CONTEXT_SHOP)
      {
          unset($fields['price']);
          unset($fields['wholesale_price']);
      }
      

    This code should be inserted in getFieldsShop() function inside Product class located in \classes\Product.php just before return $fields;

    What this code do is telling to Product class that when you are in a Shop context diferent than Single/Specific shop context you won't update prices fields in multishops.

    Good luck.