本文介绍了Prestashop Multistore - 本地商店的价格被默认商店的价格覆盖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们新开发的商店存在严重问题.

We have a serious issue in our newly developed shop.

我们在每家商店使用不同的货币和价格运行多商店设置.

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

示例产品:

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

甚至来自 Prestashop 核心开发人员的拉取请求

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

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

他后来关闭了 pull,因为它引入了其他错误并引用:......在不破坏某些东西的情况下修复某些东西越来越困难.老实说,这个补丁听起来很冒险"

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"

这似乎是一个已知错误",但 Prestashop 背后的开发团队并不打算修复该错误.

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.

先谢谢你!

更新:我做了一个干净的商店并录制了如何显示错误的视频:https://youtu.be/LTITadt6D-k

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

推荐答案

朋友,真的很难找到并解决这个问题.我会尽量解释自己:

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

  1. 当您处于所有商店环境时,Prestashop 会在您同时在所有商店进行编辑时处理版本.
  2. pricewhosale_price 是商店的关联字段.因此,如果您处于所有商店上下文,那么您也在为所有商店编辑此值.
  3. 您可以使用以下代码避免这种情况.但是请注意,如果您想同时更新所有商店的价格,使用此代码将无法做到.您只需在单一/特定商店环境中更新价格.

  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']);
}

此代码应插入到 \classes\Product.php 中的 Product 类中的 getFieldsShop() 函数中,就在 之前返回 $fields;

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

这段代码的作用是告诉 Product 类,当您处于与单一/特定商店环境不同的商店环境中时,您赢了'不更新多商店中的价格字段.

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.

祝你好运.

这篇关于Prestashop Multistore - 本地商店的价格被默认商店的价格覆盖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 03:23