81 $date = new \DateTime(
$observer->getEvent()->getDate());
83 $date = $this->localeDate->scopeDate(
$storeId);
87 $wId =
$observer->getEvent()->getWebsiteId();
89 $wId = $this->storeManager->getStore(
$storeId)->getWebsiteId();
93 $gId =
$observer->getEvent()->getCustomerGroupId();
95 $gId =
$product->getCustomerGroupId();
97 $gId = $this->customerSession->getCustomerGroupId();
100 $key =
"{$date->format('Y-m-d H:i:s')}|{$wId}|{$gId}|{$pId}";
101 if (!$this->rulePricesStorage->hasRulePrice($key)) {
102 $rulePrice = $this->resourceRuleFactory->create()->getRulePrice($date, $wId, $gId, $pId);
103 $this->rulePricesStorage->setRulePrice($key, $rulePrice);
105 if ($this->rulePricesStorage->getRulePrice($key) !==
false) {
106 $finalPrice = min(
$product->getData(
'final_price'), $this->rulePricesStorage->getRulePrice($key));
107 $product->setFinalPrice($finalPrice);
__construct(RulePricesStorage $rulePricesStorage, \Magento\CatalogRule\Model\ResourceModel\RuleFactory $resourceRuleFactory, StoreManagerInterface $storeManager, TimezoneInterface $localeDate, CustomerModelSession $customerSession)
elseif(isset( $params[ 'redirect_parent']))
execute(\Magento\Framework\Event\Observer $observer)