Exemple #1
0
 /**
  * Process category data after save category object
  * save related products ids and update path value
  *
  * @param \Magento\Framework\DataObject $object
  * @return $this
  */
 protected function _afterSave(\Magento\Framework\DataObject $object)
 {
     /**
      * Add identifier for new category
      */
     if (substr($object->getPath(), -1) == '/') {
         $object->setPath($object->getPath() . $object->getId());
         $this->_savePath($object);
     }
     $this->_saveCategoryProducts($object);
     return parent::_afterSave($object);
 }
Exemple #2
0
 /**
  * Save data related with product
  *
  * @param \Magento\Framework\DataObject $product
  * @return $this
  */
 protected function _afterSave(\Magento\Framework\DataObject $product)
 {
     $this->_saveWebsiteIds($product)->_saveCategories($product);
     return parent::_afterSave($product);
 }