添加追加销售产品时,请指明产品所需的选项错误

时间:2017-04-12 10:13:11

标签: magento configurable-product

如果基本产品是可配置产品,请在添加追加销售产品时指定产品所需的选项错误。这是我添加追加​​销售产品的代码

            $cart->addProduct($product, array(
            'qty' => $qty
        ));

如果基础产品是简单的产品,这是正常的。此追加销售产品没有自定义选项。

1 个答案:

答案 0 :(得分:0)

您可以尝试以下代码:

file1 = 'f1.txt'
file2 = 'f2.txt'
with open(file1, 'r') as file:
    file1data = file.read()
with open(file2, 'r') as file:
    file2data = file.read()

x = file1data.split('\n')
y = file2data.split('\n')

for i in x:
   for j in y:
      if i[:4] == j[:4]:
         file1data = file1data.replace(i,j)

with open(file1, 'w') as file:
   file.write(file1data)