The idea is to be able to filter products by the conditions which allow only product attributes. (I do not want the additional columns in the grid instead). When I click "All" or "TRUE" or green "+" nothing happens. I know this feature involves a lot of deep Magento knowledge which I don't yet posses. For now I am trying to make the code work the dirty way (I am amending core files) for testing purposes. Ideally I need to have an observer or the layout file.
The core file I amend to implement the feature is called
Tabs.php and is located under
The particular function is called
_prepareLayout() I am trying to inject the created form to the
Category Products tab which is represented by the class extending the grid. Since I am adding a new form to the tab alongside the original grid I concluded to amend the
Tabs.php file instead of the
Grid.php one. Here is the content:
$model = Mage::getModel('salesrule/rule')->getCollection()->getFirstItem(); $renderer = Mage::getBlockSingleton('adminhtml/widget_form_renderer_fieldset'); $text = 'Apply the rule only to cart items matching the following conditions (leave blank for all items)'; $config = array('legend' => Mage::helper('salesrule')->__($text)); $fieldset = $form->addFieldset('actions_fieldset', $config)->setRenderer($renderer); $fieldset->addField('actions', 'text', array( 'name' => 'actions', 'label' => Mage::helper('salesrule')->__('Apply To'), 'title' => Mage::helper('salesrule')->__('Apply To'), 'required' => true, ))->setRule($model)->setRenderer(Mage::getBlockSingleton('rule/actions')); $form->setValues($model->getData()); $this->addTab('products', array( 'label' => Mage::helper('catalog')->__('Category Products'), 'content' => $form->toHtml() . $this->getLayout()->createBlock( 'adminhtml/catalog_category_tab_product', 'category.product.grid' )->toHtml(), ));
The original "Shopping Cart Price Rules" is implemented in (there are tons of files really, but the main one is probably in) the
Actions.php file located under
app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab directory. The function is called
Can you help me by giving a hint on how can I implement that rule block please? Huge thank you in advance!