예제 #1
0
 protected function _prepareMassaction()
 {
     $this->setMassactionIdField('category_id');
     $this->getMassactionBlock()->setFormFieldName('category_ids');
     $this->getMassactionBlock()->addItem('delete', array('label' => $this->__('Delete'), 'url' => $this->getUrl('*/*/massDelete'), 'confirm' => $this->__('Are you sure?')));
     $statuses = array();
     $statuses = FME_Productattachments_Model_Status::getOptionArray();
     array_unshift($statuses, array('label' => '', 'value' => ''));
     $this->getMassactionBlock()->addItem('status', array('label' => $this->__('Change status'), 'url' => $this->getUrl('*/*/massStatus', array('_current' => true)), 'additional' => array('visibility' => array('name' => 'status', 'type' => 'select', 'class' => 'required-entry', 'label' => $this->__('Status'), 'values' => $statuses))));
     return $this;
 }
예제 #2
0
 protected function _prepareForm()
 {
     $id = $this->getRequest()->getParam('id');
     $form = new Varien_Data_Form();
     $_helper = Mage::helper('productattachments');
     $fieldset = $form->addFieldset('general', array('legend' => $this->__('General information')));
     $fieldset->addField('category_name', 'text', array('name' => 'category_name', 'label' => $this->__('Title'), 'class' => 'required-entry', 'required' => true));
     $fieldset->addField('category_image', 'image', array('label' => Mage::helper('productattachments')->__('Image'), 'required' => false, 'name' => 'category_image', 'note' => Mage::helper('productattachments')->__('<p>(upload image files only)</p>')));
     if ($this->_getCategories(null, true)->count() > 0) {
         $fieldset->addField('parent_category_id', 'select', array('label' => Mage::helper('productattachments')->__('Parent Category'), 'name' => 'parent_category_id', 'type' => 'text', 'values' => $_helper->getCategoryList($id)));
     }
     if (Mage::app()->isSingleStoreMode()) {
         $fieldset->addField('category_store_ids', 'hidden', array('name' => 'category_store_ids[]', 'value' => Mage::app()->getStore()->getId()));
     } else {
         $fieldset->addField('category_store_ids', 'multiselect', array('name' => 'category_store_ids[]', 'label' => $this->__('Store View'), 'title' => $this->__('Store View'), 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true)));
     }
     $fieldset->addField('category_status', 'select', array('name' => 'category_status', 'label' => $this->__('Status'), 'values' => FME_Productattachments_Model_Status::getOptionArray()));
     $data = Mage::registry('productattachments_productcats');
     if (!is_array($data)) {
         $data = array();
     }
     if (isset($data['category_store_ids'])) {
         if (Mage::app()->isSingleStoreMode()) {
             if (is_array($data['category_store_ids'])) {
                 $data['category_store_ids'] = isset($data['category_store_ids'][0]) ? $data['category_store_ids'][0] : '';
             }
         }
     }
     $form->setValues($data);
     $this->setForm($form);
     /* if (Mage::getSingleton('adminhtml/session')->getProductattachmentsProductcats()) {
        $form->setValues(Mage::getSingleton('adminhtml/session')->getProductattachmentsProductcats());
        Mage::getSingleton('adminhtml/session')->setgetProductattachmentsProductcats(null);
        } elseif (Mage::registry('productattachments_productcats')) {//
        $form->setValues(Mage::registry('productattachments_productcats')->getData());
        } */
     return parent::_prepareForm();
 }