Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
是否忽略报价项目上的Magento自定义价格?_Magento - Fatal编程技术网

是否忽略报价项目上的Magento自定义价格?

是否忽略报价项目上的Magento自定义价格?,magento,Magento,我希望能够将报价项目的价格更改为不同于产品的价格,这是基于我使用的以下代码的几个教程: $quoteItem->setCustomPrice($price); $quoteItem->setOriginalCustomPrice($price); $quoteItem->getProduct()->setIsSuperMode(true); $quote->save(); 之后,当我到达购物车时,它会显示正常价格,而不是定制价格。我检查了购物车中的报价项目,它们有

我希望能够将报价项目的价格更改为不同于产品的价格,这是基于我使用的以下代码的几个教程:

$quoteItem->setCustomPrice($price);
$quoteItem->setOriginalCustomPrice($price);
$quoteItem->getProduct()->setIsSuperMode(true);
$quote->save();
之后,当我到达购物车时,它会显示正常价格,而不是定制价格。我检查了购物车中的报价项目,它们有正确的自定义价格,但似乎被忽略了。我必须激活其他东西才能使此自定义价格生效吗

附言:


Magento v1.7应该是一个简单的解决方案:如果我没有弄错的话,您试图保存报价项目的价格,但是您保存了报价。您还需要保存报价项本身

$quoteItem->setCustomPrice($price);
$quoteItem->setOriginalCustomPrice($price);
$quoteItem->getProduct()->setIsSuperMode(true);
$quoteItem->save();
$quote->save();

好的,我发现了这个问题,但它并没有保存在我的脚本中。不知道为什么,但我已经将代码重写为两个函数,一个用于添加产品,另一个用于更改价格

所以这个代码是所有必要的:

$quoteItem->setCustomPrice($price);
$quoteItem->setOriginalCustomPrice($price);
$quoteItem->getProduct()->setIsSuperMode(true);
$quoteItem->save();

不需要保存quote,只需quoteItem。

也尝试过,但不需要保存quoteItem。当我进入购物车时,物品的定制价格已经保存。你能分享一下你是如何改变价格的吗。我面临着同样的问题,嗨,对不起,但我已经很久没有与Magento合作了。所以我现在不知道该怎么做。没关系,我正在自己尝试。