/** * @param Mage_Catalog_Model_Product $product * @return string */ public function getAddUrl($product) { if (Praxigento_TuneUp_Config::cfgFrontendProductComparisonDisabled()) { return null; } else { return parent::getAddUrl($product); } }
/** * Remove disabled account navigation links before HTML generation. * @return $this|Mage_Core_Block_Abstract */ protected function _beforeToHtml() { parent::_beforeToHtml(); $disabled = Praxigento_TuneUp_Config::cfgFrontendNavigationLinksDisabled(); foreach ($this->_links as $key => $one) { if (in_array($key, $disabled)) { unset($this->_links[$key]); } } return $this; }
/** * Load frontend layout and extract navigation links. * @return array|null */ public function toOptionArray() { if (is_null($this->_cached)) { /** @var $updateFront Mage_Core_Model_Layout_Update */ $updateFront = Mage::getModel('core/layout')->getUpdate(); $layoutFront = $updateFront->getFileLayoutUpdatesXml(Mage_Core_Model_Design_Package::DEFAULT_AREA, Mage_Core_Model_Design_Package::DEFAULT_PACKAGE, Mage_Core_Model_Design_Package::DEFAULT_THEME); $links = $layoutFront->xpath("//reference[@name='customer_account_navigation']/action[@method='addLink']"); if (is_array($links)) { /** @var $one Mage_Core_Model_Layout_Element */ foreach ($links as $one) { $linkLabel = (string) $one->label; $linkName = (string) $one->name; $this->_cached[$linkLabel] = array('label' => $linkLabel, 'value' => $linkName); } } /** add extra entry to enable all links */ $allEnabled['label'] = Praxigento_TuneUp_Config::helper()->__('-- All Enabled --'); $allEnabled['value'] = '-1'; $this->_cached[] = $allEnabled; /** sort links by label */ asort($this->_cached); } return $this->_cached; }