public function testAddRemoveLink() { $block = new Mage_Customer_Block_Account_Navigation(); $this->assertSame(array(), $block->getLinks()); $this->assertSame($block, $block->addLink('Name', 'some/path/index', 'Label', array('parameter' => 'value'))); $links = $block->getLinks(); $this->assertArrayHasKey('Name', $links); $this->assertInstanceOf('Varien_Object', $links['Name']); $this->assertSame(array('name' => 'Name', 'path' => 'some/path/index', 'label' => 'Label', 'url' => 'http://localhost/index.php/some/path/index/parameter/value/'), $links['Name']->getData()); $block->removeLink('nonexistent'); $this->assertSame($links, $block->getLinks()); $block->removeLink('Name'); $this->assertSame(array(), $block->getLinks()); }
public function isActive($link) { if (parent::isActive($link)) { return true; } return false; }
public function addLink($name, $path, $label, $urlParams = array()) { if (in_array($name, $this->_deprecated)) { return; } parent::addLink($name, $path, $label, $urlParams); }
public function isActive($link) { if (parent::isActive($link)) { return true; } if (in_array($this->_activeLink, array('affiliatepluslevel/index/listTierTransaction', 'affiliatepluspayperlead/index/listleadcommission')) && $this->_completePath($link->getPath()) == 'affiliateplus/index/listTransaction') { return true; } return false; }
/** * 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; }
public function getLinks() { $links = parent::getLinks(); $customerId = Mage::getSingleton('customer/session')->getCustomer()->getId(); $user = Mage::getSingleton('core/session')->getData('usermanagement_user'); if (!$user) { $user = Mage::getModel('usermanagement/user')->load($customerId, 'customer_id'); Mage::getSingleton('core/session')->setData('usermanagement_user', $user); } $website = $user->getWebsite(); if ($website->isTrial()) { $path = 'usermanagement/configuration/purchase'; $links['purchase'] = new Varien_Object(array('name' => $this->__('purchase'), 'path' => $path, 'label' => $this->__('Purchase'), 'url' => $this->getUrl($path))); unset($links['orders']); unset($links['recurring_profiles']); } //print_r($links); return $links; }
public function addLink($name, $path, $label, $urlParams = array()) { $isAddLink = true; if ('aitloyalty' == $name) { $iStoreId = Mage::app()->getStore()->getId(); $iSiteId = Mage::app()->getWebsite()->getId(); /* */ $performer = Aitoc_Aitsys_Abstract_Service::get()->platform()->getModule('Aitoc_Aitloyalty')->getLicense()->getPerformer(); $ruler = $performer->getRuler(); if (!($ruler->checkRule('store', $iStoreId, 'store') || $ruler->checkRule('store', $iSiteId, 'website'))) { $isAddLink = false; } /* */ } if ($isAddLink) { parent::addLink($name, $path, $label, $urlParams); } return $this; }
protected function _prepareLayout() { if (Mage::getSingleton('customer/session')->isLoggedIn()) { $customer = Mage::getSingleton('customer/session')->getCustomer(); if ($customer->getCustomerType() != 'vendor') { // $this->addLink('become_to_vendor', 'vendor/account/create', $this->__('Become To Vendor')); //$block = $this->getLayout()->createBlock('cms/block')->setBlockId('vendor_signup'); //$this->getLayout()->getBlock('left')->append($block,'vendor_signup'); } else { /* if($customer->getVendorStatus() == 1){ $user = Mage::getModel('admin/user')->load($customer->getUserId()); $this->addLink('login_admin_panel', 'adminhtml/index/index', $this->__('Login Admin'),array('auto_login'=>1,'hash_key'=>Mage::helper('planet')->getHashKey($user->getPassword()),'user_id'=>$customer->getUserId())); } else{ $this->addLink('login_admin_panel', 'vendor-message', $this->__('Login Admin')); } */ } } return parent::_prepareLayout(); }
/** * Set the original module name avoid breaking translations */ public function __construct() { parent::__construct(); $this->setModuleName('Mage_Customer'); }
/** * @return mixed */ protected function _toHtml() { $this->removeLink(); return parent::_toHtml(); }