Public Member Functions | |
chooserAction () | |
categoriesJsonAction () | |
Protected Member Functions | |
_isAllowed () | |
_initCategory () |
Definition at line 28 of file WidgetController.php.
_initCategory | ( | ) | [protected] |
Initialize category object in registry
Definition at line 83 of file WidgetController.php.
00084 { 00085 $categoryId = (int) $this->getRequest()->getParam('id',false); 00086 00087 $storeId = (int) $this->getRequest()->getParam('store'); 00088 00089 $category = Mage::getModel('catalog/category'); 00090 $category->setStoreId($storeId); 00091 00092 if ($categoryId) { 00093 $category->load($categoryId); 00094 if ($storeId) { 00095 $rootId = Mage::app()->getStore($storeId)->getRootCategoryId(); 00096 if (!in_array($rootId, $category->getPathIds())) { 00097 $this->_redirect('*/*/', array('_current'=>true, 'id'=>null)); 00098 return false; 00099 } 00100 } 00101 } 00102 00103 Mage::register('category', $category); 00104 Mage::register('current_category', $category); 00105 return $category; 00106 }
_isAllowed | ( | ) | [protected] |
Reimplemented from Mage_Adminhtml_Controller_Action.
Definition at line 55 of file WidgetController.php.
00056 { 00057 return Mage::getSingleton('admin/session')->isAllowed('promo/catalog'); 00058 }
categoriesJsonAction | ( | ) |
Get tree node (Ajax version)
Definition at line 63 of file WidgetController.php.
00064 { 00065 if ($categoryId = (int) $this->getRequest()->getPost('id')) { 00066 $this->getRequest()->setParam('id', $categoryId); 00067 00068 if (!$category = $this->_initCategory()) { 00069 return; 00070 } 00071 $this->getResponse()->setBody( 00072 $this->getLayout()->createBlock('adminhtml/catalog_category_tree') 00073 ->getTreeJson($category) 00074 ); 00075 } 00076 }
chooserAction | ( | ) |
Definition at line 30 of file WidgetController.php.
00031 { 00032 $block = false; 00033 switch ($this->getRequest()->getParam('attribute')) { 00034 case 'sku': 00035 $block = $this->getLayout()->createBlock( 00036 'adminhtml/promo_widget_chooser_sku', 'promo_widget_chooser_sku', 00037 array('js_form_object' => $this->getRequest()->getParam('form'), 00038 )); 00039 break; 00040 00041 case 'category_ids': 00042 $block = $this->getLayout()->createBlock( 00043 'adminhtml/catalog_category_checkboxes_tree', 'promo_widget_chooser_category_ids', 00044 array('js_form_object' => $this->getRequest()->getParam('form')) 00045 ) 00046 ->setCategoryIds($this->getRequest()->getParam('selected', array())) 00047 ; 00048 break; 00049 } 00050 if ($block) { 00051 $this->getResponse()->setBody($block->toHtml()); 00052 } 00053 }