Ejemplo n.º 1
0
 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());
 }
Ejemplo n.º 2
0
 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;
 }