Public Member Functions | |
__construct () | |
getFieldId () | |
getFieldName () | |
getGbaseAttributesSelectHtml () | |
getAttributesSelectHtml ($escapeJsQuotes=false) | |
getAddButtonHtml () | |
getDeleteButtonHtml () | |
_getAttributes ($setId, $escapeJsQuotes=false) | |
Protected Member Functions | |
_prepareLayout () | |
_toJson ($data) |
Definition at line 34 of file Attributes.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 36 of file Attributes.php.
_getAttributes | ( | $ | setId, | |
$ | escapeJsQuotes = false | |||
) |
Get attributes of an attribute set Skip attributes not needed for Google Base
int | $setId | |
boolean | $escapeJsQuotes |
Definition at line 124 of file Attributes.php.
00125 { 00126 $attributes = Mage::getModel('googlebase/attribute')->getAllowedAttributes($setId); 00127 $result = array(); 00128 00129 foreach ($attributes as $attribute) { 00130 /* @var $attribute Mage_Catalog_Model_Resource_Eav_Attribute */ 00131 $result[$attribute->getAttributeId()] = $escapeJsQuotes ? $this->jsQuoteEscape($attribute->getFrontendLabel()) : $attribute->getFrontendLabel(); 00132 } 00133 return $result; 00134 }
_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 41 of file Attributes.php.
00042 { 00043 $this->setChild('add_button', 00044 $this->getLayout()->createBlock('adminhtml/widget_button') 00045 ->setData(array( 00046 'label' => Mage::helper('googlebase')->__('Add New Attribute'), 00047 'class' => 'add', 00048 'id' => 'add_new_attribute', 00049 'on_click' => 'gBaseAttribute.add()' 00050 )) 00051 ); 00052 $this->setChild('delete_button', 00053 $this->getLayout()->createBlock('adminhtml/widget_button') 00054 ->setData(array( 00055 'label' => Mage::helper('googlebase')->__('Remove'), 00056 'class' => 'delete delete-product-option', 00057 'on_click' => 'gBaseAttribute.remove(event)' 00058 )) 00059 ); 00060 00061 parent::_prepareLayout(); 00062 }
_toJson | ( | $ | data | ) | [protected] |
Definition at line 136 of file Attributes.php.
00137 { 00138 return Zend_Json::encode($data); 00139 }
getAddButtonHtml | ( | ) |
Definition at line 106 of file Attributes.php.
00107 { 00108 return $this->getChildHtml('add_button'); 00109 }
getAttributesSelectHtml | ( | $ | escapeJsQuotes = false |
) |
Build HTML select element of attribute set attributes
boolean | $escapeJsQuotes |
Definition at line 97 of file Attributes.php.
00098 { 00099 $select = $this->getLayout()->createBlock('adminhtml/html_select') 00100 ->setId($this->getFieldId().'_{{index}}_attribute') 00101 ->setName($this->getFieldName().'[{{index}}][attribute_id]') 00102 ->setOptions($this->_getAttributes($this->getAttributeSetId(), $escapeJsQuotes)); 00103 return $select->getHtml(); 00104 }
getDeleteButtonHtml | ( | ) |
Definition at line 111 of file Attributes.php.
00112 { 00113 return $this->getChildHtml('delete_button'); 00114 }
getFieldId | ( | ) |
getFieldName | ( | ) |
getGbaseAttributesSelectHtml | ( | ) |
Definition at line 74 of file Attributes.php.
00075 { 00076 $options = array('' => $this->__('Custom attribute, no mapping')); 00077 00078 $attributes = Mage::getModel('googlebase/service_feed') 00079 ->getAttributes($this->getGbaseItemtype(), $this->getTargetCountry()); 00080 foreach ($attributes as $attr) { 00081 $options[$attr->getId()] = $attr->getName(); 00082 } 00083 00084 $select = $this->getLayout()->createBlock('adminhtml/html_select') 00085 ->setId($this->getFieldId().'_{{index}}_gattribute') 00086 ->setName($this->getFieldName().'[{{index}}][gbase_attribute]') 00087 ->setOptions($options); 00088 return $select->getHtml(); 00089 }