أين موقع الوظيفة التي يتم استدعاؤها بواسطة هذا الرابط "admin/catalog_category/tree/store/17/id/588/?isAjax=true"
-
13-12-2019 - |
سؤال
أنا أعمل على وظائف الإدارة الفرعية لمواقع ويب متعددة. عندما أذهب لإدارة صفحة الفئات والتبديل بين مواقع الويب، تعمل مكالمة أجاكس لنفس الغرض. وهو ما يسمى لايم هذا الرابط
admin/catalog_category/tree/store/17/id/588/?isAjax=true
أريد الحصول على مكان كتابة الوظيفة لهذا الغرض.
المحلول
تمت كتابة هذه الوظيفة في
app\code\core\Mage\Adminhtml\controllers\Catalog\CategoryController.php
في
public function treeAction()
{
$storeId = (int) $this->getRequest()->getParam('store');
$categoryId = (int) $this->getRequest()->getParam('id');
if ($storeId) {
if (!$categoryId) {
$store = Mage::app()->getStore($storeId);
$rootId = $store->getRootCategoryId();
$this->getRequest()->setParam('id', $rootId);
}
}
$category = $this->_initCategory(true);
$block = $this->getLayout()->createBlock('adminhtml/catalog_category_tree');
$root = $block->getRoot();
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array(
'data' => $block->getTree(),
'parameters' => array(
'text' => $block->buildNodeName($root),
'draggable' => false,
'allowDrop' => ($root->getIsVisible()) ? true : false,
'id' => (int) $root->getId(),
'expanded' => (int) $block->getIsWasExpanded(),
'store_id' => (int) $block->getStore()->getId(),
'category_id' => (int) $category->getId(),
'root_visible'=> (int) $root->getIsVisible()
))));
}
لا تنتمي إلى magento.stackexchange