Mage_Adminhtml_Block_Catalog_Product_Created Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Catalog_Product_Created:

Mage_Adminhtml_Block_Widget Mage_Adminhtml_Block_Template Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 __construct ()
 getCloseButtonHtml ()
 getProductId ()
 isEdit ()
 getAttributesJson ()
 getAttributes ()
 getConfigurableProduct ()
 getProduct ()

Protected Member Functions

 _prepareLayout ()

Protected Attributes

 $_configurableProduct
 $_product


Detailed Description

Definition at line 34 of file Created.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 39 of file Created.php.

00040     {
00041         parent::__construct();
00042         $this->setTemplate('catalog/product/created.phtml');
00043     }


Member Function Documentation

_prepareLayout (  )  [protected]

Preparing global layout

You can redefine this method in child classes for changin layout

Returns:
Mage_Core_Block_Abstract

Reimplemented from Mage_Core_Block_Abstract.

Definition at line 46 of file Created.php.

00047     {
00048         $this->setChild(
00049             'close_button',
00050             $this->getLayout()->createBlock('adminhtml/widget_button')
00051                 ->setData(array(
00052                     'label'   => Mage::helper('catalog')->__('Close Window'),
00053                     'onclick' => 'addProduct(true)'
00054                 ))
00055         );
00056     }

getAttributes (  ) 

Definition at line 100 of file Created.php.

00101     {
00102         if ($this->getConfigurableProduct()->getId()) {
00103             return $this->getConfigurableProduct()->getTypeInstance(true)->getUsedProductAttributes($this->getConfigurableProduct());
00104         }
00105 
00106         $attributes = array();
00107 
00108         $attributesIds = $this->getRequest()->getParam('required');
00109         if ($attributesIds) {
00110             $attributesIds = explode(',', $attributesIds);
00111             foreach ($attributesIds as $attributeId) {
00112                 $attribute = $this->getProduct()->getTypeInstance(true)->getAttributeById($attributeId, $this->getProduct());
00113                 if (!$attribute) {
00114                     continue;
00115                 }
00116                 $attributes[] = $attribute;
00117             }
00118         }
00119 
00120         return $attributes;
00121     }

getAttributesJson (  ) 

Retrive serialized json with configurable attributes values of simple

Returns:
string

Definition at line 84 of file Created.php.

00085     {
00086         $result = array();
00087         foreach ($this->getAttributes() as $attribute) {
00088             $value = $this->getProduct()->getAttributeText($attribute->getAttributeCode());
00089 
00090             $result[] = array(
00091                 'label'         => $value,
00092                 'value_index'   => $this->getProduct()->getData($attribute->getAttributeCode()),
00093                 'attribute_id'  => $attribute->getId()
00094             );
00095         }
00096 
00097         return Zend_Json::encode($result);
00098     }

getCloseButtonHtml (  ) 

Definition at line 59 of file Created.php.

00060     {
00061         return $this->getChildHtml('close_button');
00062     }

getConfigurableProduct (  ) 

Retrive configurable product for created/edited simple

Returns:
Mage_Catalog_Model_Product

Definition at line 128 of file Created.php.

00129     {
00130         if (is_null($this->_configurableProduct)) {
00131             $this->_configurableProduct = Mage::getModel('catalog/product')
00132                 ->setStore(0)
00133                 ->load($this->getRequest()->getParam('product'));
00134         }
00135         return $this->_configurableProduct;
00136     }

getProduct (  ) 

Retrive product

Returns:
Mage_Catalog_Model_Product

Definition at line 143 of file Created.php.

00144     {
00145         if (is_null($this->_product)) {
00146             $this->_product = Mage::getModel('catalog/product')
00147                 ->setStore(0)
00148                 ->load($this->getRequest()->getParam('id'));
00149         }
00150         return $this->_product;
00151     }

getProductId (  ) 

Definition at line 64 of file Created.php.

00065     {
00066         return (int) $this->getRequest()->getParam('id');
00067     }

isEdit (  ) 

Indentifies edit mode of popup

Returns:
boolean

Definition at line 74 of file Created.php.

00075     {
00076         return (bool) $this->getRequest()->getParam('edit');
00077     }


Member Data Documentation

$_configurableProduct [protected]

Definition at line 36 of file Created.php.

$_product [protected]

Definition at line 37 of file Created.php.


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

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