Exemple #1
0
 public function replaceAccessoryData($product_id = 0, $accessory = array(), $user_id = 0, $uniqueid = "")
 {
     $uri = JURI::getInstance();
     $url = $uri->root();
     $redconfig = new Redconfiguration();
     $producthelper = new producthelper();
     $product = $producthelper->getProductById($product_id);
     $totalAccessory = count($accessory);
     $accessorylist = "";
     if ($totalAccessory > 0) {
         $accessorylist .= "<tr><th>" . JText::_('COM_REDSHOP_ACCESSORY_PRODUCT') . "</th></tr>";
         for ($a = 0; $a < count($accessory); $a++) {
             $ac_id = $accessory[$a]->child_product_id;
             $c_p_data = $producthelper->getProductById($ac_id);
             $accessory_name = $redconfig->maxchar($accessory[$a]->product_name, ACCESSORY_PRODUCT_TITLE_MAX_CHARS, ACCESSORY_PRODUCT_TITLE_END_SUFFIX);
             // Get accessory final price with VAT rules
             $accessorypricelist = $producthelper->getAccessoryPrice($product_id, $accessory[$a]->newaccessory_price, $accessory[$a]->accessory_main_price);
             $accessory_price = $accessorypricelist[0];
             $accessoryprice_withoutvat = $producthelper->getAccessoryPrice($product_id, $accessory[$a]->newaccessory_price, $accessory[$a]->accessory_main_price, 1);
             $accessory_price_withoutvat = $accessoryprice_withoutvat[0];
             $accessory_price_vat = $accessory_price - $accessory_price_withoutvat;
             $commonid = $product_id . '_' . $accessory[$a]->accessory_id . $uniqueid;
             // Accessory attribute  Start
             $attributes_set = array();
             if ($c_p_data->attribute_set_id > 0) {
                 $attributes_set = $producthelper->getProductAttribute(0, $c_p_data->attribute_set_id);
             }
             $attributes = $producthelper->getProductAttribute($ac_id);
             $attributes = array_merge($attributes, $attributes_set);
             $accessory_checkbox = "<input onClick='calculateOfflineTotalPrice(\"" . $uniqueid . "\");' type='checkbox' name='accessory_id_" . $product_id . $uniqueid . "[]' totalattributs='" . count($attributes) . "' accessoryprice='" . $accessory_price . "' accessorypricevat='" . $accessory_price_vat . "' id='accessory_id_" . $commonid . "' value='" . $accessory[$a]->accessory_id . "' />";
             $accessorylist .= "<tr><td>" . $accessory_checkbox . "&nbsp;" . $accessory_name . ' : ' . $producthelper->getProductFormattedPrice($accessory_price) . "</td></tr>";
             $accessorylist .= $this->replaceAttributeData($product_id, $accessory[$a]->accessory_id, $attributes, $user_id, $uniqueid);
         }
     }
     return $accessorylist;
 }
Exemple #2
0
 public function getRelatedtemplateView($template_desc, $product_id)
 {
     $extra_field = new extraField();
     $config = new Redconfiguration();
     $redTemplate = new Redtemplate();
     $redhelper = new redhelper();
     $related_product = $this->getRelatedProduct($product_id);
     $related_template = $this->getRelatedProductTemplate($template_desc);
     $option = 'com_redshop';
     $fieldArray = $extra_field->getSectionFieldList(17, 0, 0);
     if (count($related_template) > 0) {
         if (count($related_product) > 0 && strstr($related_template->template_desc, "{related_product_start}") && strstr($related_template->template_desc, "{related_product_end}")) {
             $related_template_data = '';
             $product_start = explode("{related_product_start}", $related_template->template_desc);
             $product_end = explode("{related_product_end}", $product_start[1]);
             $tempdata_div_start = $product_start[0];
             $tempdata_div_middle = $product_end[0];
             $tempdata_div_end = $product_end[1];
             $attribute_template = $this->getAttributeTemplate($tempdata_div_middle);
             for ($r = 0; $r < count($related_product); $r++) {
                 $related_template_data .= $tempdata_div_middle;
                 $ItemData = $this->getMenuInformation(0, 0, '', 'product&pid=' . $related_product[$r]->product_id);
                 if (count($ItemData) > 0) {
                     $pItemid = $ItemData->id;
                 } else {
                     $pItemid = $redhelper->getItemid($related_product[$r]->product_id);
                 }
                 $rlink = JRoute::_('index.php?option=com_redshop&view=product&pid=' . $related_product[$r]->product_id . '&Itemid=' . $pItemid);
                 if (strstr($related_template_data, "{relproduct_image_3}")) {
                     $rpimg_tag = '{relproduct_image_3}';
                     $rph_thumb = RELATED_PRODUCT_THUMB_HEIGHT_3;
                     $rpw_thumb = RELATED_PRODUCT_THUMB_WIDTH_3;
                 } elseif (strstr($related_template_data, "{relproduct_image_2}")) {
                     $rpimg_tag = '{relproduct_image_2}';
                     $rph_thumb = RELATED_PRODUCT_THUMB_HEIGHT_2;
                     $rpw_thumb = RELATED_PRODUCT_THUMB_WIDTH_2;
                 } elseif (strstr($related_template_data, "{relproduct_image_1}")) {
                     $rpimg_tag = '{relproduct_image_1}';
                     $rph_thumb = RELATED_PRODUCT_THUMB_HEIGHT;
                     $rpw_thumb = RELATED_PRODUCT_THUMB_WIDTH;
                 } else {
                     $rpimg_tag = '{relproduct_image}';
                     $rph_thumb = RELATED_PRODUCT_THUMB_HEIGHT;
                     $rpw_thumb = RELATED_PRODUCT_THUMB_WIDTH;
                 }
                 $hidden_thumb_image = "<input type='hidden' name='rel_main_imgwidth' id='rel_main_imgwidth' value='" . $rpw_thumb . "'><input type='hidden' name='rel_main_imgheight' id='rel_main_imgheight' value='" . $rph_thumb . "'>";
                 $relimage = $this->getProductImage($related_product[$r]->product_id, $rlink, $rpw_thumb, $rph_thumb);
                 $related_template_data = str_replace($rpimg_tag, $relimage . $hidden_thumb_image, $related_template_data);
                 if (strstr($related_template_data, "{relproduct_link}")) {
                     $rpname = "<a href='" . $rlink . "' title='" . $related_product[$r]->product_name . "'>" . $config->maxchar($related_product[$r]->product_name, RELATED_PRODUCT_TITLE_MAX_CHARS, RELATED_PRODUCT_TITLE_END_SUFFIX) . "</a>";
                 } 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);
                 // ProductFinderDatepicker Extra Field Start
                 $related_template_data = $this->getProductFinderDatepickerValue($related_template_data, $related_product[$r]->product_id, $fieldArray);
                 // ProductFinderDatepicker Extra Field End
                 if (strstr($related_template_data, "{manufacturer_name}") || strstr($related_template_data, "{manufacturer_link}")) {
                     $manufacturer = $this->getSection("manufacturer", $related_product[$r]->manufacturer_id);
                     if (count($manufacturer) > 0) {
                         $man_url = JRoute::_('index.php?option=' . $option . '&view=manufacturers&layout=products&mid=' . $related_product[$r]->manufacturer_id . '&Itemid=' . $pItemid);
                         $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);
                     }
                 }
                 $relmorelink = JRoute::_('index.php?option=' . $option . '&view=product&pid=' . $related_product[$r]->product_id . '&cid=' . $related_product[$r]->cat_in_sefurl . '&Itemid=' . $pItemid);
                 $rmore = "<a href='" . $relmorelink . "' title='" . $related_product[$r]->product_name . "'>" . JText::_('COM_REDSHOP_READ_MORE') . "</a>";
                 $related_template_data = str_replace("{read_more}", $rmore, $related_template_data);
                 $related_template_data = str_replace("{read_more_link}", $relmorelink, $related_template_data);
                 /*
                  *  related product Required Attribute start
                  * 	this will parse only Required Attributes
                  */
                 $relid = $related_product[$r]->product_id;
                 $attributes_set = array();
                 if ($related_product[$r]->attribute_set_id > 0) {
                     $attributes_set = $this->getProductAttribute(0, $related_product[$r]->attribute_set_id);
                 }
                 $attributes = $this->getProductAttribute($relid);
                 $attributes = array_merge($attributes, $attributes_set);
                 $related_template_data = $this->replaceAttributeData($related_product[$r]->mainproduct_id, 0, $related_product[$r]->product_id, $attributes, $related_template_data, $attribute_template);
                 // Check product for not for sale
                 $related_template_data = $this->getProductNotForSaleComment($related_product[$r], $related_template_data, $attributes, 1);
                 $related_template_data = $this->replaceCartTemplate($related_product[$r]->mainproduct_id, 0, 0, $related_product[$r]->product_id, $related_template_data, false, 0, count($attributes), 0, 0);
                 $related_template_data = $this->replaceCompareProductsButton($related_product[$r]->product_id, 0, $related_template_data, 1);
                 $related_template_data = $this->replaceProductInStock($related_product[$r]->product_id, $related_template_data);
                 $related_template_data = $this->getProductOnSaleComment($related_product[$r], $related_template_data);
                 $related_template_data = $this->getSpecialProductComment($related_product[$r], $related_template_data);
                 // related product attribute price list
                 $related_template_data = $this->replaceAttributePriceList($related_product[$r]->product_id, $related_template_data);
             }
             $related_template_data = $tempdata_div_start . $related_template_data . $tempdata_div_end;
             $template_desc = str_replace("{related_product:{$related_template->template_name}}", $related_template_data, $template_desc);
             $template_desc = $redTemplate->parseredSHOPplugin($template_desc);
         } else {
             $template_desc = str_replace("{related_product:{$related_template->template_name}}", "", $template_desc);
         }
     }
     return $template_desc;
 }
Exemple #3
0
 } else {
     $cat_thumb = "<a href='" . $link . "' " . $title . ">";
 }
 $cat_thumb .= "<img src='" . $product_img . "' " . $alt . $title . ">";
 $cat_thumb .= "</a>";
 $data_add = str_replace($tag, $cat_thumb, $data_add);
 if (strstr($data_add, '{category_name}')) {
     $cat_name = '<a href="' . $link . '" ' . $title . '>' . $row->category_name . '</a>';
     $data_add = str_replace("{category_name}", $cat_name, $data_add);
 }
 if (strstr($data_add, '{category_readmore}')) {
     $cat_name = '<a href="' . $link . '" ' . $title . '>' . JText::_('COM_REDSHOP_READ_MORE') . '</a>';
     $data_add = str_replace("{category_readmore}", $cat_name, $data_add);
 }
 if (strstr($data_add, '{category_description}')) {
     $cat_desc = $config->maxchar($row->category_description, CATEGORY_SHORT_DESC_MAX_CHARS, CATEGORY_SHORT_DESC_END_SUFFIX);
     $data_add = str_replace("{category_description}", $cat_desc, $data_add);
 }
 if (strstr($data_add, '{category_short_desc}')) {
     $cat_s_desc = $config->maxchar($row->category_short_description, CATEGORY_SHORT_DESC_MAX_CHARS, CATEGORY_SHORT_DESC_END_SUFFIX);
     $data_add = str_replace("{category_short_desc}", $cat_s_desc, $data_add);
 }
 if (strstr($data_add, '{category_total_product}')) {
     $totalprd = $producthelper->getProductCategory($row->category_id);
     $data_add = str_replace("{category_total_product}", count($totalprd), $data_add);
     $data_add = str_replace("{category_total_product_lbl}", JText::_('COM_REDSHOP_TOTAL_PRODUCT'), $data_add);
 }
 /*
  * category template extra field
  * "2" argument is set for category
  */
Exemple #4
0
 /**
  * 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>";
     }
 }
Exemple #5
0
 $totalatt = count($attributes);
 // Check product for not for sale
 $cart_mdata = $producthelper->getExtraSectionTag($extraFieldName, $product_id, "1", $cart_mdata, 1);
 $attribute_template = $producthelper->getAttributeTemplate($cart_mdata);
 $cart_mdata = $producthelper->replaceProductInStock($product_id, $cart_mdata, $attributes, $attribute_template);
 $cart_mdata = $producthelper->replaceAttributeData($product_id, 0, 0, $attributes, $cart_mdata, $attribute_template, $isChilds, 0, $totalatt);
 // Get cart tempalte
 $cart_mdata = $producthelper->replaceCartTemplate($product_id, 0, 0, 0, $cart_mdata, $isChilds);
 $cart_mdata = str_replace("{product_id_lbl}", JText::_('COM_REDSHOP_PRODUCT_ID_LBL'), $cart_mdata);
 $cart_mdata = str_replace("{product_id}", $manufacturer_products[$i]->product_id, $cart_mdata);
 $cart_mdata = str_replace("{product_number_lbl}", JText::_('COM_REDSHOP_PRODUCT_NUMBER_LBL'), $cart_mdata);
 $cart_mdata = str_replace("{product_number}", $manufacturer_products[$i]->product_number, $cart_mdata);
 $cart_mdata = str_replace("{product_s_desc}", $manufacturer_products[$i]->product_s_desc, $cart_mdata);
 $cart_mdata = str_replace("{category_name}", $manufacturer_products[$i]->category_name, $cart_mdata);
 if (strstr($cart_mdata, '{product_desc}')) {
     $p_desc = $Redconfiguration->maxchar($manufacturer_products[$i]->product_desc, CATEGORY_PRODUCT_DESC_MAX_CHARS, CATEGORY_PRODUCT_DESC_END_SUFFIX);
     $cart_mdata = str_replace("{product_desc}", $p_desc, $cart_mdata);
 }
 $cart_mdata = $producthelper->replaceWishlistButton($product_id, $cart_mdata);
 if (strstr($cart_mdata, '{product_thumb_image_2}')) {
     $tag = '{product_thumb_image_2}';
     $h_thumb = MANUFACTURER_PRODUCT_THUMB_HEIGHT_2;
     $w_thumb = MANUFACTURER_PRODUCT_THUMB_WIDTH_2;
 } elseif (strstr($cart_mdata, '{product_thumb_image_3}')) {
     $tag = '{product_thumb_image_3}';
     $h_thumb = MANUFACTURER_PRODUCT_THUMB_HEIGHT_3;
     $w_thumb = MANUFACTURER_PRODUCT_THUMB_WIDTH_3;
 } elseif (strstr($cart_mdata, '{product_thumb_image_1}')) {
     $tag = '{product_thumb_image_1}';
     $h_thumb = MANUFACTURER_PRODUCT_THUMB_HEIGHT;
     $w_thumb = MANUFACTURER_PRODUCT_THUMB_WIDTH;
Exemple #6
0
 // Limit the number of manufacturers shown
 $maxCount = $this->params->get('maxmanufacturer');
 if (count($this->detail) < $maxCount) {
     $maxCount = count($this->detail);
 }
 for ($i = 0; $i < $maxCount; $i++) {
     $row = $this->detail[$i];
     if ($row != '') {
         $mimg_tag = '{manufacturer_image}';
         $mh_thumb = MANUFACTURER_THUMB_HEIGHT;
         $mw_thumb = MANUFACTURER_THUMB_WIDTH;
         $link = JRoute::_('index.php?option=com_redshop&view=manufacturers&layout=detail&mid=' . $row->manufacturer_id . '&Itemid=' . $Itemid);
         $manproducts = JRoute::_('index.php?option=com_redshop&view=manufacturers&layout=products&mid=' . $row->manufacturer_id . '&Itemid=' . $Itemid);
         $manufacturer_name = "<a href='" . $manproducts . "'><b>" . $row->manufacturer_name . "</b></a>";
         $middledata = $template_middle;
         $manu_name = $config->maxchar($manufacturer_name, MANUFACTURER_TITLE_MAX_CHARS, MANUFACTURER_TITLE_END_SUFFIX);
         $middledata = str_replace("{manufacturer_name}", $manu_name, $middledata);
         // Extra field display
         $middledata = $producthelper->getExtraSectionTag($extraFieldName, $row->manufacturer_id, "10", $middledata);
         if (strstr($middledata, $mimg_tag)) {
             $thum_image = "";
             $media_image = $producthelper->getAdditionMediaImage($row->manufacturer_id, "manufacturer");
             for ($m = 0; $m < count($media_image); $m++) {
                 if ($media_image[$m]->media_name && file_exists(REDSHOP_FRONT_IMAGES_RELPATH . "manufacturer/" . $media_image[$m]->media_name)) {
                     $altText = $producthelper->getAltText('manufacturer', $row->manufacturer_id);
                     if (!$altText) {
                         $altText = $media_image[$m]->media_name;
                     }
                     if (WATERMARK_MANUFACTURER_IMAGE || WATERMARK_MANUFACTURER_THUMB_IMAGE) {
                         $manufacturer_img = $redhelper->watermark('manufacturer', $media_image[$m]->media_name, $mw_thumb, $mh_thumb, WATERMARK_MANUFACTURER_IMAGE);
                     } else {
Exemple #7
0
     $rph_thumb = RELATED_PRODUCT_THUMB_HEIGHT_2;
     $rpw_thumb = RELATED_PRODUCT_THUMB_WIDTH_2;
 } elseif (strstr($related_template_data, "{relproduct_image_1}")) {
     $rpimg_tag = '{relproduct_image_1}';
     $rph_thumb = RELATED_PRODUCT_THUMB_HEIGHT;
     $rpw_thumb = RELATED_PRODUCT_THUMB_WIDTH;
 } else {
     $rpimg_tag = '{relproduct_image}';
     $rph_thumb = RELATED_PRODUCT_THUMB_HEIGHT;
     $rpw_thumb = RELATED_PRODUCT_THUMB_WIDTH;
 }
 $hidden_thumb_image = "<input type='hidden' name='rel_main_imgwidth' id='rel_main_imgwidth' value='" . $rpw_thumb . "'><input type='hidden' name='rel_main_imgheight' id='rel_main_imgheight' value='" . $rph_thumb . "'>";
 $relimage = $producthelper->getProductImage($related_product[$r]->product_id, $rlink, $rpw_thumb, $rph_thumb);
 $related_template_data = str_replace($rpimg_tag, $relimage . $hidden_thumb_image, $related_template_data);
 if (strstr($related_template_data, "{relproduct_link}")) {
     $rpname = "<a href='" . $rlink . "' title='" . $related_product[$r]->product_name . "'>" . $config->maxchar($related_product[$r]->product_name, RELATED_PRODUCT_TITLE_MAX_CHARS, RELATED_PRODUCT_TITLE_END_SUFFIX) . "</a>";
 } 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);
Exemple #8
0
 } else {
     $cat_thumb = "<a href='" . $link . "' " . $title . ">";
 }
 $cat_thumb .= "<img src='" . $product_img . "' " . $alt . $title . ">";
 $cat_thumb .= "</a>";
 $data_add = str_replace($tag, $cat_thumb, $data_add);
 if (strstr($data_add, '{category_name}')) {
     $cat_name = '<a href="' . $link . '" ' . $title . '>' . $row->category_name . '</a>';
     $data_add = str_replace("{category_name}", $cat_name, $data_add);
 }
 if (strstr($data_add, '{category_readmore}')) {
     $cat_name = '<a href="' . $link . '" ' . $title . '>' . JText::_('COM_REDSHOP_READ_MORE') . '</a>';
     $data_add = str_replace("{category_readmore}", $cat_name, $data_add);
 }
 if (strstr($data_add, '{category_description}')) {
     $cat_desc = $config->maxchar($row->category_description, CATEGORY_DESC_MAX_CHARS, CATEGORY_DESC_END_SUFFIX);
     $data_add = str_replace("{category_description}", $cat_desc, $data_add);
 }
 if (strstr($data_add, '{category_short_desc}')) {
     $cat_s_desc = $config->maxchar($row->category_short_description, CATEGORY_SHORT_DESC_MAX_CHARS, CATEGORY_SHORT_DESC_END_SUFFIX);
     $data_add = str_replace("{category_short_desc}", $cat_s_desc, $data_add);
 }
 if (strstr($data_add, '{category_total_product}')) {
     $totalprd = $producthelper->getProductCategory($row->category_id);
     $data_add = str_replace("{category_total_product}", count($totalprd), $data_add);
     $data_add = str_replace("{category_total_product_lbl}", JText::_('COM_REDSHOP_TOTAL_PRODUCT'), $data_add);
 }
 /*
  * category template extra field
  * "2" argument is set for category
  */
Exemple #9
0
                for ($ui = 0; $ui < count($userfieldArr); $ui++) {
                    $product_userfileds = $extraField->list_all_user_fields($userfieldArr[$ui], 12, '', '', 0, $row->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_" . $row->product_id . "' name='user_fields_form_" . $row->product_id . "'>" . $template_userfield . "</form></div>";
                }
            }
        }
        // End
        $pname = $config->maxchar($row->product_name, CATEGORY_PRODUCT_TITLE_MAX_CHARS, CATEGORY_PRODUCT_TITLE_END_SUFFIX);
        echo "<div class='mod_redshop_products_title'><a href='" . $link . "' title=''>" . $pname . "</a></div>";
        if ($show_short_description) {
            $p_s_desc = $config->maxchar($row->product_s_desc, CATEGORY_PRODUCT_SHORT_DESC_MAX_CHARS, CATEGORY_PRODUCT_SHORT_DESC_END_SUFFIX);
            echo "<div class='mod_redshop_products_desc'>" . $p_s_desc . "</div>";
        }
        $addtocart = $producthelper->replaceCartTemplate($row->product_id, $category_id, 0, 0, "{form_addtocart:add_to_cart1}", false, $userfieldArr, $totalatt, $totalAccessory, $count_no_user_field, $module_id);
        echo "<div class='mod_redshop_products_addtocart'>" . $addtocart . $hidden_userfield . "</div>";
    }
    echo "</div></div></div></div>";
}
echo "</div>";
?>

<script type="text/javascript">
jQuery(document).ready(function($){