Public Member Functions | |
__construct () | |
getCloseButtonHtml () | |
getProductId () | |
isEdit () | |
getAttributesJson () | |
getAttributes () | |
getConfigurableProduct () | |
getProduct () | |
Protected Member Functions | |
_prepareLayout () | |
Protected Attributes | |
$_configurableProduct | |
$_product |
Definition at line 34 of file Created.php.
__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 }
_prepareLayout | ( | ) | [protected] |
Preparing global layout
You can redefine this method in child classes for changin layout
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
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
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
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
Definition at line 74 of file Created.php.
00075 { 00076 return (bool) $this->getRequest()->getParam('edit'); 00077 }
$_configurableProduct [protected] |
Definition at line 36 of file Created.php.
$_product [protected] |
Definition at line 37 of file Created.php.