public function getSearchUrl($obj)
 {
     if (!Mage::helper('magenotification')->checkLicenseKey('Seoplus')) {
         return parent::getSearchUrl($obj);
     }
     $url = Mage::getModel('core/url');
     if ($this->getHelper()->getConfig('enable')) {
         $rewrite = Mage::getModel('core/url_rewrite')->loadByIdPath("seoplus/{$obj->getQueryId()}");
         if ((!$this->getHelper()->getConfig('cache') || !$rewrite->getId()) && $obj->getQueryId()) {
             try {
                 $model = Mage::getModel('catalogsearch/query')->load($obj->getQueryId())->setId($obj->getQueryId())->save();
                 $rewrite->loadByIdPath("seoplus/{$model->getId()}");
             } catch (Exception $e) {
                 $url->setQueryParam('q', $obj->getName());
                 return $url->getUrl('catalogsearch/result');
             }
         }
         if ($rewrite->getTargetPath() != $this->getHelper()->prepareTargetPath($obj->getName())) {
             try {
                 $rewrite->setTargetPath($this->getHelper()->prepareTargetPath($obj->getName()))->save();
             } catch (Exception $e) {
                 $url->setQueryParam('q', $obj->getName());
                 return $url->getUrl('catalogsearch/result');
             }
         }
         return $url->getUrl(null, array('_direct' => $rewrite->getRequestPath()));
     }
     $url->setQueryParam('q', $obj->getName());
     return $url->getUrl('catalogsearch/result');
 }
 /**
  * @return string
  */
 protected function _toHtml()
 {
     if (!Mage::helper('factfinder')->isEnabled('tagcloud')) {
         return '';
     }
     // only show on "no result" page
     $searchResultBlock = $this->getLayout()->getBlock('search.result');
     if (!$searchResultBlock || $searchResultBlock && $searchResultBlock->getResultCount()) {
         return '';
     }
     return parent::_toHtml();
 }
 public function __construct()
 {
     parent::__construct();
 }
Example #4
0
 public function testGetSearchUrl()
 {
     $query = uniqid();
     $obj = new Varien_Object(array('name' => $query));
     $this->assertStringEndsWith("/catalogsearch/result/?q={$query}", $this->_block->getSearchUrl($obj));
 }