/** * Generate product search output */ public function onRSProductSearch() { if (count($this->search) > 0) { $app = JFactory::getApplication(); require_once JPATH_COMPONENT . '/helpers/product.php'; require_once JPATH_COMPONENT . '/helpers/pagination.php'; require_once JPATH_COMPONENT . '/helpers/extra_field.php'; require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/text_library.php'; $dispatcher = JDispatcher::getInstance(); $redTemplate = new Redtemplate(); $Redconfiguration = new Redconfiguration(); $producthelper = new producthelper(); $extraField = new extraField(); $texts = new text_library(); $stockroomhelper = new rsstockroomhelper(); $Itemid = JRequest::getInt('Itemid'); $search_type = JRequest::getCmd('search_type'); $cid = JRequest::getInt('category_id'); $manisrch = $this->search; $manufacture_id = $manisrch[0]->manufacturer_id; $templateid = JRequest::getInt('templateid'); // Cmd removes space between to words $keyword = JRequest::getWord('keyword'); $layout = JRequest::getCmd('layout', 'default'); $db = JFactory::getDbo(); $query = 'SELECT category_name' . ' FROM #__redshop_category ' . 'WHERE category_id=' . JRequest::getInt('cid'); $db->setQuery($query); $cat_name = null; if ($catname_array = $db->loadObjectList()) { $cat_name = $catname_array[0]->category_name; } $session = JFactory::getSession(); $model = $this->getModel('search'); $limit = $this->limit; $limitstart = JRequest::getInt('limitstart', 0); $total = $model->_total; JHTML::_('behavior.tooltip'); JHTMLBehavior::modal(); $url = JURI::base(); if ($this->params->get('page_title') != "") { $pagetitle = $this->params->get('page_title'); } else { $pagetitle = JText::_('COM_REDSHOP_SEARCH'); } if ($this->params->get('show_page_heading', 1)) { echo '<h1 class="componentheading' . $this->escape($this->params->get('pageclass_sfx')) . '">'; echo $pagetitle; echo '</h1>'; } echo '<div style="clear:both"></div>'; $category_tmpl = ""; if (count($this->templatedata) > 0 && $this->templatedata[0]->template_desc != "") { $template_desc = $this->templatedata[0]->template_desc; } else { $template_desc = "<div class=\"category_print\">{print}</div>\r\n<div style=\"clear: both;\"></div>\r\n<div class=\"category_main_description\">{category_main_description}</div>\r\n<p>{if subcats} {category_loop_start}</p>\r\n<div id=\"categories\">\r\n<div style=\"float: left; width: 200px;\">\r\n<div class=\"category_image\">{category_thumb_image}</div>\r\n<div class=\"category_description\">\r\n<h2 class=\"category_title\">{category_name}</h2>\r\n{category_description}</div>\r\n</div>\r\n</div>\r\n<p>{category_loop_end} {subcats end if}</p>\r\n<div style=\"clear: both;\"></div>\r\n<div id=\"category_header\">\r\n<div class=\"category_order_by\">{order_by}</div>\r\n</div>\r\n<div class=\"category_box_wrapper\">{product_loop_start}\r\n<div class=\"category_box_outside\">\r\n<div class=\"category_box_inside\">\r\n<div class=\"category_product_image\">{product_thumb_image}</div>\r\n<div class=\"category_product_title\">\r\n<h3>{product_name}</h3>\r\n</div>\r\n<div class=\"category_product_price\">{product_price}</div>\r\n<div class=\"category_product_readmore\">{read_more}</div>\r\n<div>{product_rating_summary}</div>\r\n<div class=\"category_product_addtocart\">{form_addtocart:add_to_cart1}</div>\r\n</div>\r\n</div>\r\n{product_loop_end}\r\n<div class=\"category_product_bottom\" style=\"clear: both;\"></div>\r\n</div>\r\n<div class=\"category_pagination\">{pagination}</div>"; } if (strstr($template_desc, "{product_display_limit}")) { $endlimit = $model->getProductPerPage(); $limit = JRequest::getInt('limit', $endlimit, '', 'int'); } $template_org = $template_desc; $template_d1 = explode("{category_loop_start}", $template_org); if (count($template_d1) > 1) { $template_d2 = explode("{category_loop_end}", $template_d1[1]); if (count($template_d2) > 0) { $category_tmpl = $template_d2[0]; } } $template_org = str_replace($category_tmpl, "", $template_org); $template_org = str_replace("{category_loop_start}", "", $template_org); $template_org = str_replace("{category_loop_end}", "", $template_org); $print = JRequest::getInt('print'); $p_url = @explode('?', $_SERVER['REQUEST_URI']); $print_tag = ''; if ($print) { $print_tag = "<a onclick='window.print();' title='" . JText::_('COM_REDSHOP_PRINT_LBL') . "' ><img src=" . JSYSTEM_IMAGES_PATH . "printButton.png alt='" . JText::_('COM_REDSHOP_PRINT_LBL') . "' title='" . JText::_('COM_REDSHOP_PRINT_LBL') . "' /></a>"; } else { $print_url = $url . "index.php?option=com_redshop&view=search&print=1&tmpl=component"; $print_tag = "<a href='#' onclick='window.open(\"{$print_url}\",\"mywindow\",\"scrollbars=1\",\"location=1\")' title='" . JText::_('COM_REDSHOP_PRINT_LBL') . "' ><img src=" . JSYSTEM_IMAGES_PATH . "printButton.png alt='" . JText::_('COM_REDSHOP_PRINT_LBL') . "' title='" . JText::_('COM_REDSHOP_PRINT_LBL') . "' /></a>"; } $template_org = str_replace("{total_product}", count($this->search), $template_org); $template_org = str_replace("{total_product_lbl}", JText::_('COM_REDSHOP_TOTAL_PRODUCT'), $template_org); if (strstr($template_org, "{compare_product_div}")) { $compare_product_div = ""; if (PRODUCT_COMPARISON_TYPE != "") { $comparediv = $producthelper->makeCompareProductDiv(); $compareUrl = JRoute::_('index.php?option=com_redshop&view=product&layout=compare&Itemid=' . $Itemid); $compare_product_div = "<form name='frmCompare' method='post' action='" . $compareUrl . "' >"; $compare_product_div .= "<a href='javascript:compare();' >" . JText::_('COM_REDSHOP_COMPARE') . "</a>"; $compare_product_div .= "<div id='divCompareProduct'>" . $comparediv . "</div>"; $compare_product_div .= "</form>"; } $template_org = str_replace("{compare_product_div}", $compare_product_div, $template_org); } // Skip html if nosubcategory if (strstr($template_org, "{if subcats}")) { $template_d1 = explode("{if subcats}", $template_org); $template_d2 = explode("{subcats end if}", $template_d1[1]); $template_org = $template_d1[0] . $template_d2[1]; } // End skip html if nosubcategory $template_org = str_replace("{print}", $print_tag, $template_org); $template_org = str_replace("{product_price_slider}", '', $template_org); $template_org = str_replace("{filter_by}", '', $template_org); $template_org = str_replace("{template_selector_category_lbl}", '', $template_org); $template_org = str_replace("{template_selector_category}", '', $template_org); $template_org = str_replace("{category_main_description}", '', $template_org); $template_org = str_replace("{category_main_name}", $cat_name, $template_org); $template_org = str_replace("{category_description}", '', $template_org); $template_org = str_replace("{category_short_desc}", '', $template_org); $template_org = str_replace("{category_name}", '', $template_org); $template_org = str_replace("{if subcats}", '', $template_org); $template_org = str_replace("{subcats end if}", '', $template_org); $template_org = str_replace("{category_main_thumb_image_3}", '', $template_org); $template_org = str_replace("{category_main_short_desc}", '', $template_org); $template_org = str_replace("{category_main_thumb_image_2}", '', $template_org); $template_org = str_replace("{category_main_thumb_image_1}", '', $template_org); $template_org = str_replace("{category_main_thumb_image}", '', $template_org); $template_org = str_replace("{attribute_price_without_vat}", '', $template_org); $template_org = str_replace("{redproductfinderfilter_formstart}", '', $template_org); $template_org = str_replace("{redproductfinderfilter:rp_myfilter}", '', $template_org); $template_org = str_replace("{redproductfinderfilter_formend}", '', $template_org); // Replace redproductfilder filter tag if (strstr($template_org, "{redproductfinderfilter:")) { $redProductFinerHelper = JPATH_SITE . "/components/com_redproductfinder/helpers/redproductfinder_helper.php"; if (file_exists($redProductFinerHelper)) { include_once $redProductFinerHelper; $redproductfinder_helper = new redproductfinder_helper(); $hdnFields = array('texpricemin' => '0', 'texpricemax' => '0', 'manufacturer_id' => $filter_by, 'category_template' => $templateid); $hide_filter_flag = false; if ($this->_id) { $prodctofcat = $producthelper->getProductCategory($this->_id); if (empty($prodctofcat)) { $hide_filter_flag = true; } } $template_org = $redproductfinder_helper->replaceProductfinder_tag($template_org, $hdnFields, $hide_filter_flag); } } // Replace redproductfilder filter tag end here $template_d1 = explode("{product_loop_start}", $template_org); $template_d2 = explode("{product_loop_end}", $template_d1[1]); $template_tmp_desc = $template_d2[0]; $template_desc = $template_d2[0]; // Order By $order_by = ""; $orderby_form = "<form name='orderby_form' action='' method='post' >"; $orderby_form .= $this->lists['order_select']; $orderby_form .= "<input type='hidden' name='view' value='search'>\n\t\t\t<input type='hidden' name='layout' value='{$layout}'>\n\t\t\t<input type='hidden' name='keyword' value='{$keyword}'>\n\t\t\t<input type='hidden' name='category_id' value='{$cid}'>\n\t\t\t<input type='hidden' name='manufacture_id' value='{$manufacture_id}'>\n\t\t\t<input type='hidden' name='templateid' value='{$templateid}'></form>"; if (strstr($template_desc, '{order_by}')) { $order_by = $orderby_form; } $extraFieldName = $extraField->getSectionFieldNameArray(1, 1, 1); $attribute_template = $producthelper->getAttributeTemplate($template_desc); $total_product = $model->_total; $endlimit = $this->limit; $start = JRequest::getInt('limitstart', 0, '', 'int'); if (strstr($template_org, "{pagination}")) { if (strstr($template_org, "{product_display_limit}")) { $endlimit = JRequest::getInt('limit', $endlimit, '', 'int'); } } else { $endlimit = $model->getData(); } if ($endlimit == 0) { $final_endlimit = $total_product; } else { $final_endlimit = $endlimit; } $tagarray = $texts->getTextLibraryTagArray(); $data = ""; $count_no_user_field = 0; for ($i = 0; $i < count($this->search); $i++) { $data_add = ""; $thum_image = ""; $pname = $Redconfiguration->maxchar($this->search[$i]->product_name, CATEGORY_PRODUCT_TITLE_MAX_CHARS, CATEGORY_PRODUCT_TITLE_END_SUFFIX); if ($search_type == 'product_number') { $product_number = str_ireplace($keyword, "<b class='search_hightlight'>" . $keyword . "</b>", $this->search[$i]->product_number); $pro_s_desc = $this->search[$i]->product_s_desc; $pro_desc = $this->search[$i]->product_desc; } else { $product_number = $this->search[$i]->product_number; $pro_s_desc = $this->search[$i]->product_s_desc; $pro_desc = $this->search[$i]->product_desc; if (!in_array($keyword, $tagarray)) { $pname = str_ireplace($keyword, "<b class='search_hightlight'>" . $keyword . "</b>", $pname); $pro_s_desc = str_ireplace($keyword, "<b class='search_hightlight'>" . $keyword . "</b>", $pro_s_desc); $pro_desc = str_ireplace($keyword, "<b class='search_hightlight'>" . $keyword . "</b>", $pro_desc); } } $pro_s_desc = $Redconfiguration->maxchar($pro_s_desc, CATEGORY_PRODUCT_DESC_MAX_CHARS, CATEGORY_PRODUCT_DESC_END_SUFFIX); $link = JRoute::_('index.php?option=com_redshop&view=product&pid=' . $this->search[$i]->product_id . '&Itemid=' . $Itemid); if (strstr($template_desc, '{product_name}')) { $pname = "<a href='" . $link . "'>" . $pname . "</a>"; $data_add = str_replace("{product_name}", $pname, $template_desc); } if (strstr($template_desc, '{product_name_nolink}')) { $data_add = str_replace("{product_name_nolink}", $pname, $template_desc); } $readmore = "<a href='" . $link . "'>" . JText::_('COM_REDSHOP_READ_MORE') . "</a>"; $data_add = str_replace("{read_more}", $readmore, $data_add); $data_add = str_replace("{read_more_link}", $link, $data_add); // RedSHOP Product Plugin JPluginHelper::importPlugin('redshop_product'); $results = $dispatcher->trigger('onPrepareProduct', array(&$data_add, &$params, $this->search[$i])); // End if (strstr($data_add, "{product_delivery_time}")) { $product_delivery_time = $producthelper->getProductMinDeliveryTime($this->search[$i]->product_id); if ($product_delivery_time != "") { $data_add = str_replace("{delivery_time_lbl}", JText::_('DELIVERY_TIME'), $data_add); $data_add = str_replace("{product_delivery_time}", $product_delivery_time, $data_add); } else { $data_add = str_replace("{delivery_time_lbl}", "", $data_add); $data_add = str_replace("{product_delivery_time}", "", $data_add); } } // Product Review/Rating // Fetching reviews $final_avgreview_data = $producthelper->getProductRating($this->search[$i]->product_id); // Attribute ajax chage $data_add = str_replace("{product_rating_summary}", $final_avgreview_data, $data_add); $data_add = $producthelper->getJcommentEditor($this->search[$i], $data_add); $data_add = $producthelper->getExtraSectionTag($extraFieldName, $this->search[$i]->product_id, "1", $data_add, 1); $data_add = str_replace("{product_s_desc}", $pro_s_desc, $data_add); $data_add = str_replace("{product_desc}", $pro_desc, $data_add); $data_add = str_replace("{product_id_lbl}", JText::_('COM_REDSHOP_PRODUCT_ID_LBL'), $data_add); $data_add = str_replace("{product_id}", $this->search[$i]->product_id, $data_add); $data_add = str_replace("{product_number_lbl}", JText::_('COM_REDSHOP_PRODUCT_NUMBER_LBL'), $data_add); $data_add = str_replace("{product_number}", $product_number, $data_add); /** * related Product List in Lightbox * Tag Format = {related_product_lightbox:<related_product_name>[:width][:height]} */ if (strstr($data_add, '{related_product_lightbox:')) { $related_product = $producthelper->getRelatedProduct($this->search[$i]->product_id); $rtlnone = explode("{related_product_lightbox:", $data_add); $rtlntwo = explode("}", $rtlnone[1]); $rtlnthree = explode(":", $rtlntwo[0]); $rtln = $rtlnthree[0]; $rtlnfwidth = isset($rtlnthree[1]) ? $rtlnthree[1] : "900"; $rtlnwidthtag = isset($rtlnthree[1]) ? ":" . $rtlnthree[1] : ""; $rtlnfheight = isset($rtlnthree[2]) ? $rtlnthree[2] : "600"; $rtlnheighttag = isset($rtlnthree[2]) ? ":" . $rtlnthree[2] : ""; $rtlntag = "{related_product_lightbox:{$rtln}{$rtlnwidthtag}{$rtlnheighttag}}"; if (count($related_product) > 0) { $linktortln = JUri::root() . "index.php?option=com_redshop&view=product&pid=" . $this->search[$i]->product_id . "&tmpl=component&template=" . $rtln . "&for=rtln"; $rtlna = '<a class="modal" href="' . $linktortln . '" rel="{handler:\'iframe\',size:{x:' . $rtlnfwidth . ',y:' . $rtlnfheight . '}}" >' . JText::_('COM_REDSHOP_RELATED_PRODUCT_LIST_IN_LIGHTBOX') . '</a>'; } else { $rtlna = ""; } $data_add = str_replace($rtlntag, $rtlna, $data_add); } $data_add = $producthelper->replaceVatinfo($data_add); /************************************ * Conditional tag * if product on discount : Yes * {if product_on_sale} This product is on sale {product_on_sale end if} // OUTPUT : This product is on sale * NO : // OUTPUT : Display blank ************************************/ $data_add = $producthelper->getProductOnSaleComment($this->search[$i], $data_add); $data_add = $stockroomhelper->replaceStockroomAmountDetail($data_add, $this->search[$i]->product_id); if (strstr($data_add, "{product_thumb_image_3}")) { $cimg_tag = '{product_thumb_image_3}'; $ch_thumb = CATEGORY_PRODUCT_THUMB_HEIGHT_3; $cw_thumb = CATEGORY_PRODUCT_THUMB_WIDTH_3; } elseif (strstr($data_add, "{product_thumb_image_2}")) { $cimg_tag = '{product_thumb_image_2}'; $ch_thumb = CATEGORY_PRODUCT_THUMB_HEIGHT_2; $cw_thumb = CATEGORY_PRODUCT_THUMB_WIDTH_2; } elseif (strstr($data_add, "{product_thumb_image_1}")) { $cimg_tag = '{product_thumb_image_1}'; $ch_thumb = CATEGORY_PRODUCT_THUMB_HEIGHT; $cw_thumb = CATEGORY_PRODUCT_THUMB_WIDTH; } else { $cimg_tag = '{product_thumb_image}'; $ch_thumb = CATEGORY_PRODUCT_THUMB_HEIGHT; $cw_thumb = CATEGORY_PRODUCT_THUMB_WIDTH; } $hidden_thumb_image = "<input type='hidden' name='prd_main_imgwidth' id='prd_main_imgwidth' value='" . $cw_thumb . "'><input type='hidden' name='prd_main_imgheight' id='prd_main_imgheight' value='" . $ch_thumb . "'>"; $thum_image = $producthelper->getProductImage($this->search[$i]->product_id, $link, $cw_thumb, $ch_thumb); $data_add = str_replace($cimg_tag, $thum_image . $hidden_thumb_image, $data_add); // More documents if (strstr($data_add, "{more_documents}")) { $media_documents = $producthelper->getAdditionMediaImage($this->search[$i]->product_id, "product", "document"); $more_doc = ''; for ($m = 0; $m < count($media_documents); $m++) { $alttext = $producthelper->getAltText("product", $media_documents[$m]->section_id, "", $media_documents[$m]->media_id, "document"); if (!$alttext) { $alttext = $media_documents[$m]->media_name; } if (is_file(REDSHOP_FRONT_DOCUMENT_RELPATH . "product/" . $media_documents[$m]->media_name)) { $downlink = JUri::root() . 'index.php?tmpl=component&option=com_redshop&view=product&pid=' . $this->search[$i]->product_id . '&task=downloadDocument&fname=' . $media_documents[$m]->media_name . '&Itemid=' . $Itemid; $more_doc .= "<div><a href='" . $downlink . "' title='" . $alttext . "'>"; $more_doc .= $alttext; $more_doc .= "</a></div>"; } } $data_add = str_replace("{more_documents}", "<span id='additional_docs" . $this->search[$i]->product_id . "'>" . $more_doc . "</span>", $data_add); } // More documents end /************************************************ user fields*******************************************************/ $hidden_userfield = ""; $returnArr = $producthelper->getProductUserfieldFromTemplate($data_add); $template_userfield = $returnArr[0]; $userfieldArr = $returnArr[1]; $count_no_user_field = 0; if ($template_userfield != "") { $ufield = ""; for ($ui = 0; $ui < count($userfieldArr); $ui++) { $product_userfileds = $extraField->list_all_user_fields($userfieldArr[$ui], 12, '', '', 0, $this->search[$i]->product_id); $ufield .= $product_userfileds[1]; if ($product_userfileds[1] != "") { $count_no_user_field++; } $data_add = str_replace('{' . $userfieldArr[$ui] . '_lbl}', $product_userfileds[0], $data_add); $data_add = str_replace('{' . $userfieldArr[$ui] . '}', $product_userfileds[1], $data_add); } $product_userfileds_form = "<form method='post' action='' id='user_fields_form_" . $this->search[$i]->product_id . "' name='user_fields_form_" . $this->search[$i]->product_id . "'>"; if ($ufield != "") { $data_add = str_replace("{if product_userfield}", $product_userfileds_form, $data_add); $data_add = str_replace("{product_userfield end if}", "</form>", $data_add); } else { $data_add = str_replace("{if product_userfield}", "", $data_add); $data_add = str_replace("{product_userfield end if}", "", $data_add); } } elseif (AJAX_CART_BOX) { $ajax_detail_template_desc = ""; $ajax_detail_template = $producthelper->getAjaxDetailboxTemplate($this->search[$i]); if (count($ajax_detail_template) > 0) { $ajax_detail_template_desc = $ajax_detail_template->template_desc; } $returnArr = $producthelper->getProductUserfieldFromTemplate($ajax_detail_template_desc); $template_userfield = $returnArr[0]; $userfieldArr = $returnArr[1]; if ($template_userfield != "") { $ufield = ""; for ($ui = 0; $ui < count($userfieldArr); $ui++) { $product_userfileds = $extraField->list_all_user_fields($userfieldArr[$ui], 12, '', '', 0, $this->search[$i]->product_id); $ufield .= $product_userfileds[1]; if ($product_userfileds[1] != "") { $count_no_user_field++; } $template_userfield = str_replace('{' . $userfieldArr[$ui] . '_lbl}', $product_userfileds[0], $template_userfield); $template_userfield = str_replace('{' . $userfieldArr[$ui] . '}', $product_userfileds[1], $template_userfield); } if ($ufield != "") { $hidden_userfield = "<div style='display:none;'><form method='post' action='' id='user_fields_form_" . $this->search[$i]->product_id . "' name='user_fields_form_" . $this->search[$i]->product_id . "'>" . $template_userfield . "</form></div>"; } } } $data_add = $data_add . $hidden_userfield; /*************** end user fields ***************/ // ProductFinderDatepicker Extra Field Start $fieldArray = $extraField->getSectionFieldList(17, 0, 0); $data_add = $producthelper->getProductFinderDatepickerValue($data_add, $this->search[$i]->product_id, $fieldArray); // ProductFinderDatepicker Extra Field End /* * manufacturer data */ $manufacturer_id = $this->search[$i]->manufacturer_id; if ($manufacturer_id != 0) { $manufacturer_data = $producthelper->getSection("manufacturer", $manufacturer_id); $manufacturer_link_href = JRoute::_('index.php?option=com_redshop&view=manufacturers&layout=detail&mid=' . $manufacturer_id . '&Itemid=' . $Itemid); $manufacturer_name = ""; if (count($manufacturer_data) > 0) { $manufacturer_name = $manufacturer_data->manufacturer_name; } $manufacturer_link = '<a href="' . $manufacturer_link_href . '" title="' . $manufacturer_name . '">' . $manufacturer_name . '</a>'; if (strstr($data_add, "{manufacturer_link}")) { $data_add = str_replace("{manufacturer_name}", "", $data_add); } else { $data_add = str_replace("{manufacturer_name}", $manufacturer_name, $data_add); } $data_add = str_replace("{manufacturer_link}", $manufacturer_link, $data_add); } else { $data_add = str_replace("{manufacturer_link}", "", $data_add); $data_add = str_replace("{manufacturer_name}", "", $data_add); } // End // Replace wishlistbutton $data_add = $producthelper->replaceWishlistButton($this->search[$i]->product_id, $data_add); // Replace compare product button $data_add = $producthelper->replaceCompareProductsButton($this->search[$i]->product_id, 0, $data_add); // Checking for child products $childproduct = $producthelper->getChildProduct($this->search[$i]->product_id); if (count($childproduct) > 0) { $isChilds = true; $attributes = array(); } else { $isChilds = false; // Get attributes $attributes_set = array(); if ($this->search[$i]->attribute_set_id > 0) { $attributes_set = $producthelper->getProductAttribute(0, $this->search[$i]->attribute_set_id, 0, 1); } $attributes = $producthelper->getProductAttribute($this->search[$i]->product_id); $attributes = array_merge($attributes, $attributes_set); } // Product attribute Start $totalatt = count($attributes); // Check product for not for sale $data_add = $producthelper->getProductNotForSaleComment($this->search[$i], $data_add, $attributes); $data_add = $producthelper->replaceProductInStock($this->search[$i]->product_id, $data_add, $attributes, $attribute_template); $data_add = $producthelper->replaceAttributeData($this->search[$i]->product_id, 0, 0, $attributes, $data_add, $attribute_template, $isChilds); // Cart Template $data_add = $producthelper->replaceCartTemplate($this->search[$i]->product_id, 0, 0, 0, $data_add, $isChilds, $userfieldArr, $totalatt, 0, $count_no_user_field, ""); $data .= $data_add; } $app = JFactory::getApplication(); $router = $app->getRouter(); $getorderby = JRequest::getVar('order_by', DEFAULT_PRODUCT_ORDERING_METHOD); $vars = array('option' => 'com_redshop', 'view' => 'search', 'layout' => $layout, 'keyword' => $keyword, 'manufacture_id' => $manufacture_id, 'order_by' => $getorderby, 'category_id' => $cid, 'Itemid' => $Itemid, 'limit' => $limit); $router->setVars($vars); unset($vars); if (strstr($template_org, "{pagination}")) { $pagination = new redPagination($total_product, $start, $endlimit); $slidertag = $pagination->getPagesLinks(); if (strstr($template_org, "{product_display_limit}")) { $slidertag = "<form action='' method='post'><input type='hidden' name='keyword' value='{$keyword}'>\n\t\t\t<input type='hidden' name='category_id' value='{$cid}'>\n\t\t\t<input type='hidden' name='manufacture_id' value='{$manufacture_id}'>\n\t\t\t<input type='hidden' name='templateid' value='{$templateid}'> " . $pagination->getListFooter() . "</form>"; $template_org = str_replace("{product_display_limit}", $slidertag, $template_org); $template_org = str_replace("{pagination}", '', $template_org); } $template_org = str_replace("{pagination}", $slidertag, $template_org); } $template_org = str_replace("{product_display_limit}", "", $template_org); if (strstr($template_org, "perpagelimit:")) { $perpage = explode('{perpagelimit:', $template_org); $perpage = explode('}', $perpage[1]); $template_org = str_replace("{perpagelimit:" . intval($perpage[0]) . "}", "", $template_org); } $template_org = str_replace("{order_by}", $orderby_form, $template_org); $template_org = str_replace("{order_by_lbl}", JText::_('COM_REDSHOP_SELECT_ORDER_BY'), $template_org); $template_org = str_replace("{filter_by_lbl}", JText::_('COM_REDSHOP_SELECT_FILTER_BY'), $template_org); $template_org = str_replace("{attribute_price_with_vat}", "", $template_org); $template_org = str_replace("{attribute_price_without_vat}", "", $template_org); $template_org = str_replace("{product_loop_start}", "", $template_org); $template_org = str_replace("{product_loop_end}", "", $template_org); $template_org = str_replace($template_tmp_desc, $data, $template_org); $template_org = str_replace("{with_vat}", "", $template_org); $template_org = str_replace("{without_vat}", "", $template_org); $template_org = $redTemplate->parseredSHOPplugin($template_org); $template_org = $texts->replace_texts($template_org); eval("?>" . $template_org . "<?php "); } else { echo "<br><h3>" . JText::_('COM_REDSHOP_MSG_SORRY_NO_RESULT_FOUND') . "</h3>"; } }
$div_end = "</div>"; $link = JRoute::_('index.php?option=com_redshop&view=product&pid=' . $product->product_id . '&Itemid=' . $this->itemId); $link_remove = JRoute::_('index.php?option=com_redshop&view=product&task=removecompare&layout=compare&pid=' . $product->product_id . '&Itemid=' . $this->itemId); $remove = "<a href='" . $link_remove . "'>" . JText::_('TPL_REDGADGETS_REMOVE_PRODUCT_FROM_COMPARE_LIST') . "</a>"; $thumbUrl = RedShopHelperImages::getImagePath($product->product_full_image, '', 'thumb', 'product', COMPARE_PRODUCT_THUMB_WIDTH, COMPARE_PRODUCT_THUMB_HEIGHT, USE_IMAGE_SIZE_SWAPPING); $img = "<div style='width:" . COMPARE_PRODUCT_THUMB_WIDTH . "px;height:" . COMPARE_PRODUCT_THUMB_HEIGHT . "px;float: left;' ><a href='" . $link . "' title='" . $product->product_name . "'><img src='" . $thumbUrl . "'></a></div>"; $expand = "<a href='javascript:void(0)' onClick='expand_collapse(this," . $product->product_id . ")' style='font-size:18px;text-decoration:none;' >-</a>"; if ($i != $compare['idx'] - 1) { $template = str_replace('{expand_collapse}', $expand . $td_end . '<td align="center">' . "{expand_collapse}", $template); } else { $template = str_replace('{expand_collapse}', $expand . $td_end . $td_start . "{expand_collapse}", $template); } $template = str_replace('{product_name}', $exp_div . $product->product_name . $div_end . $td_end . $td_start . "{product_name}", $template); $template = str_replace('{product_image}', $exp_div . $img . $div_end . $td_end . $td_start . "{product_image}", $template); if (strstr($template, "{manufacturer_name}")) { $manufacturer = $producthelper->getSection('manufacturer', $product->manufacturer_id); $template = str_replace('{manufacturer_name}', $exp_div . $manufacturer->manufacturer_name . $div_end . $td_end . $td_start . "{manufacturer_name}", $template); } if (strstr($template, "{discount_start_date}")) { $disc_start_date = ""; if ($product->discount_stratdate) { $disc_start_date = $config->convertDateFormat($product->discount_stratdate); } $template = str_replace('{discount_start_date}', $exp_div . $disc_start_date . $div_end . $td_end . $td_start . "{discount_start_date}", $template); } if (strstr($template, "{discount_end_date}")) { $disc_end_date = ""; if ($product->discount_enddate) { $disc_end_date = $config->convertDateFormat($product->discount_enddate); } $template = str_replace('{discount_end_date}', $exp_div . $disc_end_date . $div_end . $td_end . $td_start . "{discount_end_date}", $template);
$subtotal_excl_vat = 0; for ($i = 0; $i < count($products); $i++) { $cart[$i]['product_id'] = $products[$i]->product_id; $cart[$i]['quantity'] = $products[$i]->product_quantity; $quantity = $products[$i]->product_quantity; $product_id = $products[$i]->product_id; $productdetail = $producthelper->getProductById($product_id); $ordervolume = $ordervolume + $productdetail->product_volume; $order_item_id = $products[$i]->order_item_id; $order_item_name = $products[$i]->order_item_name; $order_item_sku = $products[$i]->order_item_sku; $wrapper_id = $products[$i]->wrapper_id; $p_userfield = $producthelper->getuserfield($order_item_id); $subscribe_detail = $model->getUserProductSubscriptionDetail($order_item_id); $catId = $producthelper->getCategoryProduct($product_id); $res = $producthelper->getSection("category", $catId); if (count($res) > 0) { $cname = $res->category_name; $clink = JRoute::_($url . 'index.php?option=com_redshop&view=category&layout=detail&cid=' . $catId); } $cname = "<a href='" . $clink . "'>" . $cname . "</a>"; $Product_name = $order_item_name . '<br>' . $order_item_sku . '<br>' . $p_userfield . '<br>' . $cname; $subtotal_excl_vat += $products[$i]->product_item_price_excl_vat * $quantity; $vat = $products[$i]->product_item_price - $products[$i]->product_item_price_excl_vat; ?> <tr> <td> <table border="0" cellspacing="0" cellpadding="0" class="adminlist" width="100%"> <tr> <td> <form action="<?php
/** * 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); }
/** * 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); }
} else { $rpname = $config->maxchar($related_product[$r]->product_name, RELATED_PRODUCT_TITLE_MAX_CHARS, RELATED_PRODUCT_TITLE_END_SUFFIX); } $rpdesc = $config->maxchar($related_product[$r]->product_desc, RELATED_PRODUCT_DESC_MAX_CHARS, RELATED_PRODUCT_DESC_END_SUFFIX); $rp_shortdesc = $config->maxchar($related_product[$r]->product_s_desc, RELATED_PRODUCT_SHORT_DESC_MAX_CHARS, RELATED_PRODUCT_SHORT_DESC_END_SUFFIX); $related_template_data = str_replace("{relproduct_link}", '', $related_template_data); if (strstr($related_template_data, "{relproduct_link}")) { $related_template_data = str_replace("{relproduct_name}", "", $related_template_data); } else { $related_template_data = str_replace("{relproduct_name}", $rpname, $related_template_data); } $related_template_data = str_replace("{relproduct_number_lbl}", JText::_('COM_REDSHOP_PRODUCT_NUMBER_LBL'), $related_template_data); $related_template_data = str_replace("{relproduct_number}", $related_product[$r]->product_number, $related_template_data); $related_template_data = str_replace("{relproduct_s_desc}", $rp_shortdesc, $related_template_data); $related_template_data = str_replace("{relproduct_desc}", $rpdesc, $related_template_data); $manufacturer = $producthelper->getSection("manufacturer", $related_product[$r]->manufacturer_id); if (count($manufacturer) > 0) { $man_url = JRoute::_('index.php?option=com_redshop&view=manufacturers&layout=products&mid=' . $related_product[$r]->manufacturer_id . '&Itemid=' . $this->itemId); $manufacturerLink = "<a href='" . $man_url . "'>" . JText::_("COM_REDSHOP_VIEW_ALL_MANUFACTURER_PRODUCTS") . "</a>"; $related_template_data = str_replace("{manufacturer_name}", $manufacturer->manufacturer_name, $related_template_data); $related_template_data = str_replace("{manufacturer_link}", $manufacturerLink, $related_template_data); } else { $related_template_data = str_replace("{manufacturer_name}", '', $related_template_data); $related_template_data = str_replace("{manufacturer_link}", '', $related_template_data); } // Show Price if (!$related_product[$r]->not_for_sale) { $related_template_data = $producthelper->GetProductShowPrice($related_product[$r]->product_id, $related_template_data, '', 0, 1); } else { $related_template_data = str_replace("{price_excluding_vat}", '', $related_template_data); $related_template_data = str_replace("{relproduct_price_table}", '', $related_template_data);
/** * sendOrderMail function. * * @param int $order_id Order ID. * * @return bool */ public function sendOrderMail($order_id, $onlyAdmin = false) { $redconfig = new Redconfiguration(); $producthelper = new producthelper(); $session = JFactory::getSession(); $config = JFactory::getConfig(); // Set the e-mail parameters $from = $config->getValue('mailfrom'); $fromname = $config->getValue('fromname'); $user = JFactory::getUser(); if (USE_AS_CATALOG) { $mailinfo = $this->getMailtemplate(0, "catalogue_order"); } else { $mailinfo = $this->getMailtemplate(0, "order"); } if (count($mailinfo) > 0) { $message = $mailinfo[0]->mail_body; $subject = $mailinfo[0]->mail_subject; } else { return false; } $cart = ''; $row = $this->_order_functions->getOrderDetails($order_id); $orderpayment = $this->_order_functions->getOrderPaymentDetail($order_id); $paymentmethod = $this->_order_functions->getPaymentMethodInfo($orderpayment[0]->payment_method_class); $paymentmethod = $paymentmethod[0]; // It is necessory to take billing info from order user info table // Order mail output should reflect the checkout process" $message = str_replace("{order_mail_intro_text_title}", JText::_('COM_REDSHOP_ORDER_MAIL_INTRO_TEXT_TITLE'), $message); $message = str_replace("{order_mail_intro_text}", JText::_('COM_REDSHOP_ORDER_MAIL_INTRO_TEXT'), $message); $message = $this->_carthelper->replaceOrderTemplate($row, $message); $rowitem = $this->_order_functions->getOrderItemDetail($order_id); $manufacturer_email = array(); $supplier_email = array(); $reddesign_attachment = array(); $cartArr = array(); $cart_mdata = ''; for ($i = 0; $i < count($rowitem); $i++) { $product = $producthelper->getProductById($rowitem[$i]->product_id); $manufacturerData = $producthelper->getSection("manufacturer", $product->manufacturer_id); if (count($manufacturerData) > 0) { if ($manufacturerData->manufacturer_email != '') { $manufacturer_email[$i] = $manufacturerData->manufacturer_email; } } $supplierData = $producthelper->getSection("supplier", $product->supplier_id); if (count($supplierData) > 0) { if ($supplierData->supplier_email != '') { $supplier_email[$i] = $supplierData->supplier_email; } } } $arr_discount_type = array(); $arr_discount = explode('@', $row->discount_type); $discount_type = ''; for ($d = 0; $d < count($arr_discount); $d++) { if ($arr_discount[$d]) { $arr_discount_type = explode(':', $arr_discount[$d]); if ($arr_discount_type[0] == 'c') { $discount_type .= JText::_('COM_REDSHOP_COUPON_CODE') . ' : ' . $arr_discount_type[1] . '<br>'; } if ($arr_discount_type[0] == 'v') { $discount_type .= JText::_('COM_REDSHOP_VOUCHER_CODE') . ' : ' . $arr_discount_type[1] . '<br>'; } } } if (!$discount_type) { $discount_type = JText::_('COM_REDSHOP_NO_DISCOUNT_AVAILABLE'); } $search[] = "{discount_type}"; $replace[] = $discount_type; $split_amount = 0; $issplitdisplay = ''; $issplitdisplay2 = ''; if ($row->split_payment) { $issplitdisplay = "<br/>" . JText::_('COM_REDSHOP_RECEIPT_PARTIALLY_PAID_AMOUNT') . ": " . $producthelper->getProductFormattedPrice($split_amount); $issplitdisplay2 = "<br/>" . JText::_('COM_REDSHOP_REMAINING_PARTIALLY_AMOUNT') . ": " . $producthelper->getProductFormattedPrice($split_amount); } $orderdetailurl = JURI::root() . 'index.php?option=com_redshop&view=order_detail&oid=' . $order_id . '&encr=' . $row->encr_key; $search[] = "{order_detail_link}"; $replace[] = "<a href='" . $orderdetailurl . "'>" . JText::_("COM_REDSHOP_ORDER_MAIL") . "</a>"; $billingaddresses = $this->_order_functions->getOrderBillingUserInfo($order_id); $message = str_replace($search, $replace, $message); $message = $this->imginmail($message); $thirdpartyemail = $billingaddresses->thirdparty_email; if ($session->get('isredcrmuser')) { $email = $user->email; } else { $email = $billingaddresses->user_email; } $search[] = "{order_id}"; $replace[] = $row->order_id; $search[] = "{order_number}"; $replace[] = $row->order_number; $search_sub[] = "{order_id}"; $replace_sub[] = $row->order_id; $search_sub[] = "{order_number}"; $replace_sub[] = $row->order_number; $search_sub[] = "{shopname}"; $replace_sub[] = SHOP_NAME; $search_sub[] = "{order_date}"; $replace_sub[] = $redconfig->convertDateFormat($row->cdate); $subject = str_replace($search_sub, $replace_sub, $subject); // Send the e-mail if ($email != "") { $mailbcc = array(); if (trim($mailinfo[0]->mail_bcc) != "") { $mailbcc = explode(",", $mailinfo[0]->mail_bcc); } $bcc = trim(ADMINISTRATOR_EMAIL) != '' ? explode(",", trim(ADMINISTRATOR_EMAIL)) : null; $bcc = array_merge($bcc, $mailbcc); $fullname = $billingaddresses->firstname . " " . $billingaddresses->lastname; if ($billingaddresses->is_company == 1 && $billingaddresses->company_name != "") { $fullname = $billingaddresses->company_name; } $subject = str_replace("{fullname}", $fullname, $subject); $subject = str_replace("{firstname}", $billingaddresses->firstname, $subject); $subject = str_replace("{lastname}", $billingaddresses->lastname, $subject); $message = str_replace("{fullname}", $fullname, $message); $message = str_replace("{firstname}", $billingaddresses->firstname, $message); $message = str_replace("{lastname}", $billingaddresses->lastname, $message); $body = $message; // As only need to send email to administrator, // Here variables are changed to use bcc email - from redSHOP configuration - Administrator Email if ($onlyAdmin) { $email = $bcc; $thirdpartyemail = ''; $bcc = null; } if ($thirdpartyemail != '') { if (!JUtility::sendMail($from, $fromname, $thirdpartyemail, $subject, $body, 1, null, $bcc)) { $this->setError(JText::_('COM_REDSHOP_ERROR_SENDING_CONFIRMATION_MAIL')); } } if (!JUtility::sendMail($from, $fromname, $email, $subject, $body, 1, null, $bcc)) { $this->setError(JText::_('COM_REDSHOP_ERROR_SENDING_CONFIRMATION_MAIL')); } } // As email only need to send admin no need to send email to others. if ($onlyAdmin) { return true; } if (MANUFACTURER_MAIL_ENABLE) { sort($manufacturer_email); for ($man = 0; $man < count($manufacturer_email); $man++) { if (!JUtility::sendMail($from, $fromname, $manufacturer_email[$man], $subject, $body, 1)) { $this->setError(JText::_('COM_REDSHOP_ERROR_SENDING_CONFIRMATION_MAIL')); } } } if (SUPPLIER_MAIL_ENABLE) { sort($supplier_email); for ($sup = 0; $sup < count($supplier_email); $sup++) { if (!JUtility::sendMail($from, $fromname, $supplier_email[$sup], $subject, $body, 1)) { $this->setError(JText::_('COM_REDSHOP_ERROR_SENDING_CONFIRMATION_MAIL')); } } } // Invoice mail send if (INVOICE_MAIL_ENABLE && $row->order_payment_status == "Paid") { $this->sendInvoiceMail($order_id); } return true; }
$print_url = $url . "index.php?option=com_redshop&view=category&layout=detail&cid=" . $this->catid; $print_url .= "&print=1&tmpl=component&Itemid=" . $this->itemid; $print_url .= "&limit=" . $endlimit . "&texpricemin=" . $texpricemin . "&texpricemax=" . $texpricemax . "&order_by=" . $this->order_by_select; $print_url .= "&manufacturer_id=" . $this->manufacturer_id . "&category_template=" . $this->category_template_id; $onclick = "onclick='window.open(\"{$print_url}\",\"mywindow\",\"scrollbars=1\",\"location=1\")'"; } $print_tag = "<a " . $onclick . " title='" . JText::_('COM_REDSHOP_PRINT_LBL') . "'>"; $print_tag .= "<img src='" . JSYSTEM_IMAGES_PATH . "printButton.png' alt='" . JText::_('COM_REDSHOP_PRINT_LBL') . "' title='" . JText::_('COM_REDSHOP_PRINT_LBL') . "' />"; $print_tag .= "</a>"; $template_desc = str_replace("{print}", $print_tag, $template_desc); $template_desc = str_replace("{total_product}", count($this->product), $template_desc); $template_desc = str_replace("{total_product_lbl}", JText::_('COM_REDSHOP_TOTAL_PRODUCT'), $template_desc); if (strstr($template_desc, '{returntocategory_link}') || strstr($template_desc, '{returntocategory_name}') || strstr($template_desc, '{returntocategory}')) { $parentid = $producthelper->getParentCategory($this->catid); if ($parentid != 0) { $categorylist = $producthelper->getSection("category", $parentid); $returncatlink = JRoute::_("index.php?option=" . $this->option . "&view=category&cid=" . $parentid . '&manufacturer_id=' . $this->manufacturer_id . "&Itemid=" . $this->itemid); $returntocategory = '<a href="' . $returncatlink . '">' . DAFULT_RETURN_TO_CATEGORY_PREFIX . ' ' . $categorylist->category_name . '</a>'; } else { $categorylist->category_name = DAFULT_RETURN_TO_CATEGORY_PREFIX; $returncatlink = JRoute::_("index.php?option=" . $this->option . "&view=category&manufacturer_id=" . $this->manufacturer_id . "&Itemid=" . $this->itemid); $returntocategory = '<a href="' . $returncatlink . '">' . DAFULT_RETURN_TO_CATEGORY_PREFIX . '</a>'; } $template_desc = str_replace("{returntocategory_link}", $returncatlink, $template_desc); $template_desc = str_replace('{returntocategory_name}', $categorylist->category_name, $template_desc); $template_desc = str_replace("{returntocategory}", $returntocategory, $template_desc); } if (strstr($template_desc, '{category_main_description}')) { $main_cat_desc = $Redconfiguration->maxchar($this->maincat->category_description, CATEGORY_SHORT_DESC_MAX_CHARS, CATEGORY_SHORT_DESC_END_SUFFIX); $template_desc = str_replace("{category_main_description}", $main_cat_desc, $template_desc); }