/**
  * Add website ids to rules data
  *
  * @return $this
  */
 protected function _afterLoad()
 {
     parent::_afterLoad();
     if ($this->getFlag('add_websites_to_result') && $this->_items) {
         /** @var \Magento\Rule\Model\AbstractModel $item */
         foreach ($this->_items as $item) {
             $item->afterLoad();
         }
     }
     return $this;
 }
Example #2
0
 /**
  * Fill array of options by item and product
  *
  * @return $this
  */
 protected function _afterLoad()
 {
     parent::_afterLoad();
     foreach ($this as $option) {
         $optionId = $option->getId();
         $itemId = $option->getItemId();
         $productId = $option->getProductId();
         if (isset($this->_optionsByItem[$itemId])) {
             $this->_optionsByItem[$itemId][] = $optionId;
         } else {
             $this->_optionsByItem[$itemId] = [$optionId];
         }
         if (isset($this->_optionsByProduct[$productId])) {
             $this->_optionsByProduct[$productId][] = $optionId;
         } else {
             $this->_optionsByProduct[$productId] = [$optionId];
         }
     }
     return $this;
 }
Example #3
0
 /**
  * Add data fetched from another database
  *
  * @return $this
  */
 protected function _afterLoad()
 {
     parent::_afterLoad();
     $items = $this->getItems();
     $productIds = [];
     foreach ($items as $item) {
         $productIds[] = $item->getProductId();
     }
     $productData = $this->getProductData($productIds);
     $orderData = $this->getOrdersData($productIds);
     foreach ($items as $item) {
         $item->setId($item->getProductId());
         $item->setPrice($productData[$item->getProductId()]['price'] * $item->getBaseToGlobalRate());
         $item->setName($productData[$item->getProductId()]['name']);
         $item->setOrders(0);
         if (isset($orderData[$item->getProductId()])) {
             $item->setOrders($orderData[$item->getProductId()]['orders']);
         }
     }
     return $this;
 }
Example #4
0
 /**
  * After collection load
  *
  * @return $this
  */
 protected function _afterLoad()
 {
     $this->_eventManager->dispatch($this->_eventPrefix . '_load_after', [$this->_eventObject => $this]);
     return parent::_afterLoad();
 }
Example #5
0
 /**
  * After load collection process
  *
  * @return $this
  */
 protected function _afterLoad()
 {
     parent::_afterLoad();
     \Magento\Framework\Profiler::start('TTT1:' . __METHOD__, ['group' => 'TTT1', 'method' => __METHOD__]);
     $this->_addProductAttributes();
     \Magento\Framework\Profiler::stop('TTT1:' . __METHOD__);
     \Magento\Framework\Profiler::start('TTT2:' . __METHOD__, ['group' => 'TTT2', 'method' => __METHOD__]);
     $this->_addAssociatedProductFilters();
     \Magento\Framework\Profiler::stop('TTT2:' . __METHOD__);
     \Magento\Framework\Profiler::start('TTT3:' . __METHOD__, ['group' => 'TTT3', 'method' => __METHOD__]);
     $this->_loadLabels();
     \Magento\Framework\Profiler::stop('TTT3:' . __METHOD__);
     \Magento\Framework\Profiler::start('TTT4:' . __METHOD__, ['group' => 'TTT4', 'method' => __METHOD__]);
     $this->loadOptions();
     \Magento\Framework\Profiler::stop('TTT4:' . __METHOD__);
     return $this;
 }
Example #6
0
 /**
  * After load processing
  *
  * @return $this
  */
 protected function _afterLoad()
 {
     parent::_afterLoad();
     /**
      * Assign products
      */
     $this->_assignOptions();
     $this->_assignProducts();
     $this->resetItemsDataChanged();
     $this->getPageSize();
     return $this;
 }