Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
UpdateQuoteItems.php
Go to the documentation of this file.
1 <?php
7 
9 {
13  private $resource;
14 
18  public function __construct(
19  \Magento\Quote\Model\ResourceModel\Quote $resource
20  ) {
21  $this->resource = $resource;
22  }
23 
31  public function afterSave(
32  \Magento\Catalog\Model\ResourceModel\Product $subject,
33  \Magento\Catalog\Model\ResourceModel\Product $result,
34  \Magento\Framework\Model\AbstractModel $product
35  ) {
36  $originalPrice = $product->getOrigData('price');
37  $tierPriceChanged = $product->getData('tier_price_changed');
38  if ((!empty($originalPrice) && ($originalPrice != $product->getPrice())) || $tierPriceChanged) {
39  $this->resource->markQuotesRecollect($product->getId());
40  }
41  return $result;
42  }
43 }
__construct(\Magento\Quote\Model\ResourceModel\Quote $resource)
$resource
Definition: bulk.php:12
afterSave(\Magento\Catalog\Model\ResourceModel\Product $subject, \Magento\Catalog\Model\ResourceModel\Product $result, \Magento\Framework\Model\AbstractModel $product)