Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 protected function _afterLoad()
 {
     foreach ($this->_items as $item) {
         $item->setIndex($this->index);
     }
     return parent::_afterLoad();
 }
Ejemplo n.º 2
0
 protected function _afterLoad()
 {
     parent::_afterLoad();
     if ($storeViewId = $this->getStoreViewId()) {
         foreach ($this->_items as $item) {
             $item->setStoreViewId($storeViewId)->getStoreViewValue();
         }
     }
     return $this;
 }
 /**
  * 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;
 }
Ejemplo n.º 4
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->getWishlistItemId();
         $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;
 }
Ejemplo n.º 5
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;
 }
Ejemplo n.º 6
0
 /**
  * after collection load
  *
  * @return $this
  */
 protected function _afterLoad()
 {
     $items = $this->getColumnValues('article_id');
     $connection = $this->getConnection();
     if (count($items)) {
         $select = $connection->select()->from(['article_store' => $this->getTable('gemtoo_blog_article_store')])->where('article_store.article_id IN (?)', $items);
         if ($result = $connection->fetchPairs($select)) {
             foreach ($this as $item) {
                 /** @var $item \Gemtoo\Blog\Model\Article */
                 if (!isset($result[$item->getData('article_id')])) {
                     continue;
                 }
                 $item->setData('store_id', $result[$item->getData('article_id')]);
             }
         }
     }
     return parent::_afterLoad();
 }
Ejemplo n.º 7
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;
 }
Ejemplo n.º 8
0
 /**
  * After collection load
  *
  * @return $this
  */
 protected function _afterLoad()
 {
     $this->_eventManager->dispatch($this->_eventPrefix . '_load_after', [$this->_eventObject => $this]);
     return parent::_afterLoad();
 }
Ejemplo n.º 9
0
 /**
  * after collection load
  *
  * @return $this
  */
 protected function _afterLoad()
 {
     $items = $this->getColumnValues('author_id');
     $connection = $this->getConnection();
     if (count($items)) {
         $select = $connection->select()->from(['author_store' => $this->getTable('sample_news_author_store')])->where('author_store.author_id IN (?)', $items);
         if ($result = $connection->fetchPairs($select)) {
             foreach ($this as $item) {
                 /** @var $item \Sample\News\Model\Author */
                 if (!isset($result[$item->getData('author_id')])) {
                     continue;
                 }
                 $item->setData('store_id', $result[$item->getData('author_id')]);
             }
         }
     }
     return parent::_afterLoad();
 }
Ejemplo n.º 10
0
 /**
  * Perform operations after collection load
  *
  * @return $this
  */
 protected function _afterLoad()
 {
     $this->performAfterLoad('kuzman_product_faq_id', 'question_id', 'product_id');
     return parent::_afterLoad();
 }
Ejemplo n.º 11
0
 /**
  * After load processing
  *
  * @return $this
  */
 protected function _afterLoad()
 {
     parent::_afterLoad();
     /**
      * Assign products
      */
     $this->_assignOptions();
     $this->_assignProducts();
     $this->resetItemsDataChanged();
     $this->getPageSize();
     return $this;
 }
Ejemplo n.º 12
0
 /**
  * Perform operations after collection load
  *
  * @SuppressWarnings(PHPMD.CamelCaseMethodName)
  *
  * @return $this
  */
 protected function _afterLoad()
 {
     $this->loadStores();
     $this->loadTermsData();
     return parent::_afterLoad();
 }
Ejemplo n.º 13
0
 /**
  * Perform operations after collection load
  *
  * @return $this
  */
 protected function _afterLoad()
 {
     $items = $this->getColumnValues('post_id');
     if (count($items)) {
         $connection = $this->getConnection();
         $tableName = $this->getTable('magefan_blog_post_store');
         $select = $connection->select()->from(['cps' => $tableName])->where('cps.post_id IN (?)', $items);
         $result = $connection->fetchPairs($select);
         if ($result) {
             foreach ($this as $item) {
                 $postId = $item->getData('post_id');
                 if (!isset($result[$postId])) {
                     continue;
                 }
                 if ($result[$postId] == 0) {
                     $stores = $this->_storeManager->getStores(false, true);
                     $storeId = current($stores)->getId();
                 } else {
                     $storeId = $result[$item->getData('post_id')];
                 }
                 $item->setData('_first_store_id', $storeId);
                 $item->setData('store_ids', [$result[$postId]]);
             }
         }
         if ($this->_storeId) {
             foreach ($this as $item) {
                 $item->setStoreId($this->_storeId);
             }
         }
         $map = ['category' => 'categories', 'tag' => 'tags'];
         foreach ($map as $key => $property) {
             $tableName = $this->getTable('magefan_blog_post_' . $key);
             $select = $connection->select()->from(['cps' => $tableName])->where('cps.post_id IN (?)', $items);
             $result = $connection->fetchAll($select);
             if ($result) {
                 $data = [];
                 foreach ($result as $item) {
                     $data[$item['post_id']][] = $item[$key . '_id'];
                 }
                 foreach ($this as $item) {
                     $postId = $item->getData('post_id');
                     if (isset($data[$postId])) {
                         $item->setData($property, $data[$postId]);
                     }
                 }
             }
         }
     }
     $this->_previewFlag = false;
     return parent::_afterLoad();
 }
Ejemplo n.º 14
0
 /**
  * Perform operations after collection load
  *
  * @return $this
  */
 protected function _afterLoad()
 {
     $this->performAfterLoad('swissup_easytabs_store', 'tab_id');
     return parent::_afterLoad();
 }
 /**
  * Perform operations after collection load
  *
  * @return $this
  */
 protected function _afterLoad()
 {
     $items = $this->getColumnValues('category_id');
     if (count($items)) {
         $connection = $this->getConnection();
         $select = $connection->select()->from(['cps' => $this->getTable('magefan_blog_category_store')])->where('cps.category_id IN (?)', $items);
         $result = $connection->fetchPairs($select);
         if ($result) {
             foreach ($this as $item) {
                 $categoryId = $item->getData('category_id');
                 if (!isset($result[$categoryId])) {
                     continue;
                 }
                 if ($result[$categoryId] == 0) {
                     $stores = $this->_storeManager->getStores(false, true);
                     $storeId = current($stores)->getId();
                     $storeCode = key($stores);
                 } else {
                     $storeId = $result[$item->getData('category_id')];
                     $storeCode = $this->_storeManager->getStore($storeId)->getCode();
                 }
                 $item->setData('_first_store_id', $storeId);
                 $item->setData('store_code', $storeCode);
                 $item->setData('store_id', [$result[$categoryId]]);
             }
         }
     }
     $this->_previewFlag = false;
     return parent::_afterLoad();
 }
Ejemplo n.º 16
0
 /**
  * {@inheritdoc}
  */
 protected function _afterLoad()
 {
     $this->walk('afterLoad');
     return parent::_afterLoad();
 }
Ejemplo n.º 17
0
 /**
  * {@inheritdoc}
  */
 protected function _afterLoad()
 {
     $this->walk('afterLoad');
     $this->_items = $this->walk('unserializeProperties');
     return parent::_afterLoad();
 }
Ejemplo n.º 18
0
 /**
  * Perform operations after collection load
  *
  * @return $this
  */
 protected function _afterLoad()
 {
     $this->performAfterLoad('swissup_testimonials_store', 'testimonial_id');
     return parent::_afterLoad();
 }