Closed RuudvdvNB closed 4 years ago
Same for me. I fixed this modification :
replace this function
public function handle(Product $product, PimcoreProductInterface $pimcoreProduct): array
{
if (null === $pimcoreProduct->getData('price') && null === $product->getPrice()) {
$pimcoreProduct->setData('price', self::$defaultPriceValue);
$pimcoreProduct->setData('base_price', self::$defaultPriceValue);
} elseif (null !== $product->getPrice()) {
$pimcoreProduct->setData('price', $product->getPrice());
}
$pimcoreProduct->setData('base_price', $pimcoreProduct->getData('price'));
return [$product, $pimcoreProduct];
}
by this one
public function handle(Product $product, PimcoreProductInterface $pimcoreProduct): array
{
if (null === $pimcoreProduct->getData('price') && null === $product->getPrice()) {
$pimcoreProduct->setData('price', self::$defaultPriceValue);
$pimcoreProduct->setData('base_price', self::$defaultPriceValue);
} elseif ($pimcoreProduct->getData('price') !== $product->getPrice()) {
//$pimcoreProduct->setData('price', $product->getPrice());
$pimcoreProduct->setData('base_price', $pimcoreProduct->getData('price'));
}
$pimcoreProduct->setData('base_price', $pimcoreProduct->getData('price'));
return [$product, $pimcoreProduct];
}
This "feature" was added on purpose because at the moment of creating it we thought that PIM should be not a master of price data. Though the solution is not perfect.
This "feature" was added on purpose because at the moment of creating it we thought that PIM should be not a master of price data. Though the solution is not perfect. This "feature" was added on purpose because at the moment of creating it we thought that PIM should be not a master of price data. Though the solution is not perfect.
In my case, I work with an ERP which is connected to pimcore and i need update easily all my prices on magento based on the synchronization of Pimcore and my ERP automatically. Maybe adding an option would be useful to give PIMCORE full control or not ?
Little correction :
if (null === $pimcoreProduct->getData('price') && null === $product->getPrice()) {
$pimcoreProduct->setData('price', self::$defaultPriceValue);
$pimcoreProduct->setData('base_price', self::$defaultPriceValue);
} elseif (null === $pimcoreProduct->getData('price') && null !== $product->getPrice()) {
$pimcoreProduct->setData('price', $product->getPrice());
} else {
$pimcoreProduct->setData('base_price', $pimcoreProduct->getData('price'));
}
This issue is addressed in https://github.com/DivanteLtd/magento2-pimcore-bridge/pull/25 Now it will be possible to configure if price should be overriden.
For our clients we advice to manage the product prices in Pimcore, but once a product is created in Magento the price isn't update anymore because of this part in the PriceModifier.php.
Is this a bug or is there a reason why the PriceModifier is doing this?