public function getTemplate() { $template = parent::getTemplate(); if (!$template) { $template = 'tm/testimonials/widget/list.phtml'; } return $template; }
public function getTemplate() { if (!Mage::helper('magenotification')->checkLicenseKey('Customerreward')) { return null; } else { return parent::getTemplate(); } }
public function testSetMethodFormTemplate() { $childBlockA = new Mage_Core_Block_Template(); $childBlockB = new Mage_Core_Block_Template(); $func = function ($blockName) use($childBlockA, $childBlockB) { switch ($blockName) { case 'payment.method.a': return $childBlockA; case 'payment.method.b': return $childBlockB; } return null; }; $block = $this->getMock('Mage_Payment_Block_Form_Container', array('getChildBlock')); $block->expects($this->atLeastOnce())->method('getChildBlock')->will($this->returnCallback($func)); $template = 'any_template.phtml'; $this->assertNotEquals($template, $childBlockA->getTemplate()); $this->assertNotEquals($template, $childBlockB->getTemplate()); $block->setMethodFormTemplate('a', $template); $this->assertEquals($template, $childBlockA->getTemplate()); // Template is set to the block $this->assertNotEquals($template, $childBlockB->getTemplate()); // Template is not propagated to other blocks }
/** * Get relevant path to template * * @return string */ public function getTemplate() { if (!Mage::getStoreConfig('easycatalogimg/general/enabled')) { return ''; } $category = $this->getCurrentCategory(); if ($category && $category->getLevel() > 1) { $isAnchor = $category->getIsAnchor(); $enabledForAnchor = Mage::getStoreConfigFlag('easycatalogimg/category/enabled_for_anchor'); $enabledForDefault = Mage::getStoreConfigFlag('easycatalogimg/category/enabled_for_default'); if ($isAnchor && !$enabledForAnchor || !$isAnchor && !$enabledForDefault) { return ''; } } $template = parent::getTemplate(); if (!$template) { $template = $this->_getData('template'); } return $template; }
/** * Get relevant path to template * * @return string */ public function getTemplate() { if (!Mage::getStoreConfig('easycatalogimg/general/enabled')) { return ''; } /** * don't show the block: * if pagination is used * if filter is applied */ $page = (int) $this->getRequest()->getParam('p', 1); if ($this->getHideWhenFilterIsUsed() && ($page > 1 || Mage::getSingleton('catalog/layer')->getState()->getFilters())) { return ''; } $category = $this->getCurrentCategory(); if ($category && $category->getLevel() > 1) { $isAnchor = $category->getIsAnchor(); $enabledForAnchor = $this->getEnabledForAnchor(); $enabledForDefault = $this->getEnabledForDefault(); if ($isAnchor && !$enabledForAnchor || !$isAnchor && !$enabledForDefault) { return ''; } } $template = parent::getTemplate(); if (!$template) { $template = $this->_getData('template'); } return $template; }
public function testSetGetTemplate() { $this->assertEmpty($this->_block->getTemplate()); $this->_block->setTemplate('value'); $this->assertEquals('value', $this->_block->getTemplate()); }