Exemplo n.º 1
0
 public function _loadData()
 {
     $red_template = new Redtemplate();
     if (empty($this->_data)) {
         $query = 'SELECT * FROM ' . $this->_table_prefix . 'template WHERE template_id = ' . $this->_id;
         $this->_db->setQuery($query);
         $this->_data = $this->_db->loadObject();
         // Read template from file and replace it with database template description
         if (isset($this->_data->template_section)) {
             $this->_data->template_name = strtolower($this->_data->template_name);
             $this->_data->template_name = str_replace(" ", "_", $this->_data->template_name);
             $template_desc = $this->_data->template_desc;
             $this->_data->template_desc = $red_template->readtemplateFile($this->_data->template_section, $this->_data->template_name, true);
             if ($this->_data->template_desc == "") {
                 $this->_data->template_desc = $template_desc;
             }
         }
         return (bool) $this->_data;
     }
     return true;
 }
Exemplo n.º 2
0
 public function getProductPerPage()
 {
     $app = JFactory::getApplication();
     $redconfig = $app->getParams();
     $redTemplate = new Redtemplate();
     $template = $this->getCategoryTemplet();
     for ($i = 0; $i < count($template); $i++) {
         $template[$i]->template_desc = $redTemplate->readtemplateFile($template[$i]->template_section, $template[$i]->template_name);
     }
     if (isset($template[0]->template_desc) && !strstr($template[0]->template_desc, "{show_all_products_in_category}") && strstr($template[0]->template_desc, "{pagination}") && strstr($template[0]->template_desc, "perpagelimit:")) {
         $perpage = explode('{perpagelimit:', $template[0]->template_desc);
         $perpage = explode('}', $perpage[1]);
         $limit = intval($perpage[0]);
     } else {
         $productperpage = $this->getState('productperpage');
         if ($productperpage != 0 && $productperpage != '') {
             $limit = $productperpage;
         } elseif ($this->_id) {
             $limit = intval($redconfig->get('maxproduct', 0));
             if ($limit == 0) {
                 $limit = $this->_maincat->products_per_page;
             }
         } else {
             $limit = MAXCATEGORY;
         }
     }
     if (strstr($template[0]->template_desc, "{product_display_limit}")) {
         $endlimit = JRequest::getInt('limit', 0, '', 'int');
     }
     return $limit;
 }
Exemplo n.º 3
0
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $redTemplate = new Redtemplate();
     $lists = array();
     $uri = JFactory::getURI();
     $params = $app->getParams('com_redshop');
     $document = JFactory::getDocument();
     $layout = JRequest::getCmd('layout', '');
     $model = $this->getModel('search');
     if ($layout == 'default') {
         $pagetitle = JText::_('COM_REDSHOP_SEARCH');
         $document->setTitle($pagetitle);
     }
     $document = JFactory::getDocument();
     JHTML::Script('common.js', 'components/com_redshop/assets/js/', false);
     if (AJAX_CART_BOX == 0) {
         JHTML::Script('fetchscript.js', 'components/com_redshop/assets/js/', false);
         JHTML::Script('attribute.js', 'components/com_redshop/assets/js/', false);
     }
     // Ajax cart javascript
     if (AJAX_CART_BOX == 1) {
         JHTML::Script('fetchscript.js', 'components/com_redshop/assets/js/', false);
         JHTML::Script('attribute.js', 'components/com_redshop/assets/js/', false);
         JHTML::Stylesheet('fetchscript.css', 'components/com_redshop/assets/css/');
     }
     if ($layout == 'redfilter') {
         $session = JSession::getInstance('none', array());
         $tagid = JRequest::getInt('tagid', 0);
         $typeid = JRequest::getInt('typeid', 0);
         $remove = JRequest::getInt('remove', 0);
         $Itemid = JRequest::getInt('Itemid', 0);
         $cntproduct = JRequest::getInt('cnt', 0);
         $getredfilter = $session->get('redfilter');
         if (count($getredfilter) == 0) {
             $redfilter = array();
         } else {
             $redfilter = $getredfilter;
         }
         if ($tagid != 0 && $typeid != 0 && !array_key_exists($typeid, $redfilter)) {
             $redfilter[$typeid] = $tagid;
         }
         if ($remove == 1) {
             if ($typeid != 0) {
                 unset($redfilter[$typeid]);
                 $session->set('redfilter', $redfilter);
                 $this->setLayout('redfilter');
                 $model->getRedFilterProduct($remove);
                 echo $model->mod_redProductfilter($Itemid, $typeid) . '~';
             } else {
                 $session->destroy('redfilter');
             }
         }
         $session->set('redfilter', $redfilter);
         if ($cntproduct == 1) {
             $mypid = JRequest::getInt('pid', 0);
             $app->Redirect('index.php?option=com_redshop&view=product&pid=' . $mypid . '&Itemid=' . $Itemid);
         }
     }
     $redHelper = new redhelper();
     $order_data = $redHelper->getOrderByList();
     $getorderby = JRequest::getString('order_by', DEFAULT_PRODUCT_ORDERING_METHOD);
     $lists['order_select'] = JHTML::_('select.genericlist', $order_data, 'order_by', 'class="inputbox" size="1" onchange="document.orderby_form.submit();" ', 'value', 'text', $getorderby);
     $templatedata = $model->getCategoryTemplet();
     for ($i = 0; $i < 1; $i++) {
         $templatedata[$i]->template_desc = $redTemplate->readtemplateFile($templatedata[$i]->template_section, $templatedata[$i]->template_name);
     }
     $search = $this->get('Data');
     $pagination = $this->get('Pagination');
     $this->params = $params;
     $this->limit = $model->getState('limit');
     $this->lists = $lists;
     $this->templatedata = $templatedata;
     $this->search = $search;
     $this->pagination = $pagination;
     $this->request_url = $uri->toString();
     parent::display($tpl);
 }