Public Member Functions | |
__construct () | |
getProduct () | |
render (Varien_Data_Form_Element_Abstract $element) | |
setElement (Varien_Data_Form_Element_Abstract $element) | |
getElement () | |
getValues () | |
getCustomerGroups ($groupId=null) | |
getWebsiteCount () | |
isMultiWebsites () | |
getWebsites () | |
getDefaultCustomerGroup () | |
getAddButtonHtml () | |
getPriceColumnHeader ($default) | |
Protected Member Functions | |
_sortTierPrices ($a, $b) | |
_prepareLayout () | |
Protected Attributes | |
$_element = null | |
$_customerGroups = null | |
$_websites = null |
Definition at line 34 of file Tier.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 41 of file Tier.php.
_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 164 of file Tier.php.
00165 { 00166 $this->setChild('add_button', 00167 $this->getLayout()->createBlock('adminhtml/widget_button') 00168 ->setData(array( 00169 'label' => Mage::helper('catalog')->__('Add Tier'), 00170 'onclick' => 'tierPriceControl.addItem()', 00171 'class' => 'add' 00172 ))); 00173 return parent::_prepareLayout(); 00174 }
_sortTierPrices | ( | $ | a, | |
$ | b | |||
) | [protected] |
Definition at line 80 of file Tier.php.
00081 { 00082 if ($a['website_id']!=$b['website_id']) { 00083 return $a['website_id']<$b['website_id'] ? -1 : 1; 00084 } 00085 if ($a['cust_group']!=$b['cust_group']) { 00086 return $this->getCustomerGroups($a['cust_group'])<$this->getCustomerGroups($b['cust_group']) ? -1 : 1; 00087 } 00088 if ($a['price_qty']!=$b['price_qty']) { 00089 return $a['price_qty']<$b['price_qty'] ? -1 : 1; 00090 } 00091 return 0; 00092 }
getAddButtonHtml | ( | ) |
Definition at line 176 of file Tier.php.
00177 { 00178 return $this->getChildHtml('add_button'); 00179 }
getCustomerGroups | ( | $ | groupId = null |
) |
Definition at line 94 of file Tier.php.
00095 { 00096 if (!$this->_customerGroups) { 00097 $collection = Mage::getModel('customer/group')->getCollection() 00098 ->load(); 00099 $this->_customerGroups = array( 00100 Mage_Customer_Model_Group::CUST_GROUP_ALL => Mage::helper('catalog')->__('ALL GROUPS'), 00101 ); 00102 foreach ($collection->getIterator() as $item) { 00103 $this->_customerGroups[$item->getId()] = $item->getCustomerGroupCode(); 00104 } 00105 } 00106 return is_null($groupId) ? $this->_customerGroups : 00107 (isset($this->_customerGroups[$groupId]) ? $this->_customerGroups[$groupId] : null); 00108 }
getDefaultCustomerGroup | ( | ) |
Definition at line 159 of file Tier.php.
00160 { 00161 return Mage_Customer_Model_Group::CUST_GROUP_ALL; 00162 }
getElement | ( | ) |
getPriceColumnHeader | ( | $ | default | ) |
Returns customized price column header that was seted through set...
string | $default |
Definition at line 188 of file Tier.php.
00189 { 00190 if ($this->hasData('price_column_header')) { 00191 return $this->getData('price_column_header'); 00192 } else { 00193 return $default; 00194 } 00195 }
getProduct | ( | ) |
getValues | ( | ) |
getWebsiteCount | ( | ) |
getWebsites | ( | ) |
Definition at line 120 of file Tier.php.
00121 { 00122 if (!is_null($this->_websites)) { 00123 return $this->_websites; 00124 } 00125 $websites = array(); 00126 $websites[0] = array( 00127 'name' => $this->__('All Websites'), 00128 'currency' => Mage::app()->getBaseCurrencyCode() 00129 ); 00130 if (Mage::app()->isSingleStoreMode() || $this->getElement()->getEntityAttribute()->isScopeGlobal()) { 00131 return $websites; 00132 } 00133 elseif ($storeId = $this->getProduct()->getStoreId()) { 00134 $website = Mage::app()->getStore($storeId)->getWebsite(); 00135 $websites[$website->getId()] = array( 00136 'name' => $website->getName(), 00137 'currency' => $website->getConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE), 00138 ); 00139 } 00140 else { 00141 $websites[0] = array( 00142 'name' => $this->__('All Websites'), 00143 'currency' => Mage::app()->getBaseCurrencyCode() 00144 ); 00145 foreach (Mage::app()->getWebsites() as $website) { 00146 if (!in_array($website->getId(), $this->getProduct()->getWebsiteIds())) { 00147 continue; 00148 } 00149 $websites[$website->getId()] = array( 00150 'name' => $website->getName(), 00151 'currency' => $website->getConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE), 00152 ); 00153 } 00154 } 00155 $this->_websites = $websites; 00156 return $this->_websites; 00157 }
isMultiWebsites | ( | ) |
render | ( | Varien_Data_Form_Element_Abstract $ | element | ) |
Implements Varien_Data_Form_Element_Renderer_Interface.
Definition at line 51 of file Tier.php.
00052 { 00053 $this->setElement($element); 00054 return $this->toHtml(); 00055 }
setElement | ( | Varien_Data_Form_Element_Abstract $ | element | ) |