Where to change Magento default tabs on products? -
i struggling problem hope can helpful with.
i need change default product tabs on product page, can't change in backend, set different attributes.
i have narrowed down catalog.xml file, don't know exact code controlling tabs.
i tried alter code bit, no effect. magento installation slow, driving me mad...
any ideas?
thanks in advance...
i suggest override core files in local module rather changing core file directly. here example how override mage_adminhtml_catalog_product_edit_tabs.php
create module example mynamespace_modulename inside app/code/local/
to register module create app/etc/modules/mynamespace_modulename.xml
<?xml version="1.0"?> <config> <modules> <mynamespace_modulename> <codepool>local</codepool> <active>true</active> </mynamespace_modulename> </modules> </config> mynamespace/modulename/etc/config.xml
<?xml version="1.0" encoding="utf-8"?> <config> <modules> <mynamespace_modulename> <version>0.1.0</version> </mynamespace_modulename> </modules> <global> <blocks> <adminhtml> <rewrite> <cataolg_product_edit_tabs>mynamespace_modulename_block_adminhtml_catalog_product_edit_tabs</cataolg_product_edit_tabs> </rewrite> </adminhtml> </blocks> </global> </config> mynamespace/modulename/block/adminhtml/catalog/product/edit/tabs.php
class mynamespace_modulename_block_adminhtml_catalog_product_edit_tabs extends mage_adminhtml_block_catalog_product_edit_tabs { protected $_attributetabblock = 'adminhtml/catalog_product_edit_tab_attributes'; public function __construct() { parent::__construct(); $this->setid('product_info_tabs'); $this->setdestelementid('product_edit_form'); $this->settitle(mage::helper('catalog')->__('product information')); } protected function _preparelayout() { $product = $this->getproduct(); if (!($setid = $product->getattributesetid())) { $setid = $this->getrequest()->getparam('set', null); } if ($setid) { $groupcollection = mage::getresourcemodel('eav/entity_attribute_group_collection') ->setattributesetfilter($setid) ->setsortorder() ->load(); foreach ($groupcollection $group) { $attributes = $product->getattributes($group->getid(), true); // not add groups without attributes foreach ($attributes $key => $attribute) { if( !$attribute->getisvisible() ) { unset($attributes[$key]); } } if (count($attributes)==0) { continue; } $this->addtab('group_'.$group->getid(), array( 'label' => mage::helper('catalog')->__($group->getattributegroupname()), 'content' => $this->_translatehtml($this->getlayout()->createblock($this->getattributetabblock(), 'adminhtml.catalog.product.edit.tab.attributes')->setgroup($group) ->setgroupattributes($attributes) ->tohtml()), )); } if (mage::helper('core')->ismoduleenabled('mage_cataloginventory')) { $this->addtab('inventory', array( 'label' => mage::helper('catalog')->__('inventory'), 'content' => $this->_translatehtml($this->getlayout() ->createblock('adminhtml/catalog_product_edit_tab_inventory')->tohtml()), )); } /** * don't display website tab single mode */ if (!mage::app()->issinglestoremode()) { $this->addtab('websites', array( 'label' => mage::helper('catalog')->__('websites'), 'content' => $this->_translatehtml($this->getlayout() ->createblock('adminhtml/catalog_product_edit_tab_websites')->tohtml()), )); } $this->addtab('categories', array( 'label' => mage::helper('catalog')->__('categories'), 'url' => $this->geturl('*/*/categories', array('_current' => true)), 'class' => 'ajax', )); $this->addtab('related', array( 'label' => mage::helper('catalog')->__('related products'), 'url' => $this->geturl('*/*/related', array('_current' => true)), 'class' => 'ajax', )); $this->addtab('upsell', array( 'label' => mage::helper('catalog')->__('up-sells'), 'url' => $this->geturl('*/*/upsell', array('_current' => true)), 'class' => 'ajax', )); $this->addtab('crosssell', array( 'label' => mage::helper('catalog')->__('cross-sells'), 'url' => $this->geturl('*/*/crosssell', array('_current' => true)), 'class' => 'ajax', )); $storeid = 0; if ($this->getrequest()->getparam('store')) { $storeid = mage::app()->getstore($this->getrequest()->getparam('store'))->getid(); } $alertpriceallow = mage::getstoreconfig('catalog/productalert/allow_price'); $alertstockallow = mage::getstoreconfig('catalog/productalert/allow_stock'); if (($alertpriceallow || $alertstockallow) && !$product->isgrouped()) { $this->addtab('productalert', array( 'label' => mage::helper('catalog')->__('product alerts'), 'content' => $this->_translatehtml($this->getlayout() ->createblock('adminhtml/catalog_product_edit_tab_alerts', 'admin.alerts.products')->tohtml()) )); } if( $this->getrequest()->getparam('id', false) ) { if (mage::helper('catalog')->ismoduleenabled('mage_review')) { if (mage::getsingleton('admin/session')->isallowed('admin/catalog/reviews_ratings')){ $this->addtab('reviews', array( 'label' => mage::helper('catalog')->__('product reviews'), 'url' => $this->geturl('*/*/reviews', array('_current' => true)), 'class' => 'ajax', )); } } if (mage::helper('catalog')->ismoduleenabled('mage_tag')) { if (mage::getsingleton('admin/session')->isallowed('admin/catalog/tag')){ $this->addtab('tags', array( 'label' => mage::helper('catalog')->__('product tags'), 'url' => $this->geturl('*/*/taggrid', array('_current' => true)), 'class' => 'ajax', )); $this->addtab('customers_tags', array( 'label' => mage::helper('catalog')->__('customers tagged product'), 'url' => $this->geturl('*/*/tagcustomergrid', array('_current' => true)), 'class' => 'ajax', )); } } } /** * not change tab id * @see mage_adminhtml_block_catalog_product_edit_tabs_configurable * @see mage_bundle_block_adminhtml_catalog_product_edit_tabs */ if (!$product->isgrouped()) { $this->addtab('customer_options', array( 'label' => mage::helper('catalog')->__('custom options'), 'url' => $this->geturl('*/*/options', array('_current' => true)), 'class' => 'ajax', )); } } else { $this->addtab('set', array( 'label' => mage::helper('catalog')->__('settings'), 'content' => $this->_translatehtml($this->getlayout() ->createblock('adminhtml/catalog_product_edit_tab_settings')->tohtml()), 'active' => true )); } return parent::_preparelayout(); } } you can add new tabs inside _preparelayout() function. in same manner can override other files , can change whatever want change.
proper reflection of changes, make sure have clean cache.
Comments
Post a Comment