/** * {@inheritdoc} */ public function getTreeModel() { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getTreeModel'); if (!$pluginInfo) { return parent::getTreeModel(); } else { return $this->___callPlugins('getTreeModel', func_get_args(), $pluginInfo); } }
/** * {@inheritdoc} */ public function afterSave() { if ($this->getScope() == 'stores') { $rootId = $this->getValue(); $storeId = $this->getScopeId(); $tree = $this->_catalogCategory->getTreeModel(); // Create copy of categories attributes for choosed store $tree->load(); $root = $tree->getNodeById($rootId); // Save root $this->_catalogCategory->setStoreId(0)->load($root->getId()); $this->_catalogCategory->setStoreId($storeId)->save(); foreach ($root->getAllChildNodes() as $node) { $this->_catalogCategory->setStoreId(0)->load($node->getId()); $this->_catalogCategory->setStoreId($storeId)->save(); } } return parent::afterSave(); }
public function testGetTreeModel() { $model = $this->_model->getTreeModel(); $this->assertInstanceOf('Magento\\Catalog\\Model\\ResourceModel\\Category\\Tree', $model); $this->assertNotSame($model, $this->_model->getTreeModel()); }