Mage_Adminhtml_Block_Catalog_Product_Edit_Tabs Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Catalog_Product_Edit_Tabs:

Mage_Adminhtml_Block_Widget_Tabs Mage_Adminhtml_Block_Widget Mage_Adminhtml_Block_Template Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object Mage_Adminhtml_Block_Catalog_Product_Edit_Tabs_Configurable Mage_Adminhtml_Block_Catalog_Product_Edit_Tabs_Grouped Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tabs

List of all members.

Public Member Functions

 __construct ()
 getProduct ()
 getAttributeTabBlock ()
 setAttributeTabBlock ($attributeTabBlock)

Protected Member Functions

 _prepareLayout ()

Protected Attributes

 $_attributeTabBlock = 'adminhtml/catalog_product_edit_tab_attributes'


Detailed Description

Definition at line 34 of file Tabs.php.


Constructor & Destructor Documentation

__construct (  ) 

Constructor

By default is looking for first argument as array and assignes it as object attributes This behaviour may change in child classes

Reimplemented from Varien_Object.

Definition at line 38 of file Tabs.php.

00039     {
00040         parent::__construct();
00041         $this->setId('product_info_tabs');
00042         $this->setDestElementId('product_edit_form');
00043         $this->setTitle(Mage::helper('catalog')->__('Product Information'));
00044     }


Member Function Documentation

_prepareLayout (  )  [protected]

Preparing global layout

You can redefine this method in child classes for changin layout

Returns:
Mage_Core_Block_Abstract

Don't display website tab for single mode

Do not change this tab id

See also:
Mage_Adminhtml_Block_Catalog_Product_Edit_Tabs_Configurable

Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tabs

Reimplemented from Mage_Core_Block_Abstract.

Reimplemented in Mage_Adminhtml_Block_Catalog_Product_Edit_Tabs_Configurable, Mage_Adminhtml_Block_Catalog_Product_Edit_Tabs_Grouped, and Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tabs.

Definition at line 46 of file Tabs.php.

00047     {
00048         $product = $this->getProduct();
00049 
00050         if (!($setId = $product->getAttributeSetId())) {
00051             $setId = $this->getRequest()->getParam('set', null);
00052         }
00053 
00054         if ($setId) {
00055             $groupCollection = Mage::getResourceModel('eav/entity_attribute_group_collection')
00056                 ->setAttributeSetFilter($setId)
00057                 ->load();
00058 
00059             foreach ($groupCollection as $group) {
00060                 $attributes = $product->getAttributes($group->getId(), true);
00061                 // do not add grops without attributes
00062 
00063                 foreach ($attributes as $key => $attribute) {
00064                     if( !$attribute->getIsVisible() ) {
00065                         unset($attributes[$key]);
00066                     }
00067                 }
00068 
00069                 if (count($attributes)==0) {
00070                     continue;
00071                 }
00072 
00073                 $this->addTab('group_'.$group->getId(), array(
00074                     'label'     => Mage::helper('catalog')->__($group->getAttributeGroupName()),
00075                     'content'   => $this->getLayout()->createBlock($this->getAttributeTabBlock())
00076                         ->setGroup($group)
00077                         ->setGroupAttributes($attributes)
00078                         ->toHtml(),
00079                 ));
00080             }
00081 
00082             $this->addTab('inventory', array(
00083                 'label'     => Mage::helper('catalog')->__('Inventory'),
00084                 'content'   => $this->getLayout()->createBlock('adminhtml/catalog_product_edit_tab_inventory')->toHtml(),
00085             ));
00086 
00087 
00088             /**
00089              * Don't display website tab for single mode
00090              */
00091             if (!Mage::app()->isSingleStoreMode()) {
00092                 $this->addTab('websites', array(
00093                     'label'     => Mage::helper('catalog')->__('Websites'),
00094                     'content'   => $this->getLayout()->createBlock('adminhtml/catalog_product_edit_tab_websites')->toHtml(),
00095                 ));
00096             }
00097 
00098             $this->addTab('categories', array(
00099                 'label'     => Mage::helper('catalog')->__('Categories'),
00100                 'url'       => $this->getUrl('*/*/categories', array('_current' => true)),
00101                 'class'     => 'ajax',
00102             ));
00103 
00104             $this->addTab('related', array(
00105                 'label'     => Mage::helper('catalog')->__('Related Products'),
00106                 'url'       => $this->getUrl('*/*/related', array('_current' => true)),
00107                 'class'     => 'ajax',
00108             ));
00109 
00110             $this->addTab('upsell', array(
00111                 'label'     => Mage::helper('catalog')->__('Up-sells'),
00112                 'url'       => $this->getUrl('*/*/upsell', array('_current' => true)),
00113                 'class'     => 'ajax',
00114             ));
00115 
00116             $this->addTab('crosssell', array(
00117                 'label'     => Mage::helper('catalog')->__('Cross-sells'),
00118                 'url'       => $this->getUrl('*/*/crosssell', array('_current' => true)),
00119                 'class'     => 'ajax',
00120             ));
00121 
00122             $storeId = 0;
00123             if ($this->getRequest()->getParam('store')) {
00124                 $storeId = Mage::app()->getStore($this->getRequest()->getParam('store'))->getId();
00125             }
00126 
00127             $alertPriceAllow = Mage::getStoreConfig('catalog/productalert/allow_price');
00128             $alertStockAllow = Mage::getStoreConfig('catalog/productalert/allow_stock');
00129 
00130             if ($alertPriceAllow || $alertStockAllow) {
00131                 $this->addTab('productalert', array(
00132                     'label'     => Mage::helper('catalog')->__('Product Alerts'),
00133                     'content'   => $this->getLayout()->createBlock('adminhtml/catalog_product_edit_tab_alerts', 'admin.alerts.products')->toHtml()
00134                 ));
00135             }
00136 
00137             if( $this->getRequest()->getParam('id', false) ) {
00138                 $this->addTab('reviews', array(
00139                     'label' => Mage::helper('catalog')->__('Product Reviews'),
00140                     'url'   => $this->getUrl('*/*/reviews', array('_current' => true)),
00141                     'class' => 'ajax',
00142                 ));
00143 
00144                 $this->addTab('tags', array(
00145                     'label'     => Mage::helper('catalog')->__('Product Tags'),
00146                     'url'   => $this->getUrl('*/*/tagGrid', array('_current' => true)),
00147                     'class' => 'ajax',
00148                 ));
00149 
00150                 $this->addTab('customers_tags', array(
00151                     'label'     => Mage::helper('catalog')->__('Customers Tagged Product'),
00152                     'url'   => $this->getUrl('*/*/tagCustomerGrid', array('_current' => true)),
00153                     'class' => 'ajax',
00154                 ));
00155             }
00156 
00157             /**
00158              * Do not change this tab id
00159              * @see Mage_Adminhtml_Block_Catalog_Product_Edit_Tabs_Configurable
00160              * @see Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tabs
00161              */
00162             if ($this->getProduct()->getTypeId() != Mage_Catalog_Model_Product_Type::TYPE_GROUPED) {
00163                 $this->addTab('customer_options', array(
00164                     'label' => Mage::helper('catalog')->__('Custom Options'),
00165                     'url'   => $this->getUrl('*/*/options', array('_current' => true)),
00166                     'class' => 'ajax',
00167                 ));
00168             }
00169 
00170         }
00171         else {
00172             $this->addTab('set', array(
00173                 'label'     => Mage::helper('catalog')->__('Settings'),
00174                 'content'   => $this->getLayout()->createBlock('adminhtml/catalog_product_edit_tab_settings')->toHtml(),
00175                 'active'    => true
00176             ));
00177         }
00178         return parent::_prepareLayout();
00179     }

getAttributeTabBlock (  ) 

Getting attribute block name for tabs

Returns:
string

Definition at line 199 of file Tabs.php.

00200     {
00201         if (is_null(Mage::helper('adminhtml/catalog')->getAttributeTabBlock())) {
00202             return $this->_attributeTabBlock;
00203         }
00204         return Mage::helper('adminhtml/catalog')->getAttributeTabBlock();
00205     }

getProduct (  ) 

Retrive product object from object if not from registry

Returns:
Mage_Catalog_Model_Product

Definition at line 186 of file Tabs.php.

00187     {
00188         if (!($this->getData('product') instanceof Mage_Catalog_Model_Product)) {
00189             $this->setData('product', Mage::registry('product'));
00190         }
00191         return $this->getData('product');
00192     }

setAttributeTabBlock ( attributeTabBlock  ) 

Definition at line 207 of file Tabs.php.

00208     {
00209         $this->_attributeTabBlock = $attributeTabBlock;
00210         return $this;
00211     }


Member Data Documentation

$_attributeTabBlock = 'adminhtml/catalog_product_edit_tab_attributes' [protected]

Reimplemented in Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tabs.

Definition at line 36 of file Tabs.php.


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:22:46 2009 for Magento by  doxygen 1.5.8