Public Member Functions | |
__construct () | |
getTabClass () | |
isReadonly () | |
getAttributesJson () | |
getLinksJson () | |
getConfigurableSettings ($product) | |
getGridHtml () | |
getGridJsObject () | |
getNewEmptyProductUrl () | |
getNewProductUrl () | |
getQuickCreationUrl () | |
escapeJs ($string) | |
getTabLabel () | |
getTabTitle () | |
canShowTab () | |
isHidden () | |
getShowUseDefaultPrice () | |
Protected Member Functions | |
_prepareLayout () | |
_getProduct () | |
_getRequiredAttributesIds () |
Definition at line 35 of file Config.php.
__construct | ( | ) |
Initialize block
Reimplemented from Varien_Object.
Definition at line 41 of file Config.php.
00042 { 00043 parent::__construct(); 00044 $this->setProductId($this->getRequest()->getParam('id')); 00045 $this->setTemplate('catalog/product/edit/super/config.phtml'); 00046 $this->setId('config_super_product'); 00047 }
_getProduct | ( | ) | [protected] |
Retrieve currently edited product object
Definition at line 112 of file Config.php.
00113 { 00114 return Mage::registry('current_product'); 00115 }
_getRequiredAttributesIds | ( | ) | [protected] |
Retrieve Required attributes Ids (comma separated)
Definition at line 249 of file Config.php.
00250 { 00251 $attributesIds = array(); 00252 foreach ($this->_getProduct()->getTypeInstance(true)->getConfigurableAttributes($this->_getProduct()) as $attribute) { 00253 $attributesIds[] = $attribute->getProductAttribute()->getId(); 00254 } 00255 00256 return implode(',', $attributesIds); 00257 }
_prepareLayout | ( | ) | [protected] |
Prepare Layout data
Reimplemented from Mage_Core_Block_Abstract.
Definition at line 74 of file Config.php.
00075 { 00076 $this->setChild('grid', 00077 $this->getLayout()->createBlock('adminhtml/catalog_product_edit_tab_super_config_grid') 00078 ); 00079 00080 $this->setChild('create_empty', 00081 $this->getLayout()->createBlock('adminhtml/widget_button') 00082 ->setData(array( 00083 'label' => Mage::helper('catalog')->__('Create Empty'), 00084 'class' => 'add', 00085 'onclick' => 'superProduct.createEmptyProduct()' 00086 )) 00087 ); 00088 00089 if ($this->_getProduct()->getId()) { 00090 $this->setChild('simple', 00091 $this->getLayout()->createBlock('adminhtml/catalog_product_edit_tab_super_config_simple') 00092 ); 00093 00094 $this->setChild('create_from_configurable', 00095 $this->getLayout()->createBlock('adminhtml/widget_button') 00096 ->setData(array( 00097 'label' => Mage::helper('catalog')->__('Copy From Configurable'), 00098 'class' => 'add', 00099 'onclick' => 'superProduct.createNewProduct()' 00100 )) 00101 ); 00102 } 00103 00104 return parent::_prepareLayout(); 00105 }
canShowTab | ( | ) |
Can show tab flag
Implements Mage_Adminhtml_Block_Widget_Tab_Interface.
Definition at line 295 of file Config.php.
escapeJs | ( | $ | string | ) |
Escape JavaScript string
string | $string |
Definition at line 265 of file Config.php.
getAttributesJson | ( | ) |
Retrieve attributes data in JSON format
Definition at line 122 of file Config.php.
00123 { 00124 $attributes = $this->_getProduct()->getTypeInstance(true) 00125 ->getConfigurableAttributesAsArray($this->_getProduct()); 00126 if(!$attributes) { 00127 return '[]'; 00128 } 00129 return Zend_Json::encode($attributes); 00130 }
getConfigurableSettings | ( | $ | product | ) |
Retrieve configurable settings
Mage_Catalog_Model_Product | $product |
Definition at line 157 of file Config.php.
00157 { 00158 $data = array(); 00159 $attributes = $this->_getProduct()->getTypeInstance(true) 00160 ->getUsedProductAttributes($this->_getProduct()); 00161 foreach ($attributes as $attribute) { 00162 $data[] = array( 00163 'attribute_id' => $attribute->getId(), 00164 'label' => $product->getAttributeText($attribute->getAttributeCode()), 00165 'value_index' => $product->getData($attribute->getAttributeCode()) 00166 ); 00167 } 00168 00169 return $data; 00170 }
getGridHtml | ( | ) |
Retrieve Grid child HTML
Definition at line 177 of file Config.php.
00178 { 00179 return $this->getChildHtml('grid'); 00180 }
getGridJsObject | ( | ) |
Retrieve Grid JavaScript object name
Definition at line 187 of file Config.php.
00188 { 00189 return $this->getChild('grid')->getJsObjectName(); 00190 }
getLinksJson | ( | ) |
Retrieve Links in JSON format
Definition at line 137 of file Config.php.
00138 { 00139 $products = $this->_getProduct()->getTypeInstance(true) 00140 ->getUsedProducts(null, $this->_getProduct()); 00141 if(!$products) { 00142 return '{}'; 00143 } 00144 $data = array(); 00145 foreach ($products as $product) { 00146 $data[$product->getId()] = $this->getConfigurableSettings($product); 00147 } 00148 return Zend_Json::encode($data); 00149 }
getNewEmptyProductUrl | ( | ) |
Retrieve Create New Empty Product URL
Definition at line 197 of file Config.php.
00198 { 00199 return $this->getUrl( 00200 '*/*/new', 00201 array( 00202 'set' => $this->_getProduct()->getAttributeSetId(), 00203 'type' => Mage_Catalog_Model_Product_Type::TYPE_SIMPLE, 00204 'required' => $this->_getRequiredAttributesIds(), 00205 'popup' => 1 00206 ) 00207 ); 00208 }
getNewProductUrl | ( | ) |
Retrieve Create New Product URL
Definition at line 215 of file Config.php.
00216 { 00217 return $this->getUrl( 00218 '*/*/new', 00219 array( 00220 'set' => $this->_getProduct()->getAttributeSetId(), 00221 'type' => Mage_Catalog_Model_Product_Type::TYPE_SIMPLE, 00222 'required' => $this->_getRequiredAttributesIds(), 00223 'popup' => 1, 00224 'product' => $this->_getProduct()->getId() 00225 ) 00226 ); 00227 }
getQuickCreationUrl | ( | ) |
Retrieve Quick create product URL
Definition at line 234 of file Config.php.
00235 { 00236 return $this->getUrl( 00237 '*/*/quickCreate', 00238 array( 00239 'product' => $this->_getProduct()->getId() 00240 ) 00241 ); 00242 }
getShowUseDefaultPrice | ( | ) |
Show "Use default price" checkbox
Definition at line 315 of file Config.php.
00316 { 00317 return !Mage::helper('catalog')->isPriceGlobal() 00318 && $this->_getProduct()->getStoreId(); 00319 }
getTabClass | ( | ) |
getTabLabel | ( | ) |
Retrieve Tab label
Implements Mage_Adminhtml_Block_Widget_Tab_Interface.
Definition at line 275 of file Config.php.
00276 { 00277 return Mage::helper('catalog')->__('Associated Products'); 00278 }
getTabTitle | ( | ) |
Retrieve Tab title
Implements Mage_Adminhtml_Block_Widget_Tab_Interface.
Definition at line 285 of file Config.php.
00286 { 00287 return Mage::helper('catalog')->__('Associated Products'); 00288 }
isHidden | ( | ) |
Check is a hidden tab
Implements Mage_Adminhtml_Block_Widget_Tab_Interface.
Definition at line 305 of file Config.php.
isReadonly | ( | ) |
Check block is readonly
Definition at line 64 of file Config.php.
00065 { 00066 return $this->_getProduct()->getCompositeReadonly(); 00067 }