/** * @test */ public function testGetSectionsAssoc() { if (!is_array(AW_Collpur_Helper_Deals::getSectionsAssoc())) { $this->fail('getSectionsAssoc function is supposed to be an array of values'); } }
public function _modifyCrumbs($layout, $bridge = false, $deal = false, $mode = 'product') { $sections = AW_Collpur_Helper_Deals::getSectionsAssoc(); if ($mode == 'category') { $currentSection = Mage::app()->getRequest()->getParam('section'); $layout->getBlock('breadcrumbs')->addCrumb('home', array('label' => 'Home', 'title' => 'Home', 'link' => Mage::getBaseUrl())); if (array_key_exists($currentSection, $sections)) { $layout->getBlock('breadcrumbs')->addCrumb('category', array('label' => $this->__($sections[$currentSection]), 'title' => $this->__($sections[$currentSection]))); $layout->getBlock('head')->setTitle($this->__($sections[$currentSection])); } return; } $deal = $this->getDealInstance($deal->getId()); if (!$deal->getId()) { return; } $disallowActive = false; if ($deal->isNotRunning()) { $categoryCrumb = AW_Collpur_Helper_Deals::NOT_RUNNING; $categoryLabel = $this->__($sections[AW_Collpur_Helper_Deals::NOT_RUNNING]); } else { if ($deal->isRunning()) { $categoryCrumb = AW_Collpur_Helper_Deals::RUNNING; $categoryLabel = $this->__($sections[AW_Collpur_Helper_Deals::RUNNING]); $data = AW_Collpur_Model_Source_Menus::getMenusArray(false); foreach ($data as $info) { if ($info['key'] == AW_Collpur_Helper_Deals::RUNNING) { if (!Mage::getStoreConfig("collpur/{$info['alias']}/enabled")) { $disallowActive = true; break; } $disallowActive = false; break; } $disallowActive = false; } } else { if ($deal->isClosed()) { $categoryCrumb = AW_Collpur_Helper_Deals::CLOSED; $categoryLabel = $this->__($sections[AW_Collpur_Helper_Deals::CLOSED]); } } } $layout->getBlock('breadcrumbs')->addCrumb('home', array('label' => 'Home', 'title' => 'Home', 'link' => Mage::getBaseUrl())); if (!$disallowActive) { $layout->getBlock('breadcrumbs')->addCrumb('category', array('label' => $categoryLabel, 'title' => $categoryLabel, 'link' => $this->getDealTabUrl($categoryCrumb))); } $layout->getBlock('breadcrumbs')->addCrumb('product', array('label' => $this->processDealName($deal))); }