Ejemplo n.º 1
29
 /**
  * Adds 'used_in_recommender' form field
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  */
 public function addUsedInRecommender(\Magento\Framework\Event\Observer $observer)
 {
     /** @var \Magento\Framework\Data\Form $form */
     $form = $observer->getEvent()->getForm();
     $fieldset = $form->getElement('advanced_fieldset');
     $fieldset->addField('used_in_recommender', 'select', ['name' => 'used_in_recommender', 'label' => __('Used in Recommender'), 'title' => __('Used in Recommender (Exported to the recommender system)'), 'note' => __('Exported to the recommender system'), 'values' => $this->_yesNo->toOptionArray()]);
 }
Ejemplo n.º 2
0
 /**
  * Process shipping method and save
  *
  * @param EventObserver $observer
  * @return void
  */
 public function execute(EventObserver $observer)
 {
     if ($this->shipperDataHelper->getConfigValue('carriers/shipper/active')) {
         $request = $observer->getEvent()->getRequest();
         $shippingMethods = $request->getPost('shipping_method', '');
         if (!is_array($shippingMethods)) {
             return;
         }
         foreach ($shippingMethods as $addressId => $shippingMethod) {
             if (empty($shippingMethod)) {
                 return;
             }
             $quote = $observer->getEvent()->getQuote();
             $addresses = $quote->getAllShippingAddresses();
             $shippingAddress = false;
             foreach ($addresses as $address) {
                 if ($address->getId() == $addressId) {
                     $shippingAddress = $address;
                     break;
                 }
             }
             $this->carrierGroupHelper->saveCarrierGroupInformation($shippingAddress, $shippingMethod);
         }
     }
 }
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     try {
         if (!$this->_registry->registry('core_config_data_save_after_done')) {
             if ($groups = $observer->getEvent()->getConfigData()->getGroups()) {
                 if (isset($groups['catalog_sync']['fields']['catalog_values']['value'])) {
                     $configAfter = $groups['catalog_sync']['fields']['catalog_values']['value'];
                     $configBefore = $this->_registry->registry('core_config_data_save_before');
                     if ($configAfter != $configBefore) {
                         //reset catalog to re-import
                         $this->_connectorCatalogFactory->create()->reset();
                     }
                     $this->_registry->register('core_config_data_save_after_done', true);
                 }
             }
         }
         if (!$this->_registry->registry('core_config_data_save_after_done_status')) {
             if ($groups = $observer->getEvent()->getConfigData()->getGroups()) {
                 if (isset($groups['data_fields']['fields']['order_statuses']['value'])) {
                     $configAfter = $groups['data_fields']['fields']['order_statuses']['value'];
                     $configBefore = $this->_registry->registry('core_config_data_save_before_status');
                     if ($configAfter != $configBefore) {
                         //reset all contacts
                         $this->_connectorContactFactory->create()->resetAllContacts();
                     }
                     $this->_registry->register('core_config_data_save_after_done_status', true);
                 }
             }
         }
     } catch (\Exception $e) {
         $this->_helper->debug((string) $e, array());
     }
     return $this;
 }
 /**
  * Apply catalog price rules to product on frontend
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return $this
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     $product = $observer->getEvent()->getProduct();
     $pId = $product->getId();
     $storeId = $product->getStoreId();
     if ($observer->hasDate()) {
         $date = new \DateTime($observer->getEvent()->getDate());
     } else {
         $date = $this->localeDate->scopeDate($storeId);
     }
     if ($observer->hasWebsiteId()) {
         $wId = $observer->getEvent()->getWebsiteId();
     } else {
         $wId = $this->storeManager->getStore($storeId)->getWebsiteId();
     }
     if ($observer->hasCustomerGroupId()) {
         $gId = $observer->getEvent()->getCustomerGroupId();
     } elseif ($product->hasCustomerGroupId()) {
         $gId = $product->getCustomerGroupId();
     } else {
         $gId = $this->customerSession->getCustomerGroupId();
     }
     $key = "{$date->format('Y-m-d H:i:s')}|{$wId}|{$gId}|{$pId}";
     if (!$this->rulePricesStorage->hasRulePrice($key)) {
         $rulePrice = $this->resourceRuleFactory->create()->getRulePrice($date, $wId, $gId, $pId);
         $this->rulePricesStorage->setRulePrice($key, $rulePrice);
     }
     if ($this->rulePricesStorage->getRulePrice($key) !== false) {
         $finalPrice = min($product->getData('final_price'), $this->rulePricesStorage->getRulePrice($key));
         $product->setFinalPrice($finalPrice);
     }
     return $this;
 }
Ejemplo n.º 5
0
 public function testSetEvent()
 {
     $event = 'someEvent';
     $this->observer->setEvent($event);
     $result = $this->observer->getData('event');
     $this->assertEquals($result, $this->observer->getEvent($event));
 }
Ejemplo n.º 6
0
 /**
  * Generate options for currency displaying with custom currency symbol
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return $this
  */
 public function currencyDisplayOptions(\Magento\Framework\Event\Observer $observer)
 {
     $baseCode = $observer->getEvent()->getBaseCode();
     $currencyOptions = $observer->getEvent()->getCurrencyOptions();
     $currencyOptions->setData($this->_currencySymbolData->getCurrencyOptions($baseCode));
     return $this;
 }
Ejemplo n.º 7
0
 /**
  * Set new customer group to all his quotes
  *
  * @param Observer $observer
  * @return void
  */
 public function dispatch(Observer $observer)
 {
     /** @var \Magento\Customer\Api\Data\CustomerInterface $customer */
     $customer = $observer->getEvent()->getCustomerDataObject();
     /** @var \Magento\Customer\Api\Data\CustomerInterface $origCustomer */
     $origCustomer = $observer->getEvent()->getOrigCustomerDataObject();
     if ($customer->getGroupId() !== $origCustomer->getGroupId()) {
         /**
          * It is needed to process customer's quotes for all websites
          * if customer accounts are shared between all of them
          */
         /** @var $websites \Magento\Store\Model\Website[] */
         $websites = $this->config->isWebsiteScope() ? [$this->storeManager->getWebsite($customer->getWebsiteId())] : $this->storeManager->getWebsites();
         foreach ($websites as $website) {
             try {
                 $quote = $this->quoteRepository->getForCustomer($customer->getId());
                 $quote->setWebsite($website);
                 $quote->setCustomerGroupId($customer->getGroupId());
                 $quote->collectTotals();
                 $this->quoteRepository->save($quote);
             } catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
             }
         }
     }
 }
 /**
  * Generate options for currency displaying with custom currency symbol
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return $this
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     $baseCode = $observer->getEvent()->getBaseCode();
     $currencyOptions = $observer->getEvent()->getCurrencyOptions();
     $currencyOptions->setData($this->getCurrencyOptions($baseCode));
     return $this;
 }
 /**
  * Just some test code to log customer email on login
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return self
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     $password = $observer->getEvent()->getPassword();
     $customer = $observer->getEvent()->getModel();
     $this->logger->debug('Foggyline\\Office: ' . $customer->getEmail() . ' Password: ' . $password);
     return $this;
 }
Ejemplo n.º 10
0
 /**
  * Check move quote item to wishlist request
  *
  * @param   Observer $observer
  * @return  $this
  */
 public function execute(Observer $observer)
 {
     $cart = $observer->getEvent()->getCart();
     $data = $observer->getEvent()->getInfo()->toArray();
     $productIds = [];
     $wishlist = $this->getWishlist($cart->getQuote()->getCustomerId());
     if (!$wishlist) {
         return $this;
     }
     /**
      * Collect product ids marked for move to wishlist
      */
     foreach ($data as $itemId => $itemInfo) {
         if (!empty($itemInfo['wishlist']) && ($item = $cart->getQuote()->getItemById($itemId))) {
             $productId = $item->getProductId();
             $buyRequest = $item->getBuyRequest();
             if (array_key_exists('qty', $itemInfo) && is_numeric($itemInfo['qty'])) {
                 $buyRequest->setQty($itemInfo['qty']);
             }
             $wishlist->addNewItem($productId, $buyRequest);
             $productIds[] = $productId;
             $cart->getQuote()->removeItem($itemId);
         }
     }
     if (count($productIds)) {
         $wishlist->save();
         $this->wishlistData->calculate();
     }
     return $this;
 }
 /**
  * Checking whether the using static urls in WYSIWYG allowed event
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     $block = $observer->getEvent()->getBlock();
     $menuRootNode = $observer->getEvent()->getMenu();
     $block->addIdentity(Category::CACHE_TAG);
     $rootId = $this->storeManager->getStore()->getRootCategoryId();
     $storeId = $this->storeManager->getStore()->getId();
     /** @var \Magento\Catalog\Model\ResourceModel\Category\Collection $collection */
     $collection = $this->getCategoryTree($storeId, $rootId);
     $currentCategory = $this->getCurrentCategory();
     $mapping = [$rootId => $menuRootNode];
     // use nodes stack to avoid recursion
     foreach ($collection as $category) {
         if (!isset($mapping[$category->getParentId()])) {
             continue;
         }
         /** @var Node $parentCategoryNode */
         $parentCategoryNode = $mapping[$category->getParentId()];
         $categoryNode = new Node($this->getCategoryAsArray($category, $currentCategory), 'id', $parentCategoryNode->getTree(), $parentCategoryNode);
         $parentCategoryNode->addChild($categoryNode);
         $mapping[$category->getId()] = $categoryNode;
         //add node in stack
         $block->addIdentity(Category::CACHE_TAG . '_' . $category->getId());
     }
 }
Ejemplo n.º 12
0
 /**
  * Set new customer group to all his quotes
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  */
 public function dispatch(\Magento\Framework\Event\Observer $observer)
 {
     /** @var CustomerData $customerDataObject */
     $customerDataObject = $observer->getEvent()->getCustomerDataObject();
     /** @var CustomerData $origCustomerDataObject */
     $origCustomerDataObject = $observer->getEvent()->getOrigCustomerDataObject();
     if ($customerDataObject->getGroupId() !== $origCustomerDataObject->getGroupId()) {
         /**
          * It is needed to process customer's quotes for all websites
          * if customer accounts are shared between all of them
          */
         /** @var $websites \Magento\Store\Model\Website[] */
         $websites = $this->_config->isWebsiteScope() ? array($this->_storeManager->getWebsite($customerDataObject->getWebsiteId())) : $this->_storeManager->getWebsites();
         foreach ($websites as $website) {
             $quote = $this->_quoteFactory->create();
             $quote->setWebsite($website);
             $quote->loadByCustomer($customerDataObject->getId());
             if ($quote->getId()) {
                 $quote->setCustomerGroupId($customerDataObject->getGroupId());
                 $quote->collectTotals();
                 $quote->save();
             }
         }
     }
 }
 /**
  * Check move quote item to wishlist request
  *
  * @param   Observer $observer
  * @return  $this
  */
 public function execute(Observer $observer)
 {
     $cart = $observer->getEvent()->getCart();
     $data = $observer->getEvent()->getInfo()->toArray();
     $this->_logger->log(null, $data);
     return $this;
 }
Ejemplo n.º 14
0
 public function execute(\Magento\Framework\Event\Observer $eventObserver)
 {
     // event dispatched for ALL rendered magento blocks, so we need to skip unnecessary blocks ASAP
     if (!$eventObserver->getEvent()->getBlock() instanceof \Magento\Shipping\Block\Adminhtml\Create && !$eventObserver->getEvent()->getBlock() instanceof \Magento\Shipping\Block\Adminhtml\View) {
         return;
     }
     parent::execute($eventObserver);
 }
 /**
  * Set recurring payment renderer
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  */
 public function execute($observer)
 {
     $form = $observer->getEvent()->getForm();
     $recurringPaymentElement = $form->getElement('recurring_payment');
     $recurringPaymentBlock = $observer->getEvent()->getLayout()->createBlock('Magento\\RecurringPayment\\Block\\Adminhtml\\Product\\Edit\\Tab\\Price\\Recurring');
     if ($recurringPaymentElement) {
         $recurringPaymentElement->setRenderer($recurringPaymentBlock);
     }
 }
 /**
  * Block admin ability to use customer billing agreements
  *
  * @param EventObserver $observer
  * @return void
  */
 public function execute(EventObserver $observer)
 {
     $event = $observer->getEvent();
     $methodInstance = $event->getMethodInstance();
     if ($methodInstance instanceof \Magento\Paypal\Model\Payment\Method\Billing\AbstractAgreement && false == $this->_authorization->isAllowed('Magento_Paypal::use')) {
         /** @var \Magento\Framework\DataObject $result */
         $result = $observer->getEvent()->getResult();
         $result->setData('is_available', false);
     }
 }
Ejemplo n.º 17
0
 /**
  * Assign Kana to destination obj
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return $this
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     $quote = $observer->getEvent()->getQuote();
     $order = $observer->getEvent()->getOrder();
     $fKana = $quote->getCustomerFirstnamekana();
     $lKana = $quote->getCustomerLastnamekana();
     $order->setCustomerFirstnamekana($fKana);
     $order->setCustomerLastnamekana($lKana);
     return $this;
 }
 /**
  * Assign Kana to destination obj
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return $this
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     /** @var \Magento\Customer\Api\Data\CustomerInterface $customer */
     $customer = $observer->getEvent()->getCustomer();
     $request = $observer->getEvent()->getRequest();
     $posted = $request->getParam('customer');
     $customer->setCustomAttribute('firstnamekana', $posted['firstnamekana']);
     $customer->setCustomAttribute('lastnamekana', $posted['lastnamekana']);
     return $this;
 }
Ejemplo n.º 19
0
 /**
  * Theme registration test
  *
  * @magentoDbIsolation enabled
  * @magentoAppIsolation enabled
  */
 public function testThemeRegistration()
 {
     $pattern = 'path_pattern';
     $this->_eventObserver->getEvent()->setPathPattern($pattern);
     $themeRegistration = $this->getMock('Magento\\Theme\\Model\\Theme\\Registration', ['register'], [$this->_objectManager->create('Magento\\Theme\\Model\\Resource\\Theme\\Data\\CollectionFactory'), $this->_objectManager->create('Magento\\Theme\\Model\\Theme\\Data\\Collection'), $this->_objectManager->create('Magento\\Framework\\Filesystem')]);
     $themeRegistration->expects($this->once())->method('register')->with($this->equalTo($pattern));
     $this->_objectManager->addSharedInstance($themeRegistration, 'Magento\\Theme\\Model\\Theme\\Registration');
     /** @var $observer \Magento\Theme\Model\Observer */
     $observer = $this->_objectManager->create('Magento\\Theme\\Model\\Observer');
     $observer->themeRegistration($this->_eventObserver);
 }
Ejemplo n.º 20
0
 /**
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  */
 public function observe(\Magento\Framework\Event\Observer $observer)
 {
     /** @var \Magento\Sales\Model\Quote $quote */
     $quote = $observer->getEvent()->getQuote();
     /** @var \Magento\Payment\Model\Method\AbstractMethod $paymentMethod */
     $paymentMethod = $observer->getEvent()->getMethodInstance();
     $result = $observer->getEvent()->getResult();
     if ($quote && $this->quoteFilter->hasRecurringItems($quote) && !$this->specification->isSatisfiedBy($paymentMethod->getCode())) {
         $result->isAvailable = false;
     }
 }
 /**
  * @param \Magento\Framework\Event\Observer $observer
  *
  * @return \Magento\Framework\Event\Observer
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     if ($this->_useMercadoEnvios()) {
         $event = $observer->getEvent();
         $methodInstance = $event->getMethodInstance();
         if (!$methodInstance instanceof \MercadoPago\Core\Model\Standard\Payment) {
             $result = $observer->getEvent()->getResult();
             $result->setData('is_available', false);
         }
     }
     return $observer;
 }
 /**
  * Assign Kana to destination obj
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return $this
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     $order = $observer->getEvent()->getSource();
     $target = $observer->getEvent()->getTarget();
     $fKana = $this->attributeValueFactory->create();
     $fKana->setAttributeCode('firstnamekana')->setValue($order->getFirstnamekana());
     $lKana = $this->attributeValueFactory->create();
     $lKana->setAttributeCode('lastnamekana')->setValue($order->getLastnamekana());
     $key = AbstractExtensibleObject::CUSTOM_ATTRIBUTES_KEY;
     $target->setData($key, ['firstnamekana' => $fKana, 'lastnamekana' => $lKana]);
     return $this;
 }
 /**
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     /** @var Category $category */
     $category = $observer->getEvent()->getCategory();
     $data = $observer->getEvent()->getRequest()->getPostValue();
     /**
      * Create Permanent Redirect for old URL key
      */
     if ($category->getId() && isset($data['url_key_create_redirect'])) {
         $category->setData('save_rewrites_history', (bool) $data['url_key_create_redirect']);
     }
 }
 /**
  * Upgrade customer password hash when customer has logged in
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     $password = $observer->getEvent()->getData('password');
     /** @var \Magento\Customer\Model\Customer $model */
     $model = $observer->getEvent()->getData('model');
     $customer = $this->customerRepository->getById($model->getId());
     $customerSecure = $this->customerRegistry->retrieveSecureData($model->getId());
     if (!$this->encryptor->validateHashVersion($customerSecure->getPasswordHash(), true)) {
         $customerSecure->setPasswordHash($this->encryptor->getHash($password, true));
         $this->customerRepository->save($customer);
     }
 }
 /**
  * Append bundles in upsell list for current product
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return $this
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     /* @var $product \Magento\Catalog\Model\Product */
     $product = $observer->getEvent()->getProduct();
     /**
      * Check is current product type is allowed for bundle selection product type
      */
     if (!in_array($product->getTypeId(), $this->bundleData->getAllowedSelectionTypes())) {
         return $this;
     }
     /* @var $collection \Magento\Catalog\Model\ResourceModel\Product\Link\Product\Collection */
     $collection = $observer->getEvent()->getCollection();
     $limit = $observer->getEvent()->getLimit();
     if (is_array($limit)) {
         if (isset($limit['upsell'])) {
             $limit = $limit['upsell'];
         } else {
             $limit = 0;
         }
     }
     /* @var $resource \Magento\Bundle\Model\ResourceModel\Selection */
     $resource = $this->bundleSelection;
     $productIds = array_keys($collection->getItems());
     if ($limit !== null && $limit <= count($productIds)) {
         return $this;
     }
     // retrieve bundle product ids
     $bundleIds = $resource->getParentIdsByChild($product->getId());
     // exclude up-sell product ids
     $bundleIds = array_diff($bundleIds, $productIds);
     if (!$bundleIds) {
         return $this;
     }
     /* @var $bundleCollection \Magento\Catalog\Model\ResourceModel\Product\Collection */
     $bundleCollection = $product->getCollection()->addAttributeToSelect($this->config->getProductAttributes())->addStoreFilter()->addMinimalPrice()->addFinalPrice()->addTaxPercents()->setVisibility($this->productVisibility->getVisibleInCatalogIds());
     if ($limit !== null) {
         $bundleCollection->setPageSize($limit);
     }
     $bundleCollection->addFieldToFilter('entity_id', ['in' => $bundleIds])->setFlag('do_not_use_category_id', true);
     if ($collection instanceof \Magento\Framework\Data\Collection) {
         foreach ($bundleCollection as $item) {
             $collection->addItem($item);
         }
     } elseif ($collection instanceof \Magento\Framework\DataObject) {
         $items = $collection->getItems();
         foreach ($bundleCollection as $item) {
             $items[$item->getEntityId()] = $item;
         }
         $collection->setItems($items);
     }
     return $this;
 }
Ejemplo n.º 26
0
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     $fullActionName = $observer->getEvent()->getFullActionName();
     /** @var \Magento\Framework\View\Layout $layout */
     $layout = $observer->getEvent()->getLayout();
     $handler = '';
     if ($fullActionName == 'catalog_product_view') {
         $handler = 'catalog_product_view_subscription';
     }
     if ($handler) {
         $layout->getUpdate()->addHandle($handler);
     }
 }
 /**
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     if ($observer->getEvent()->getState() != \Magento\Sales\Model\Order::STATE_NEW) {
         return;
     }
     $status = $observer->getEvent()->getStatus();
     $defaultStatus = $this->_salesOrderConfig->getStateDefaultStatus(\Magento\Sales\Model\Order::STATE_NEW);
     $methods = $this->_paymentConfig->getActiveMethods();
     foreach ($methods as $method) {
         if ($method->getConfigData('order_status') == $status) {
             $this->_resourceConfig->saveConfig('payment/' . $method->getCode() . '/order_status', $defaultStatus, 'default', 0);
         }
     }
 }
 /**
  * Restore initial customer group ID in quote if needed on collect_totals_after event of quote address
  *
  * @param Observer $observer
  * @return void
  */
 public function execute(Observer $observer)
 {
     /** @var ShippingAssignmentInterface $shippingAssignment */
     $shippingAssignment = $observer->getEvent()->getShippingAssignment();
     /** @var Quote $quote */
     $quote = $observer->getEvent()->getQuote();
     $address = $shippingAssignment->getShipping()->getAddress();
     $configAddressType = $this->customerAddressHelper->getTaxCalculationAddressType();
     // Restore initial customer group ID in quote only if VAT is calculated based on shipping address
     if ($address->hasPrevQuoteCustomerGroupId() && $configAddressType == AbstractAddress::TYPE_SHIPPING) {
         $quote->setCustomerGroupId($address->getPrevQuoteCustomerGroupId());
         $address->unsPrevQuoteCustomerGroupId();
     }
 }
 /**
  * Push additional actions to tracker before `trackPageView' is added
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return \Henhed\Piwik\Observer\BeforeTrackPageViewObserver
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     $tracker = $observer->getEvent()->getTracker();
     /* @var $tracker \Henhed\Piwik\Model\Tracker */
     $this->_pushLinkTracking($tracker);
     return $this;
 }
 /**
  * Refresh stock index for specific stock items after successful order placement
  *
  * @param EventObserver $observer
  * @return void
  */
 public function execute(EventObserver $observer)
 {
     // Reindex quote ids
     $quote = $observer->getEvent()->getQuote();
     $productIds = [];
     foreach ($quote->getAllItems() as $item) {
         $productIds[$item->getProductId()] = $item->getProductId();
         $children = $item->getChildrenItems();
         if ($children) {
             foreach ($children as $childItem) {
                 $productIds[$childItem->getProductId()] = $childItem->getProductId();
             }
         }
     }
     if ($productIds) {
         $this->stockIndexerProcessor->reindexList($productIds);
     }
     // Reindex previously remembered items
     $productIds = [];
     foreach ($this->itemsForReindex->getItems() as $item) {
         $item->save();
         $productIds[] = $item->getProductId();
     }
     if (!empty($productIds)) {
         $this->priceIndexer->reindexList($productIds);
     }
     $this->itemsForReindex->clear();
     // Clear list of remembered items - we don't need it anymore
 }