AD0-E716 · Question #10
An Adobe Commerce developer has been tasked with applying a pricing adjustment to products on the website. The adjustments come from a database table. In this case, catalog price rules do not work…
The correct answer is C. Create a plugin for\Magento\Catalog\Model\Indexer\Product\Price::executeRow. The developer can resolve this issue by creating a plugin for the Magento\Catalog\Model\Indexer\Product\Price::executeRow() method. This method is responsible for updating the product price index. The plugin can be used to add the pricing adjustment from the database to the…
Question
An Adobe Commerce developer has been tasked with applying a pricing adjustment to products on the website. The adjustments come from a database table. In this case, catalog price rules do not work. They created a plugin for getPrice on the price model, but the layered navigation is still displaying the old price. How can this be resolved?
Options
- ACreate an implementation for \Magento\Catalog\Hodel\Product\PriceModifierlnterf ace.
- BCreate an after plugin On \Magento\Catalog\Api\Data\BasePriceInterface:: getPrice.
- CCreate a plugin for\Magento\Catalog\Model\Indexer\Product\Price::executeRow.
How the community answered
(31 responses)- A13% (4)
- B26% (8)
- C61% (19)
Explanation
The developer can resolve this issue by creating a plugin for the Magento\Catalog\Model\Indexer\Product\Price::executeRow() method. This method is responsible for updating the product price index. The plugin can be used to add the pricing adjustment from the database to the product price index. Once the product price index is updated, the layered navigation will display the correct price. Here is an example of a plugin for the executeRow() method: public function executeRow( \Magento\Catalog\Model\Indexer\Product\Price $subject, \Magento\Catalog\Model\Product $product, $adjustment = $this->getAdjustment($product); $product->setPrice($product->getPrice() + $adjustment); private function getAdjustment(Product $product) $adjustment = $product->getData('adjustment'); if (!is_numeric($adjustment)) { return $adjustment; This plugin will add the adjustment data from the product to the product price index. Once the product price index is updated, the layered navigation will display the correct price.
Topics
Community Discussion
No community discussion yet for this question.