protected function _afterToHtml($html) { $html = parent::_afterToHtml($html); $queldorei = false; if (!$html) { // compatibility with "shopper" theme // @see catalog/layer/view.phtml $queldorei_blocks = Mage::registry('queldorei_blocks'); if ($queldorei_blocks and !empty($queldorei_blocks['block_layered_nav'])) { $html = $queldorei_blocks['block_layered_nav']; } if (!$html) { return ''; } $queldorei = true; } $pos = strrpos($html, '</div>'); if ($pos !== false) { //add an overlay before closing tag $html = substr($html, 0, strrpos($html, '</div>')) . '<div style="display:none" class="amshopby-overlay"></div>' . '</div>'; } // to make js and css work for 1.3 also $html = str_replace('class="narrow-by', 'class="block-layered-nav narrow-by', $html); // add selector for ajax $html = str_replace('block-layered-nav', 'block-layered-nav ' . $this->getBlockId(), $html); if (Mage::getStoreConfig('amshopby/general/enable_collapsing')) { $html = str_replace('block-layered-nav', 'block-layered-nav amshopby-collapse-enabled', $html); } $enableOverflowScroll = Mage::getStoreConfig('amshopby/block/enable_overflow_scroll'); if ($enableOverflowScroll) { $html = str_replace('block-layered-nav', 'block-layered-nav amshopby-overflow-scroll-enabled', $html); if (strpos($html, 'block-layered-nav')) { $html = $html . '<style>' . 'div.amshopby-overflow-scroll-enabled div.block-content dl dd > ol:first-of-type { max-height: ' . $enableOverflowScroll . 'px; overflow-y: auto; }' . '</style>'; } } // we don't want to move this into the template are different in custom themes foreach ($this->getFilters() as $f) { $name = $this->__($f->getName()); if ($f->getCollapsed() && !$f->getHasSelection()) { $html = preg_replace('|(<dt[^>]*)(>' . preg_quote($name, '|') . ')|iu', '$1 class="amshopby-collapsed"$2', $html); } $comment = $f->getComment(); if ($comment) { $img = Mage::getDesign()->getSkinUrl('images/amshopby-tooltip.png'); $img = ' <img class="amshopby-tooltip-img" src="' . $img . '" width="9" height="9" alt="' . htmlspecialchars($comment) . '" />'; $pattern = '@(<dt[^>]*>\\s*' . preg_quote($name, '@') . ')\\s*(</dt>)@ui'; $replacement = '$1 ' . $img . '$2'; $html = preg_replace($pattern, $replacement, $html); } } if ($queldorei and !empty($queldorei_blocks['block_layered_nav'])) { // compatibility with "shopper" theme // @see catalog/layer/view.phtml Mage::unregister('queldorei_blocks'); $queldorei_blocks['block_layered_nav'] = $html; Mage::register('queldorei_blocks', $queldorei_blocks); return ''; } return $html; }
protected function _afterToHtml($html) { $html = parent::_afterToHtml($html); $queldorei = false; if (!$html) { // compatibility with "shopper" theme // @see catalog/layer/view.phtml $queldorei_blocks = Mage::registry('queldorei_blocks'); if ($queldorei_blocks and !empty($queldorei_blocks['block_layered_nav'])) { $html = $queldorei_blocks['block_layered_nav']; } if (!$html) { return ''; } $queldorei = true; } $pos = strrpos($html, '</div>'); if ($pos !== false) { //add an overlay before closing tag $html = substr($html, 0, strrpos($html, '</div>')) . '<div style="display:none" class="amshopby-overlay"></div>' . '</div>'; } // to make js and css work for 1.3 also $html = str_replace('class="narrow-by', 'class="block-layered-nav narrow-by', $html); // add selector for ajax $html = str_replace('block-layered-nav', 'block-layered-nav ' . $this->getBlockId(), $html); if (Mage::getStoreConfig('amshopby/general/enable_collapsing')) { $html = str_replace('block-layered-nav', 'block-layered-nav amshopby-collapse-enabled', $html); } // we don't want to move this into the template are different in custom themes foreach ($this->getFilters() as $f) { $name = $this->__($f->getName()); if ($f->getCollapsed() && !$f->getHasSelection()) { $html = str_replace('<dt>' . $name, '<dt class="amshopby-collapsed">' . $name, $html); } $comment = $f->getComment(); if ($comment) { $img = Mage::getDesign()->getSkinUrl('images/amshopby-tooltip.png'); $img = '<img class="amshopby-tooltip-img" src="' . $img . '" width="9" height="9" alt="' . htmlspecialchars($comment) . '" id="amshopby-img-' . $f->getAttributeCode() . '"/>'; $html = str_replace($name . '</dt>', $name . $img . '</dt>', $html); } } if ($queldorei and !empty($queldorei_blocks['block_layered_nav'])) { // compatibility with "shopper" theme // @see catalog/layer/view.phtml Mage::unregister('queldorei_blocks'); $queldorei_blocks['block_layered_nav'] = $html; Mage::register('queldorei_blocks', $queldorei_blocks); return ''; } return $html; }