Esempio n. 1
0
 /**
  * Execute and display a template script.
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  mixed  A string if successful, otherwise a JError object.
  *
  * @see     fetch()
  * @since   11.1
  */
 public function display($tpl = null)
 {
     // Request variables
     $prodhelperobj = new producthelper();
     $this->redTemplate = new Redtemplate();
     $this->redHelper = new redhelper();
     $this->textHelper = new text_library();
     $this->app = JFactory::getApplication();
     $this->input = $this->app->input;
     $this->model = $this->getModel('product');
     $this->document = JFactory::getDocument();
     $this->session = JFactory::getSession();
     $pageheadingtag = '';
     $params = $this->app->getParams('com_redshop');
     $menu_meta_keywords = $params->get('menu-meta_keywords');
     $menu_meta_description = $params->get('menu-meta_description');
     $menu_robots = $params->get('robots');
     $this->data = $this->get('data');
     $productTemplate = null;
     $this->itemId = $this->input->getInt('Itemid', null);
     $this->pid = $this->input->getInt('pid', 0);
     $layout = $this->input->getString('layout', 'default');
     $template = $this->input->getString('r_template', '');
     JPluginHelper::importPlugin('redshop_product');
     $this->dispatcher = JDispatcher::getInstance();
     if (!$this->pid) {
         $this->pid = $params->get('productid');
     }
     /*
      *  Include JavaScript.
      *  But, first check if a plugin wants to use its own jQuery.
      */
     $stopJQuery = $this->dispatcher->trigger('stopProductRedshopJQuery', array($this->data, $layout));
     if (in_array(true, $stopJQuery, true)) {
         $stopJQuery = true;
     } else {
         $stopJQuery = false;
     }
     if (!$stopJQuery) {
         JHtml::Script('jquery.js', 'components/com_redshop/assets/js/', false);
     }
     JHtml::Script('redBOX.js', 'components/com_redshop/assets/js/', false);
     JHtml::Script('json.js', 'components/com_redshop/assets/js/', false);
     JHtml::Script('attribute.js', 'components/com_redshop/assets/js/', false);
     JHtml::Script('common.js', 'components/com_redshop/assets/js/', false);
     // Lightbox Javascript
     JHtml::Stylesheet('style.css', 'components/com_redshop/assets/css/');
     JHtml::Stylesheet('scrollable-navig.css', 'components/com_redshop/assets/css/');
     if ($layout == "downloadproduct") {
         $this->setLayout('downloadproduct');
     } elseif ($layout == "compare") {
         $this->setLayout('compare');
     } elseif ($layout == "viewajaxdetail") {
         $this->setLayout('viewajaxdetail');
     } elseif ($layout == "searchletter") {
         $this->setLayout('searchletter');
     } else {
         // Ajax box
         if ($template == 'cartbox' && AJAX_CART_BOX == 1) {
             $this->loadTemplate('cartbox');
             exit;
         } else {
             $this->setLayout('default');
         }
         $prodhelperobj_array_main = $prodhelperobj->getProductNetPrice($this->data->product_id);
         if ($this->data->published == 0) {
             JError::raiseError(404, sprintf(JText::_('COM_REDSHOP_PRODUCT_IS_NOT_PUBLISHED'), $this->data->product_name, $this->data->product_number));
         }
         if ($this->data->canonical_url != "") {
             $main_url = JURI::root() . $this->data->canonical_url;
             $canonical = '<link rel="canonical" href="' . $main_url . '" />';
             $this->document->addCustomTag($canonical);
         } elseif ($this->data->product_parent_id != 0 && $this->data->product_parent_id != "") {
             $product_parent_data = $prodhelperobj->getProductById($this->data->product_parent_id);
             if ($product_parent_data->canonical_url != "") {
                 $main_url = JURI::root() . $product_parent_data->canonical_url;
                 $canonical = '<link rel="canonical" href="' . $main_url . '" />';
                 $this->document->addCustomTag($canonical);
             } else {
                 $main_url = substr_replace(JURI::root(), "", -1);
                 $main_url .= JRoute::_('index.php?option=com_redshop&view=product&layout=detail&Itemid=' . $this->itemId . '&pid=' . $this->data->product_parent_id, false);
                 $canonical = '<link rel="canonical" href="' . $main_url . '" />';
                 $this->document->addCustomTag($canonical);
             }
         }
         $productTemplate = $this->model->getProductTemplate();
         /*
          * Process the prepare Product plugins
          */
         $this->dispatcher->trigger('onPrepareProduct', array(&$productTemplate->template_desc, &$params, $this->data));
         $pagetitletag = '';
         // For page title
         if (AUTOGENERATED_SEO && SEO_PAGE_TITLE != '') {
             $pagetitletag = SEO_PAGE_TITLE;
             $pagetitletag = str_replace("{productname}", $this->data->product_name, $pagetitletag);
             $pagetitletag = str_replace("{categoryname}", $this->data->category_name, $pagetitletag);
             $pagetitletag = str_replace("{manufacturer}", $this->data->manufacturer_name, $pagetitletag);
             $pagetitletag = str_replace("{productsku}", $this->data->product_number, $pagetitletag);
             $pagetitletag = str_replace("{productnumber}", $this->data->product_number, $pagetitletag);
             $pagetitletag = str_replace("{shopname}", SHOP_NAME, $pagetitletag);
             $pagetitletag = str_replace("{productshortdesc}", strip_tags($this->data->product_s_desc), $pagetitletag);
             $pagetitletag = str_replace("{saleprice}", $prodhelperobj_array_main['product_price'], $pagetitletag);
             $parentcat = "";
             $parentid = $prodhelperobj->getParentCategory($this->data->category_id);
             while ($parentid != 0) {
                 $parentdetail = $prodhelperobj->getSection("category", $parentid);
                 $parentcat = $parentdetail->category_name . "  " . $parentcat;
                 $parentid = $prodhelperobj->getParentCategory($parentdetail->category_id);
             }
             $pagetitletag = str_replace("{parentcategoryloop}", $parentcat, $pagetitletag);
             $pagetitletag = $prodhelperobj->getProductNotForSaleComment($this->data, $pagetitletag);
         }
         if ($this->data->pagetitle != '' && AUTOGENERATED_SEO && SEO_PAGE_TITLE != '') {
             if ($this->data->append_to_global_seo == 'append') {
                 $pagetitletag .= " " . $this->data->pagetitle;
                 $this->document->setTitle($pagetitletag);
                 $this->document->setMetaData("og:title", $pagetitletag);
             } elseif ($this->data->append_to_global_seo == 'prepend') {
                 $pagetitletag = $this->data->pagetitle . " " . $pagetitletag;
                 $this->document->setTitle($pagetitletag);
                 $this->document->setMetaData("og:title", $pagetitletag);
             } elseif ($this->data->append_to_global_seo == 'replace') {
                 $this->document->setTitle($this->data->pagetitle);
                 $this->document->setMetaData("og:title", $this->data->pagetitle);
             }
         } else {
             if ($this->data->pagetitle != '') {
                 $this->document->setTitle($this->data->pagetitle);
                 $this->document->setMetaData("og:title", $this->data->pagetitle);
             } elseif (AUTOGENERATED_SEO && SEO_PAGE_TITLE != '') {
                 $this->document->setTitle($pagetitletag);
                 $this->document->setMetaData("og:title", $pagetitletag);
             } else {
                 $this->document->setTitle($this->data->product_name . " | " . $this->data->category_name . " | " . $this->app->getCfg('sitename') . " | " . $this->data->product_number);
                 $this->document->setMetaData("og:title", $this->data->product_name . " | " . $this->data->category_name . " | " . $this->app->getCfg('sitename') . " | " . $this->data->product_number);
             }
         }
         $uri = JFactory::getURI();
         $scheme = $uri->getScheme();
         $host = $uri->getHost();
         if ($this->data->product_thumb_image && file_exists(REDSHOP_FRONT_IMAGES_RELPATH . "product/" . $this->data->product_thumb_image)) {
             $this->document->setMetaData("og:image", $scheme . "://" . $host . "/components/com_redshop/assets/images/product/" . $this->data->product_thumb_image);
         } elseif ($this->data->product_full_image && file_exists(REDSHOP_FRONT_IMAGES_RELPATH . "product/" . $this->data->product_full_image)) {
             $this->document->setMetaData("og:image", $scheme . "://" . $host . "/components/com_redshop/assets/images/product/" . $this->data->product_full_image);
         }
         $pagekeywordstag = '';
         if (AUTOGENERATED_SEO && SEO_PAGE_KEYWORDS != '') {
             $pagekeywordstag = SEO_PAGE_KEYWORDS;
             $pagekeywordstag = str_replace("{productname}", $this->data->product_name, $pagekeywordstag);
             $pagekeywordstag = str_replace("{categoryname}", $this->data->category_name, $pagekeywordstag);
             $pagekeywordstag = str_replace("{manufacturer}", $this->data->manufacturer_name, $pagekeywordstag);
             $pagekeywordstag = str_replace("{productsku}", $this->data->product_number, $pagekeywordstag);
             $pagekeywordstag = str_replace("{productnumber}", $this->data->product_number, $pagekeywordstag);
             $pagekeywordstag = str_replace("{shopname}", SHOP_NAME, $pagekeywordstag);
             $pagekeywordstag = str_replace("{productshortdesc}", strip_tags($this->data->product_s_desc), $pagekeywordstag);
             $pagekeywordstag = str_replace("{saleprice}", $prodhelperobj_array_main['product_price'], $pagekeywordstag);
             $pagekeywordstag = $prodhelperobj->getProductNotForSaleComment($this->data, $pagekeywordstag);
             $this->document->setMetaData('keywords', $pagekeywordstag);
         }
         if (trim($this->data->metakey) != '' && AUTOGENERATED_SEO && SEO_PAGE_KEYWORDS != '') {
             if ($this->data->append_to_global_seo == 'append') {
                 $pagekeywordstag .= "," . trim($this->data->metakey);
                 $this->document->setMetaData('keywords', $pagekeywordstag);
             } elseif ($this->data->append_to_global_seo == 'prepend') {
                 $this->document->setMetaData('keywords', $pagekeywordstag);
             } elseif ($this->data->append_to_global_seo == 'replace') {
                 $this->document->setMetaData('keywords', $this->data->metakey);
             }
         } else {
             if (trim($this->data->metakey) != '') {
                 $this->document->setMetaData('keywords', $this->data->metakey);
             } else {
                 if (AUTOGENERATED_SEO && SEO_PAGE_KEYWORDS != '') {
                     $this->document->setMetaData('keywords', $pagekeywordstag);
                 } elseif ($menu_meta_keywords != "") {
                     $this->document->setMetaData('keywords', $menu_meta_keywords);
                 } else {
                     $this->document->setMetaData('keywords', $this->data->product_name . ", " . $this->data->category_name . ", " . SHOP_NAME . ", " . $this->data->product_number);
                 }
             }
         }
         if (trim($this->data->metarobot_info) != '') {
             $this->document->setMetaData('robots', $this->data->metarobot_info);
         } else {
             if (AUTOGENERATED_SEO && SEO_PAGE_ROBOTS != '') {
                 $pagerobotstag = SEO_PAGE_ROBOTS;
                 $this->document->setMetaData('robots', $pagerobotstag);
             } elseif ($menu_robots != "") {
                 $this->document->setMetaData('robots', $menu_robots);
             } else {
                 $this->document->setMetaData('robots', "INDEX,FOLLOW");
             }
         }
         $pagedesctag = '';
         // For meta description
         if (AUTOGENERATED_SEO && SEO_PAGE_DESCRIPTION != '') {
             if ($prodhelperobj_array_main['product_price_saving'] != "") {
                 $product_price_saving_main = $prodhelperobj_array_main['product_price_saving'];
             } else {
                 $product_price_saving_main = 0;
             }
             $pagedesctag = SEO_PAGE_DESCRIPTION;
             $pagedesctag = str_replace("{productname}", $this->data->product_name, $pagedesctag);
             $pagedesctag = str_replace("{categoryname}", $this->data->category_name, $pagedesctag);
             $pagedesctag = str_replace("{manufacturer}", $this->data->manufacturer_name, $pagedesctag);
             $pagedesctag = str_replace("{productsku}", $this->data->product_number, $pagedesctag);
             $pagedesctag = str_replace("{productnumber}", $this->data->product_number, $pagedesctag);
             $pagedesctag = str_replace("{shopname}", SHOP_NAME, $pagedesctag);
             $pagedesctag = str_replace("{productshortdesc}", strip_tags($this->data->product_s_desc), $pagedesctag);
             $pagedesctag = str_replace("{productdesc}", strip_tags($this->data->product_desc), $pagedesctag);
             $pagedesctag = str_replace("{saleprice}", $prodhelperobj_array_main['product_price'], $pagedesctag);
             $pagedesctag = str_replace("{saving}", $product_price_saving_main, $pagedesctag);
             $pagedesctag = $prodhelperobj->getProductNotForSaleComment($this->data, $pagedesctag);
         }
         if (trim($this->data->metadesc) != '' && AUTOGENERATED_SEO && SEO_PAGE_DESCRIPTION != '') {
             if ($this->data->append_to_global_seo == 'append') {
                 $pagedesctag .= " " . $this->data->metadesc;
                 $this->document->setMetaData('description', $pagedesctag);
                 $this->document->setMetaData("og:description", $pagedesctag);
             } elseif ($this->data->append_to_global_seo == 'prepend') {
                 $this->document->setMetaData('description', $pagedesctag);
                 $this->document->setMetaData("og:description", $pagedesctag);
             } elseif ($this->data->append_to_global_seo == 'replace') {
                 $this->document->setMetaData('description', $this->data->metadesc);
                 $this->document->setMetaData("og:description", $this->data->metadesc);
             }
         } else {
             if (trim($this->data->metadesc) != '') {
                 $this->document->setMetaData('description', $this->data->metadesc);
                 $this->document->setMetaData("og:description", $pagedesctag);
             } elseif (AUTOGENERATED_SEO && SEO_PAGE_DESCRIPTION != '') {
                 $this->document->setMetaData('description', $pagedesctag);
                 $this->document->setMetaData("og:description", $pagedesctag);
             } elseif ($menu_meta_description != "") {
                 $this->document->setMetaData('description', $menu_meta_description);
                 $this->document->setMetaData("og:description", $menu_meta_description);
             } else {
                 $prodhelperobj_array = $prodhelperobj->getProductNetPrice($this->data->product_id);
                 if ($prodhelperobj_array['product_price_saving'] != '') {
                     $product_price_saving_main = $prodhelperobj_array['product_price_saving'];
                 } else {
                     $product_price_saving_main = 0;
                 }
                 $this->document->setMetaData('description', JText::_('COM_REDSHOP_META_BUY') . ' ' . $this->data->product_name . ' ' . JText::_('COM_REDSHOP_META_AT_ONLY') . ' ' . $prodhelperobj_array['product_price'] . ' ' . JText::_('COM_REDSHOP_META_SAVE') . ' ' . $product_price_saving_main);
                 $this->document->setMetaData('og:description', JText::_('COM_REDSHOP_META_BUY') . ' ' . $this->data->product_name . ' ' . JText::_('COM_REDSHOP_META_AT_ONLY') . ' ' . $prodhelperobj_array['product_price'] . ' ' . JText::_('COM_REDSHOP_META_SAVE') . ' ' . $product_price_saving_main);
             }
         }
         /**
          * @var $this->data
          * Trigger event onAfterDisplayProduct
          * Show content return by plugin directly into product page after display product title
          */
         $this->data->event = new stdClass();
         $results = $this->dispatcher->trigger('onAfterDisplayProductTitle', array(&$productTemplate->template_desc, $params, $this->data));
         $this->data->event->afterDisplayTitle = trim(implode("\n", $results));
         /**
          * @var $this->data
          *
          * Trigger event onBeforeDisplayProduct will display content before product display
          */
         $results = $this->dispatcher->trigger('onBeforeDisplayProduct', array(&$productTemplate->template_desc, $params, $this->data));
         $this->data->event->beforeDisplayProduct = trim(implode("\n", $results));
         // For page heading
         if (AUTOGENERATED_SEO && SEO_PAGE_HEADING != '') {
             $pageheadingtag = SEO_PAGE_HEADING;
             $pageheadingtag = str_replace("{productname}", $this->data->product_name, $pageheadingtag);
             $pageheadingtag = str_replace("{categoryname}", $this->data->category_name, $pageheadingtag);
             $pageheadingtag = str_replace("{manufacturer}", $this->data->manufacturer_name, $pageheadingtag);
             $pageheadingtag = str_replace("{productsku}", $this->data->product_number, $pageheadingtag);
             $pageheadingtag = str_replace("{productnumber}", $this->data->product_number, $pageheadingtag);
             $pageheadingtag = str_replace("{productshortdesc}", strip_tags($this->data->product_s_desc), $pageheadingtag);
         }
         if (trim($this->data->pageheading) != '' && AUTOGENERATED_SEO && SEO_PAGE_HEADING != '') {
             $pageheadingtag = $pageheadingtag . " " . $this->data->pageheading;
         } else {
             if (trim($this->data->pageheading) != '') {
                 $pageheadingtag = $this->data->pageheading;
             }
         }
         $visited = array();
         $visited = $this->session->get('visited', $visited);
         if ($this->pid && !in_array($this->pid, $visited)) {
             $this->model->updateVisited($this->pid);
             $visited[] = $this->pid;
             $this->session->set('visited', $visited);
         }
         // End
     }
     // Breadcrumb
     if ($this->pid) {
         $prodhelperobj->generateBreadcrumb($this->pid);
     }
     $this->template = $productTemplate;
     $this->pageheadingtag = $pageheadingtag;
     $this->params = $params;
     $for = $this->input->getBool("for", false);
     if ($for) {
         parent::display('related');
         return;
     }
     parent::display($tpl);
 }
<?php

defined('_JEXEC') or die;
jimport('joomla.application.component.controller');
JLoader::register("SroHelper", JPATH_COMPONENT_ADMINISTRATOR . "/helpers/general.php");
if (version_compare(JVERSION, "2.5", "ge")) {
    $task = JFactory::getApplication()->input->get("task");
} else {
    $task = JRequest::getCmd("task");
}
if (version_compare(JVERSION, "1.6", "ge")) {
    $controller = JController::getInstance("Sro");
    JHtml::Stylesheet("com_sro/site.css", null, true);
} else {
    require_once JPATH_SITE . "/components/com_sro/controller.php";
    $controller = new SroController();
    JHtml::Stylesheet("site.css", JURI::root() . "media/com_sro/css/");
    $lang =& JFactory::getLanguage();
    $lang->load("com_sro", JPATH_SITE, null, true);
    $lang->load("com_sro", JPATH_COMPONENT, null, true);
}
$controller->execute($task);
$controller->redirect();
Esempio n. 3
0
 /**
  * Execute and display a template script.
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  mixed  A string if successful, otherwise a JError object.
  *
  * @see     fetch()
  * @since   11.1
  */
 public function display($tpl = null)
 {
     global $context;
     $this->app = JFactory::getApplication();
     $this->input = $this->app->input;
     $objhelper = new redhelper();
     $prodhelperobj = new producthelper();
     // Request variables
     $this->option = $this->input->getString('option', 'com_redshop');
     $this->itemid = $this->input->getInt('Itemid', null);
     $this->catid = $this->input->getInt('cid', 0);
     $layout = $this->input->getString('layout', '');
     $this->print = $this->input->getBool('print', false);
     $params = $this->app->getParams($this->option);
     $model = $this->getModel('category');
     JPluginHelper::importPlugin('redshop_product');
     JPluginHelper::importPlugin('redshop_product_type');
     $this->dispatcher = JDispatcher::getInstance();
     $category_template = (int) $params->get('category_template');
     $menu_meta_keywords = $params->get('menu-meta_keywords');
     $menu_robots = $params->get('robots');
     $menu_meta_description = $params->get('menu-meta_description');
     if (!$this->catid && $layout == 'detail') {
         $this->catid = $params->get('cid');
         $this->setLayout('detail');
     }
     if (empty($layout) && $this->catid > 0) {
         $this->setLayout('detail');
     }
     $document = JFactory::getDocument();
     JHtml::Script('jquery.js', 'components/com_redshop/assets/js/', false);
     JHtml::Script('redBOX.js', 'components/com_redshop/assets/js/', false);
     JHtml::Script('attribute.js', 'components/com_redshop/assets/js/', false);
     JHtml::Script('common.js', 'components/com_redshop/assets/js/', false);
     JHtml::Stylesheet('priceslider.css', 'components/com_redshop/assets/css/');
     // Add jQueryUI because of IE9 issue
     $document->addStyleSheet('http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/base/jquery-ui.css');
     $lists = array();
     $minmax = array(0, 0);
     $product = array();
     $maincat = $model->_loadCategory();
     $allCategoryTemplate = $model->getCategoryTemplate();
     $order_data = $objhelper->getOrderByList();
     $manufacturers = $model->getManufacturer();
     $loadCategorytemplate = $model->loadCategoryTemplate();
     $detail = $model->getdata();
     if (count($maincat) > 0 && $maincat->canonical_url != "") {
         $main_url = JURI::root() . $maincat->canonical_url;
         $canonical = '<link rel="canonical" href="' . $main_url . '" />';
         $document->addCustomTag($canonical);
     }
     $pageheadingtag = '';
     if ($this->catid) {
         // Restrict category if category not published
         if ($maincat->published == 0) {
             JError::raiseError(404, sprintf(JText::_('COM_REDSHOP_CATEGORY_IS_NOT_PUBLISHED'), $maincat->category_name, $maincat->category_id));
         }
         $isSlider = false;
         if (count($loadCategorytemplate) > 0 && strstr($loadCategorytemplate[0]->template_desc, "{product_price_slider}")) {
             $limit_product = $model->getCategoryProduct(1);
             $minmax[0] = $limit_product[0]->minprice;
             $minmax[1] = $limit_product[0]->maxprice;
             $isSlider = true;
             $texpricemin = $this->input->getInt('texpricemin', $minmax[0]);
             $texpricemax = $this->input->getInt('texpricemax', $minmax[1]);
             $model->setMaxMinProductPrice(array($texpricemin, $texpricemax));
         }
         $product = $model->getCategoryProduct(0, $isSlider);
         $document->setMetaData('keywords', $maincat->metakey);
         $document->setMetaData('description', $maincat->metadesc);
         $document->setMetaData('robots', $maincat->metarobot_info);
         // For page title
         $pagetitletag = SEO_PAGE_TITLE_CATEGORY;
         $parentcat = "";
         $parentid = $prodhelperobj->getParentCategory($maincat->category_id);
         while ($parentid != 0) {
             $parentdetail = $prodhelperobj->getSection("category", $parentid);
             $parentcat = $parentdetail->category_name . "  " . $parentcat;
             $parentid = $prodhelperobj->getParentCategory($parentdetail->category_id);
         }
         $pagetitletag = str_replace("{parentcategoryloop}", $parentcat, $pagetitletag);
         $pagetitletag = str_replace("{categoryname}", $maincat->category_name, $pagetitletag);
         $pagetitletag = str_replace("{shopname}", SHOP_NAME, $pagetitletag);
         $pagetitletag = str_replace("{categoryshortdesc}", strip_tags($maincat->category_short_description), $pagetitletag);
         if ($maincat->pagetitle != "" && AUTOGENERATED_SEO && SEO_PAGE_TITLE_CATEGORY != '') {
             if ($maincat->append_to_global_seo == 'append') {
                 $pagetitletag = $pagetitletag . $maincat->pagetitle;
                 $document->setTitle($pagetitletag);
             } elseif ($maincat->append_to_global_seo == 'prepend') {
                 $pagetitletag = $maincat->pagetitle . $pagetitletag;
                 $document->setTitle($pagetitletag);
             } elseif ($maincat->append_to_global_seo == 'replace') {
                 $document->setTitle($maincat->pagetitle);
             }
         } elseif ($maincat->pagetitle != "") {
             $document->setTitle($maincat->pagetitle);
         } elseif (AUTOGENERATED_SEO && SEO_PAGE_TITLE_CATEGORY != '') {
             $document->setTitle($pagetitletag);
         } else {
             $document->setTitle($this->app->getCfg('sitename'));
         }
         $pagekeywordstag = '';
         if (AUTOGENERATED_SEO && SEO_PAGE_KEYWORDS_CATEGORY != '') {
             $pagekeywordstag = SEO_PAGE_KEYWORDS_CATEGORY;
             $pagekeywordstag = str_replace("{categoryname}", $maincat->category_name, $pagekeywordstag);
             $pagekeywordstag = str_replace("{categoryshortdesc}", strip_tags($maincat->category_short_description), $pagekeywordstag);
             $pagekeywordstag = str_replace("{shopname}", SHOP_NAME, $pagekeywordstag);
             $document->setMetaData('keywords', $pagekeywordstag);
         }
         if (trim($maincat->metakey) != '' && AUTOGENERATED_SEO && SEO_PAGE_KEYWORDS_CATEGORY != '') {
             if ($maincat->append_to_global_seo == 'append') {
                 $pagekeywordstag .= "," . trim($maincat->metakey);
                 $document->setMetaData('keywords', $pagekeywordstag);
             } elseif ($maincat->append_to_global_seo == 'prepend') {
                 $pagekeywordstag = trim($maincat->metakey) . $pagekeywordstag;
                 $document->setMetaData('keywords', $pagekeywordstag);
             } elseif ($maincat->append_to_global_seo == 'replace') {
                 $document->setMetaData('keywords', $maincat->metakey);
             }
         } else {
             if ($maincat->metakey != '') {
                 $document->setMetaData('keywords', $maincat->metakey);
             } else {
                 if (AUTOGENERATED_SEO && SEO_PAGE_KEYWORDS_CATEGORY != '') {
                     $document->setMetaData('keywords', $pagekeywordstag);
                 } else {
                     $document->setMetaData('keywords', $maincat->category_name);
                 }
             }
         }
         $pagedesctag = '';
         // For custom + auto generated description
         if (AUTOGENERATED_SEO && SEO_PAGE_DESCRIPTION_CATEGORY != '') {
             $pagedesctag = SEO_PAGE_DESCRIPTION_CATEGORY;
             $pagedesctag = str_replace("{categoryname}", $maincat->category_name, $pagedesctag);
             $pagedesctag = str_replace("{shopname}", SHOP_NAME, $pagedesctag);
             $pagedesctag = str_replace("{categoryshortdesc}", strip_tags($maincat->category_short_description), $pagedesctag);
             $pagedesctag = str_replace("{categorydesc}", strip_tags($maincat->category_description), $pagedesctag);
         }
         if ($maincat->metadesc != '' && AUTOGENERATED_SEO && SEO_PAGE_DESCRIPTION_CATEGORY != '') {
             if ($maincat->append_to_global_seo == 'append') {
                 $pagedesctag .= $maincat->metadesc;
                 $document->setMetaData('description', $pagedesctag);
             } elseif ($maincat->append_to_global_seo == 'prepend') {
                 $pagedesctag = trim($maincat->metadesc) . $pagedesctag;
                 $document->setMetaData('description', $pagedesctag);
             } elseif ($maincat->append_to_global_seo == 'replace') {
                 $document->setMetaData('description', $maincat->metadesc);
             }
         } elseif ($maincat->metadesc != '') {
             $document->setMetaData('description', $maincat->metadesc);
         } else {
             if (AUTOGENERATED_SEO && SEO_PAGE_DESCRIPTION_CATEGORY != '') {
                 $document->setMetaData('description', $pagedesctag);
             } else {
                 $document->setMetaData('description', $maincat->category_name);
             }
         }
         // For metarobot
         if ($maincat->metarobot_info != '') {
             $document->setMetaData('robots', $maincat->metarobot_info);
         } else {
             if (AUTOGENERATED_SEO && SEO_PAGE_ROBOTS != '') {
                 $pagerobotstag = SEO_PAGE_ROBOTS;
                 $document->setMetaData('robots', $pagerobotstag);
             } else {
                 $document->setMetaData('robots', "INDEX,FOLLOW");
             }
         }
         $pageheadingtag = str_replace("{categoryname}", $maincat->category_name, SEO_PAGE_HEADING_CATEGORY);
         if ($maincat->pageheading != "" && AUTOGENERATED_SEO && SEO_PAGE_HEADING_CATEGORY != '') {
             $pageheadingtag = $pageheadingtag . $maincat->pageheading;
         } elseif ($maincat->pageheading != "") {
             $pageheadingtag = $maincat->pageheading;
         } else {
             $pageheadingtag = $this->app->getCfg('sitename');
         }
     } else {
         if ($menu_meta_keywords != "") {
             $document->setMetaData('keywords', $menu_meta_keywords);
         } else {
             $document->setMetaData('keywords', $this->app->getCfg('sitename'));
         }
         if ($menu_meta_description != "") {
             $document->setMetaData('description', $menu_meta_description);
         } else {
             $document->setMetaData('description', $this->app->getCfg('sitename'));
         }
         if ($menu_robots != "") {
             $document->setMetaData('robots', $menu_robots);
         } else {
             $document->setMetaData('robots', $this->app->getCfg('sitename'));
         }
     }
     // Breadcrumbs
     $prodhelperobj->generateBreadcrumb($this->catid);
     $disabled = "";
     if ($this->print) {
         $disabled = "disabled";
     }
     $selected_template = 0;
     if ($this->catid) {
         if (isset($category_template) && $category_template) {
             $selected_template = $category_template;
         } elseif (isset($maincat->category_template)) {
             $selected_template = $maincat->category_template;
         }
     } else {
         $selected_template = DEFAULT_CATEGORYLIST_TEMPLATE;
     }
     $category_template_id = $this->app->getUserStateFromRequest($context . 'category_template', 'category_template', $selected_template);
     $order_by_select = $this->input->getString('order_by', '');
     $manufacturer_id = $this->input->getInt('manufacturer_id', 0);
     $lists['category_template'] = "";
     $lists['manufacturer'] = "";
     if (count($manufacturers) > 0) {
         $temps = array((object) array('manufacturer_id' => 0, 'manufacturer_name' => JText::_('COM_REDSHOP_SELECT_MANUFACTURE')));
         $manufacturers = array_merge($temps, $manufacturers);
         $lists['manufacturer'] = JHtml::_('select.genericlist', $manufacturers, 'manufacturer_id', 'class="inputbox" onchange="javascript:setSliderMinMaxForManufactur();" ' . $disabled . ' ', 'manufacturer_id', 'manufacturer_name', $manufacturer_id);
     }
     if (count($allCategoryTemplate) > 1) {
         $lists['category_template'] = JHtml::_('select.genericlist', $allCategoryTemplate, 'category_template', 'class="inputbox" size="1" onchange="javascript:setSliderMinMaxForTemplate();" ' . $disabled . ' ', 'template_id', 'template_name', $category_template_id);
     }
     if ($order_by_select == '') {
         $order_by_select = $params->get('order_by', DEFAULT_PRODUCT_ORDERING_METHOD);
     }
     $lists['order_by'] = JHtml::_('select.genericlist', $order_data, 'order_by', 'class="inputbox" size="1" onChange="javascript:setSliderMinMax();" ' . $disabled . ' ', 'value', 'text', $order_by_select);
     // THIS FILE MUST LOAD AFTER MODEL CONSTUCTOR LOAD
     $GLOBALS['product_price_slider'] = 0;
     if ($this->catid && count($loadCategorytemplate) > 0) {
         if (strstr($loadCategorytemplate[0]->template_desc, "{product_price_slider}")) {
             $ajaxSlide = $this->input->getBool('ajaxslide', false);
             if (!$ajaxSlide) {
                 $strToInsert = "<div id='oldredcatpagination'>{show_all_products_in_category}</div>";
                 $loadCategorytemplate[0]->template_desc = str_replace("{show_all_products_in_category}", $strToInsert, $loadCategorytemplate[0]->template_desc);
                 $strToInsert = "<div id='oldredcatpagination'>{pagination}</div>";
                 $loadCategorytemplate[0]->template_desc = str_replace("{pagination}", $strToInsert, $loadCategorytemplate[0]->template_desc);
             }
             if (count($product) > 0) {
                 $GLOBALS['product_price_slider'] = 1;
                 // Start Code for fixes IE9 issue
                 $document->addScript('//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js');
                 $document->addScript('//ajax.googleapis.com/ajax/libs/jqueryui/1.8.15/jquery-ui.min.js');
                 // End Code for fixes IE9 issue
                 require_once JPATH_COMPONENT_SITE . '/assets/js/catprice_filter.php';
             } else {
                 $loadCategorytemplate[0]->template_desc = str_replace("{product_price_slider}", "", $loadCategorytemplate[0]->template_desc);
                 $loadCategorytemplate[0]->template_desc = str_replace("{pagination}", "", $loadCategorytemplate[0]->template_desc);
             }
         }
         if (!count($product)) {
             $loadCategorytemplate[0]->template_desc = str_replace("{order_by_lbl}", "", $loadCategorytemplate[0]->template_desc);
             $loadCategorytemplate[0]->template_desc = str_replace("{order_by}", "", $loadCategorytemplate[0]->template_desc);
             if (!$manufacturer_id) {
                 $loadCategorytemplate[0]->template_desc = str_replace("{filter_by_lbl}", "", $loadCategorytemplate[0]->template_desc);
                 $loadCategorytemplate[0]->template_desc = str_replace("{filter_by}", "", $loadCategorytemplate[0]->template_desc);
             }
         }
     }
     $this->detail = $detail;
     $this->lists = $lists;
     $this->product = $product;
     $this->pageheadingtag = $pageheadingtag;
     $this->params = $params;
     $this->maincat = $maincat;
     $this->category_template_id = $category_template_id;
     $this->order_by_select = $order_by_select;
     $this->manufacturer_id = $manufacturer_id;
     $this->loadCategorytemplate = $loadCategorytemplate;
     parent::display($tpl);
 }