$template_d1 = explode("{product_loop_start}", $data_add); $template_d2 = explode("{product_loop_end}", $template_d1[1]); $template_product = $template_d2[0]; $attribute_template = $producthelper->getAttributeTemplate($template_product); $extraFieldName = $extraField->getSectionFieldNameArray(1, 1, 1); $product_data = ''; $prddata_add = ""; $this->product = $model->getCategorylistProduct($row->category_id); for ($j = 0; $j < count($this->product); $j++) { $product = $this->product[$j]; if (!is_object($product)) { break; } $count_no_user_field = 0; // Counting accessory $accessorylist = $producthelper->getProductAccessory(0, $product->product_id); $totacc = count($accessorylist); $prddata_add .= $template_product; // Product User Field Start $hidden_userfield = ""; $returnArr = $producthelper->getProductUserfieldFromTemplate($prddata_add); $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, $product->product_id); $ufield .= $product_userfileds[1]; if ($product_userfileds[1] != "") { $count_no_user_field++; }
public function getProductItemInfo($product_id = 0, $quantity = 1, $unique_id = "", $user_id = 0, $newproduct_price = 0) { $producthelper = new producthelper(); $wrapperlist = ""; $accessorylist = ""; $attributelist = ""; $productuserfield = ""; $product_price = 0; $product_price_excl_vat = 0; $producttax = 0; if ($product_id) { $productInfo = $producthelper->getProductById($product_id); if ($newproduct_price != 0) { $product_price_excl_vat = $newproduct_price; $producttax = $producthelper->getProductTax($product_id, $newproduct_price, $user_id); } else { $productArr = $producthelper->getProductNetPrice($product_id, $user_id, $quantity); $product_price_excl_vat = $productArr['productPrice']; $producttax = $productArr['productVat']; // Attribute start $attributes_set = array(); if ($productInfo->attribute_set_id > 0) { $attributes_set = $producthelper->getProductAttribute(0, $productInfo->attribute_set_id, 0, 1); } $attributes = $producthelper->getProductAttribute($product_id); $attributes = array_merge($attributes, $attributes_set); $attributelist = $this->replaceAttributeData($product_id, 0, $attributes, $user_id, $unique_id); // Accessory start $accessory = $producthelper->getProductAccessory(0, $product_id); $accessorylist = $this->replaceAccessoryData($product_id, $accessory, $user_id, $unique_id); // Wrapper selection box generate $wrapperlist = $this->replaceWrapperData($product_id, $user_id, $unique_id); $productuserfield = $this->replaceUserfield($product_id, $productInfo->product_template, $unique_id); } } $product_price = $product_price_excl_vat + $producttax; $total_price = $product_price * $quantity; $totaltax = $producttax * $quantity; $displayrespoce = ""; $displayrespoce .= "<div id='product_price_excl_vat'>" . $product_price_excl_vat . "</div>"; $displayrespoce .= "<div id='product_tax'>" . $producttax . "</div>"; $displayrespoce .= "<div id='product_price'>" . $product_price . "</div>"; $displayrespoce .= "<div id='total_price'>" . $total_price . "</div>"; $displayrespoce .= "<div id='total_tax'>" . $totaltax . "</div>"; $displayrespoce .= "<div id='attblock'><table>" . $attributelist . "</table></div>"; $displayrespoce .= "<div id='productuserfield'><table>" . $productuserfield . "</table></div>"; $displayrespoce .= "<div id='accessoryblock'><table>" . $accessorylist . "</table></div>"; $displayrespoce .= "<div id='noteblock'>" . $wrapperlist . "</div>"; return $displayrespoce; }
/** * Method to add product in cart * * @return void */ public function add() { $app = JFactory::getApplication(); $option = JRequest::getVar('option'); $post = JRequest::get('post'); $parent_accessory_productid = $post['product_id']; $Itemid = JRequest::getVar('Itemid'); $producthelper = new producthelper(); $redhelper = new redhelper(); $Itemid = $redhelper->getCartItemid(); $model = $this->getModel('cart'); // Call add method of modal to store product in cart session $userfiled = JRequest::getVar('userfiled'); JPluginHelper::importPlugin('redshop_product'); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onBeforeAddProductToCart', array(&$post)); $result = $this->_carthelper->addProductToCart($post); if (is_bool($result) && $result) { } else { $errmsg = $result ? $result : JText::_("COM_REDSHOP_PRODUCT_NOT_ADDED_TO_CART"); if (AJAX_CART_BOX == 1) { echo "`0`" . $errmsg; die; } else { $ItemData = $producthelper->getMenuInformation(0, 0, '', 'product&pid=' . $post['product_id']); if (count($ItemData) > 0) { $prdItemid = $ItemData->id; } else { $prdItemid = $redhelper->getItemid($post['product_id']); } $link = JRoute::_("index.php?option=" . $option . "&view=product&pid=" . $post["product_id"] . "&Itemid=" . $prdItemid, false); $app->Redirect($link, $errmsg); } } $session = JFactory::getSession(); $cart = $session->get('cart'); if (isset($cart['AccessoryAsProduct'])) { $attArr = $cart['AccessoryAsProduct']; if (ACCESSORY_AS_PRODUCT_IN_CART_ENABLE) { $data['accessory_data'] = $attArr[0]; $data['acc_quantity_data'] = $attArr[1]; $data['acc_attribute_data'] = $attArr[2]; $data['acc_property_data'] = $attArr[3]; $data['acc_subproperty_data'] = $attArr[4]; if (isset($data['accessory_data']) && ($data['accessory_data'] != "" && $data['accessory_data'] != 0)) { $accessory_data = explode("@@", $data['accessory_data']); $acc_quantity_data = explode("@@", $data['acc_quantity_data']); $acc_attribute_data = explode("@@", $data['acc_attribute_data']); $acc_property_data = explode("@@", $data['acc_property_data']); $acc_subproperty_data = explode("@@", $data['acc_subproperty_data']); for ($i = 0; $i < count($accessory_data); $i++) { $accessory = $producthelper->getProductAccessory($accessory_data[$i]); $post = array(); $post['parent_accessory_product_id'] = $parent_accessory_productid; $post['product_id'] = $accessory[0]->child_product_id; $post['quantity'] = $acc_quantity_data[$i]; $post['category_id'] = 0; $post['sel_wrapper_id'] = 0; $post['attribute_data'] = $acc_attribute_data[$i]; $post['property_data'] = $acc_property_data[$i]; $post['subproperty_data'] = $acc_subproperty_data[$i]; $result = $this->_carthelper->addProductToCart($post); $cart = $session->get('cart'); if (is_bool($result) && $result) { } else { $errmsg = $result ? $result : JText::_("COM_REDSHOP_PRODUCT_NOT_ADDED_TO_CART"); if (JError::isError(JError::getError())) { $error = JError::getError(); $errmsg = $error->message; } if (AJAX_CART_BOX == 1) { echo "`0`" . $errmsg; die; } else { $ItemData = $producthelper->getMenuInformation(0, 0, '', 'product&pid=' . $post['product_id']); if (count($ItemData) > 0) { $prdItemid = $ItemData->id; } else { $prdItemid = $redhelper->getItemid($post['product_id']); } $link = JRoute::_("index.php?option=" . $option . "&view=product&pid=" . $post["product_id"] . "&Itemid=" . $prdItemid, false); $app->Redirect($link, $errmsg); } } } } } if (!DEFAULT_QUOTATION_MODE || DEFAULT_QUOTATION_MODE && SHOW_QUOTATION_PRICE) { $this->_carthelper->carttodb(); } $this->_carthelper->cartFinalCalculation(); unset($cart['AccessoryAsProduct']); } else { if (!DEFAULT_QUOTATION_MODE || DEFAULT_QUOTATION_MODE && SHOW_QUOTATION_PRICE) { $this->_carthelper->carttodb(); } $this->_carthelper->cartFinalCalculation(); } if (!$userfiled) { if (AJAX_CART_BOX == 1 && isset($post['ajax_cart_box'])) { $link = JRoute::_('index.php?option=' . $option . '&view=cart&ajax_cart_box=' . $post['ajax_cart_box'] . '&tmpl=component&Itemid=' . $Itemid, false); $app->Redirect($link); } else { if (ADDTOCART_BEHAVIOUR == 1) { $link = JRoute::_('index.php?option=' . $option . '&view=cart&Itemid=' . $Itemid, false); $app->Redirect($link); } else { $link = JRoute::_($_SERVER['HTTP_REFERER'], false); if ($cart['notice_message'] != "") { $msg = $cart['notice_message'] . "<br>"; } $msg .= JTEXT::_('COM_REDSHOP_PRODUCT_ADDED_TO_CART'); $app->Redirect($link, $msg); } } } else { $link = JRoute::_('index.php?option=' . $option . '&view=product&pid=' . $post['p_id'] . '&Itemid=' . $Itemid, false); $app->Redirect($link); } }
} if ($show_readmore) { echo "<div class='mod_redshop_products_readmore'><a href='" . $link . "'>" . JText::_('COM_REDSHOP_TXT_READ_MORE') . "</a> </div>"; } if ($show_addtocart) { // Product attribute Start $attributes_set = array(); if ($row->attribute_set_id > 0) { $attributes_set = $producthelper->getProductAttribute(0, $row->attribute_set_id, 0, 1); } $attributes = $producthelper->getProductAttribute($row->product_id); $attributes = array_merge($attributes, $attributes_set); $totalatt = count($attributes); // Product attribute End // Product accessory Start $accessory = $producthelper->getProductAccessory(0, $row->product_id); $totalAccessory = count($accessory); // Product accessory End /* * collecting extra fields */ $count_no_user_field = 0; $hidden_userfield = ""; $userfieldArr = array(); if (AJAX_CART_BOX) { $ajax_detail_template_desc = ""; $ajax_detail_template = $producthelper->getAjaxDetailboxTemplate($row); if (count($ajax_detail_template) > 0) { $ajax_detail_template_desc = $ajax_detail_template->template_desc; } $returnArr = $producthelper->getProductUserfieldFromTemplate($ajax_detail_template_desc);
} else { $count_no_user_field = 0; } $childproduct = $producthelper->getChildProduct($this->data->product_id); if (count($childproduct) > 0 && PURCHASE_PARENT_WITH_CHILD == 0) { $isChilds = true; } else { $isChilds = false; } // Get attribute Template data // Product attribute Start $attributes_set = array(); if ($this->data->attribute_set_id > 0) { $attributes_set = $producthelper->getProductAttribute(0, $this->data->attribute_set_id, 0, 1); } $attribute_template = $producthelper->getAttributeTemplate($data_add); $attributes = $producthelper->getProductAttribute($this->data->product_id); $attributes = array_merge($attributes, $attributes_set); $totalatt = count($attributes); $data_add = $producthelper->replaceAttributeData($this->data->product_id, 0, $relatedprd_id, $attributes, $data_add, $attribute_template, $isChilds, $selectAtt); // Product attribute End // Product accessory Start ///////////////////////////////// $accessory = $producthelper->getProductAccessory(0, $this->data->product_id); $totalAccessory = count($accessory); $data_add = $producthelper->replaceAccessoryData($this->data->product_id, $relatedprd_id, $accessory, $data_add, $isChilds, $selectAcc); // Product accessory End ///////////////////////////////// // Cart $data_add = $producthelper->replaceCartTemplate($this->data->product_id, $this->data->category_id, 0, $relatedprd_id, $data_add, $isChilds, $userfieldArr, $totalatt, $totalAccessory, $count_no_user_field); $data_add = $data_add . "<input type='hidden' name='isAjaxBoxOpen' id='isAjaxBoxOpen' value='" . $layout . "' />"; echo eval("?>" . $data_add . "<?php "); }
public function display($tpl = null) { $redTemplate = new Redtemplate(); $product_category = new product_category(); $producthelper = new producthelper(); $option = JRequest::getVar('option'); $this->setLayout('default'); $uri = JFactory::getURI(); $model = $this->getModel('category_detail'); $categories = $model->getcategories(); JToolBarHelper::title(JText::_('COM_REDSHOP_CATEGORY_MANAGEMENT_DETAIL'), 'redshop_categories48'); $document = JFactory::getDocument(); $document->addScript('components/' . $option . '/assets/js/validation.js'); $document->addScript('components/' . $option . '/assets/js/fields.js'); $document->addScript('components/' . $option . '/assets/js/select_sort.js'); $document->addScript('components/' . $option . '/assets/js/json.js'); $document->addStyleSheet('components/com_redshop/assets/css/search.css'); $document->addScript('components/com_redshop/assets/js/search.js'); $document->addScript('components/com_redshop/assets/js/related.js'); $detail = $this->get('data'); $isNew = $detail->category_id < 1; // Assign default values for new categories if ($isNew) { $detail->append_to_global_seo = 'append'; $detail->canonical_url = ''; } $text = $isNew ? JText::_('COM_REDSHOP_NEW') : $detail->category_name . " - " . JText::_('COM_REDSHOP_EDIT'); JToolBarHelper::title(JText::_('COM_REDSHOP_CATEGORY') . ': <small><small>[ ' . $text . ' ]</small></small>', 'redshop_categories48'); JToolBarHelper::apply(); JToolBarHelper::save(); JToolBarHelper::save2new(); if ($isNew) { JToolBarHelper::cancel(); } else { JToolBarHelper::cancel('cancel', JText::_('JTOOLBAR_CLOSE')); } $lists = array(); /* * get total Template from configuration helper */ $templates = $redTemplate->getTemplate('category'); /* * multiple select box for * Front-End category Template Selector */ if (strstr($detail->category_more_template, ",")) { $category_more_template = explode(",", $detail->category_more_template); } else { $category_more_template = $detail->category_more_template; } $lists['category_more_template'] = JHTML::_('select.genericlist', $templates, 'category_more_template[]', 'class="inputbox" multiple="multiple" size="10" ', 'template_id', 'template_name', $category_more_template); $append_to_global_seo = array(); $append_to_global_seo[] = JHTML::_('select.option', 'append', JText::_('COM_REDSHOP_APPEND_TO_GLOBAL_SEO')); $append_to_global_seo[] = JHTML::_('select.option', 'prepend', JText::_('COM_REDSHOP_PREPEND_TO_GLOBAL_SEO')); $append_to_global_seo[] = JHTML::_('select.option', 'replace', JText::_('COM_REDSHOP_REPLACE_TO_GLOBAL_SEO')); $lists['append_to_global_seo'] = JHTML::_('select.genericlist', $append_to_global_seo, 'append_to_global_seo', 'class="inputbox" size="1" ', 'value', 'text', $detail->append_to_global_seo); // Merging select option in the select box $temps = array(); $temps[0] = new stdClass(); $temps[0]->template_id = 0; $temps[0]->template_name = JText::_('COM_REDSHOP_SELECT'); $templates = @array_merge($temps, $templates); $lists['category_template'] = JHTML::_('select.genericlist', $templates, 'category_template', 'class="inputbox" size="1" onchange="select_dynamic_field(this.value,\'' . $detail->category_id . '\',\'2\');" ', 'template_id', 'template_name', $detail->category_template); /* * class name product_category * from helper/category.php * get select box for select category parent Id */ $categories = $product_category->list_all("category_parent_id", $detail->category_id); $lists['categories'] = $categories; // Select box for ProductCompareTemplate $comparetemplate = $redTemplate->getTemplate('compare_product'); $temp = array(); $temp[0] = new stdClass(); $temp[0]->template_id = 0; $temp[0]->template_name = JText::_('COM_REDSHOP_SELECT'); $comparetemplate = @array_merge($temp, $comparetemplate); $lists['compare_template_id'] = JHTML::_('select.genericlist', $comparetemplate, 'compare_template_id', 'class="inputbox" size="1" ', 'template_id', 'template_name', $detail->compare_template_id); $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $detail->published); // Accessory of Category $categroy_accessory_product = array(); if ($detail->category_id) { $categroy_accessory_product = $producthelper->getProductAccessory(0, 0, 0, $detail->category_id); } $lists['categroy_accessory_product'] = $categroy_accessory_product; $this->lists = $lists; $this->detail = $detail; $this->request_url = $uri->toString(); parent::display($tpl); }
function display_products($rows) { $url = JURI::base(); $extraField = new extraField(); $session = JFactory::getSession(); $producthelper = new producthelper(); $redhelper = new redhelper(); $config = new Redconfiguration(); $redTemplate = new Redtemplate(); $template = $redTemplate->getTemplate("wishlist_template"); if (count($template) <= 0) { for ($i = 0; $i < count($rows); $i++) { $row = $rows[$i]; $Itemid = $redhelper->getItemid($row->product_id); $link = JRoute::_('index.php?option=com_redshop&view=product&pid=' . $row->product_id . '&Itemid=' . $Itemid); $product_price = $producthelper->getProductPrice($row->product_id); $product_price_discount = $producthelper->getProductNetPrice($row->product_id); echo "<div id='wishlist_box'>"; if ($row->product_full_image) { echo $thum_image = "<div class='wishlist_left'><div class='mod_wishlist_product_image wishlist_image'>" . ($thum_image = $producthelper->getProductImage($row->product_id, $link, "85", "63") . "</div></div>"); } else { $maindefaultpath = REDSHOP_FRONT_IMAGES_ABSPATH . "product/" . PRODUCT_DEFAULT_IMAGE; echo $thum_image = "<div class='wishlist_left'><div class='mod_wishlist_product_image wishlist_image'><a href='" . $link . "'><img src='" . $maindefaultpath . "' height='85' width='63' /></a></div></div>"; } echo "<div class='wishlist_center'><div class='wishlist_title'><a href='" . $link . "'>" . $row->product_name . "</a></div><br>"; if (!$row->not_for_sale) { if ($row->product_on_sale && $product_price_discount > 0) { if ($product_price > $product_price_discount) { $s_price = $product_price - $product_price_discount; if ($this->show_discountpricelayout) { echo "<div id='mod_redoldprice' class='mod_redoldprice'><span style='text-decoration:line-through;'>" . $producthelper->getProductFormattedPrice($product_price) . "</span></div>"; $product_price = $product_price_discount; echo "<div id='mod_redmainprice' class='mod_redmainprice wishlist_price'>" . $producthelper->getProductFormattedPrice($product_price_discount) . "</div>"; echo "<div id='mod_redsavedprice' class='mod_redsavedprice'>" . JText::_('COM_REDSHOP_PRODCUT_PRICE_YOU_SAVED') . ' ' . $producthelper->getProductFormattedPrice($s_price) . "</div>"; } else { $product_price = $product_price_discount; echo "<div class='mod_redproducts_price wishlist_price'>" . $producthelper->getProductFormattedPrice($product_price) . "</div>"; } } else { echo "<div class='mod_redproducts_price wishlist_price'>" . $producthelper->getProductFormattedPrice($product_price) . "</div>"; } } else { echo "<div class='mod_redproducts_price wishlist_price'>" . $producthelper->getProductFormattedPrice($product_price) . "</div>"; } } echo "<br><div class='wishlist_readmore'><a href='" . $link . "'>" . JText::_('COM_REDSHOP_READ_MORE') . "</a></div> </div> "; $addtocartdata = $producthelper->replaceCartTemplate($row->product_id, 0, 0, $row->product_id); echo "<div class='wishlist_right'>" . $addtocartdata . "</div><br class='clear' /></div><br class='clear' />"; } } else { $ph_thumb = CATEGORY_PRODUCT_THUMB_HEIGHT; $pw_thumb = CATEGORY_PRODUCT_THUMB_WIDTH; $wishlist_data1 = $template[0]->template_desc; $mlink = JURI::root() . "index.php?option=com_redshop&view=account&layout=mywishlist&mail=1&tmpl=component&wishlist_id=" . $wishlist_id; $mail_link = '<a class="redcolorproductimg" href="' . $mlink . '" ><img src="' . REDSHOP_ADMIN_IMAGES_ABSPATH . 'mailcenter16.png" ></a>'; $wishlist_data1 = str_replace('{mail_link}', $mail_link, $wishlist_data1); $template_d1 = explode("{product_loop_start}", $wishlist_data1); $template_d2 = explode("{product_loop_end}", $template_d1[1]); $temp_template = ''; $extraFieldName = $extraField->getSectionFieldNameArray(1, 1, 1); for ($i = 0; $i < count($rows); $i++) { $row = $rows[$i]; $wishlist_data = $template_d2[0]; $Itemid = $redhelper->getItemid($rows[$i]->product_id); $link = JRoute::_('index.php?option=com_redshop&view=product&pid=' . $rows[$i]->product_id . '&Itemid=' . $Itemid); $product_price = $producthelper->getProductPrice($row->product_id); $product_price_discount = $producthelper->getProductNetPrice($row->product_id); if ($row->product_full_image) { $thum_image = $producthelper->getProductImage($row->product_id, $link, $pw_thumb, $ph_thumb); $wishlist_data = str_replace('{product_thumb_image}', $thum_image, $wishlist_data); } else { $maindefaultpath = RedShopHelperImages::getImagePath(PRODUCT_DEFAULT_IMAGE, '', 'thumb', 'product', $pw_thumb, $ph_thumb, USE_IMAGE_SIZE_SWAPPING); $thum_image = "<a href='" . $link . "'><img src='" . $maindefaultpath . "' /></a>"; $wishlist_data = str_replace('{product_thumb_image}', $thum_image, $wishlist_data); } $pname = "<a href='" . $link . "'>" . $row->product_name . "</a>"; $pnumber = $row->product_number; $pdesc = $row->product_s_desc; // Checking for child products start if (strstr($wishlist_data, "{child_products}")) { $parentproductid = $row->product_id; if ($this->data->product_parent_id != 0) { $parentproductid = $producthelper->getMainParentProduct($row->product_id); } $frmChild = ""; if ($parentproductid != 0) { $productInfo = $producthelper->getProductById($parentproductid); // Get child products $childproducts = $model->getAllChildProductArrayList(0, $parentproductid); if (count($childproducts) > 0) { $childproducts = array_merge(array($productInfo), $childproducts); $cld_name = array(); if (count($childproducts) > 0) { $parentid = 0; for ($c = 0; $c < count($childproducts); $c++) { if ($childproducts[$c]->product_parent_id == 0) { $level = ""; } else { if ($parentid != $childproducts[$c]->product_parent_id) { $level = $level; } } $parentid = $childproducts[$c]->product_parent_id; $childproducts[$c]->product_name = $level . $childproducts[$c]->product_name; } $cld_name = @array_merge($cld_name, $childproducts); } $selected = array($row->product_id); $lists['product_child_id'] = JHTML::_('select.genericlist', $cld_name, 'pid', 'class="inputbox" size="1" onchange="document.frmChild.submit();"', 'product_id', 'product_name', $selected); $frmChild .= "<form name='frmChild' method='get'>"; $frmChild .= JText::_('COM_REDSHOP_CHILD_PRODUCTS') . $lists['product_child_id']; $frmChild .= "<input type='hidden' name='Itemid' value='" . $Itemid . "'>"; $frmChild .= "<input type='hidden' name='cid' value='" . $row->category_id . "'>"; $frmChild .= "<input type='hidden' name='view' value='product'>"; $frmChild .= "<input type='hidden' name='option' value='com_redshop'>"; $frmChild .= "</form>"; } } $wishlist_data = str_replace("{child_products}", $frmChild, $wishlist_data); } $childproduct = $producthelper->getChildProduct($row->product_id); if (count($childproduct) > 0) { if (PURCHASE_PARENT_WITH_CHILD == 1) { $isChilds = false; $attributes_set = array(); if ($row->attribute_set_id > 0) { $attributes_set = $producthelper->getProductAttribute(0, $row->attribute_set_id, 0, 1); } $attributes = $producthelper->getProductAttribute($row->product_id); $attributes = array_merge($attributes, $wishlist_data); } else { $isChilds = true; $attributes = array(); } } else { $isChilds = false; $attributes_set = array(); if ($row->attribute_set_id > 0) { $attributes_set = $producthelper->getProductAttribute(0, $row->attribute_set_id, 0, 1); } $attributes = $producthelper->getProductAttribute($row->product_id); $attributes = array_merge($attributes, $attributes_set); } $attribute_template = $producthelper->getAttributeTemplate($wishlist_data); // Check product for not for sale $wishlist_data = $producthelper->getProductNotForSaleComment($row, $wishlist_data, $attributes); $wishlist_data = $producthelper->replaceProductInStock($row->product_id, $wishlist_data, $attributes, $attribute_template); /////////////////////////////////// Product attribute Start ///////////////////////////////// $totalatt = count($attributes); $wishlist_data = $producthelper->replaceAttributeData($row->product_id, 0, 0, $attributes, $wishlist_data, $attribute_template, $isChilds); /////////////////////////////////// Product attribute End // Checking for child products end///////////////////////////////// if (!$row->not_for_sale) { if ($row->product_on_sale && $product_price_discount > 0) { if ($product_price > $product_price_discount) { $s_price = $product_price - $product_price_discount; if ($this->show_discountpricelayout) { $mainproduct_price = $producthelper->getProductFormattedPrice($product_price); $product_price = $product_price_discount; $mainproduct_price = $producthelper->getProductFormattedPrice($product_price_discount); } else { $product_price = $product_price_discount; $mainproduct_price = $producthelper->getProductFormattedPrice($product_price); } } else { $mainproduct_price = $producthelper->getProductFormattedPrice($product_price); } } else { $mainproduct_price = $producthelper->getProductFormattedPrice($product_price); } $wishlist_data = str_replace('{product_price}', $mainproduct_price, $wishlist_data); } // Product User Field Start $count_no_user_field = 0; $returnArr = $producthelper->getProductUserfieldFromTemplate($wishlist_data); $template_userfield = $returnArr[0]; $userfieldArr = $returnArr[1]; if (strstr($wishlist_data, "{if product_userfield}") && strstr($wishlist_data, "{product_userfield end if}") && $template_userfield != "") { $ufield = ""; $cart = $session->get('cart'); if (isset($cart['idx'])) { $idx = (int) $cart['idx']; } $idx = 0; $cart_id = ''; for ($j = 0; $j < $idx; $j++) { if ($cart[$j]['product_id'] == $row->product_id) { $cart_id = $j; } } for ($ui = 0; $ui < count($userfieldArr); $ui++) { if (!$idx) { $cart_id = ""; } $mysesspro = "productuserfield_" . $ui; for ($check_i = 1; $check_i <= $_SESSION["no_of_prod"]; $check_i++) { if ($_SESSION['wish_' . $check_i]->product_id == $row->product_id) { $product_userfileds_final = $_SESSION['wish_' . $check_i]->{$mysesspro}; } } if ($product_userfileds_final != '') { $product_userfileds = $extraField->list_all_user_fields($userfieldArr[$ui], 12, '', '', 0, $row->product_id, $product_userfileds_final, 1); } else { $product_userfileds = $extraField->list_all_user_fields($userfieldArr[$ui], 12, '', $cart_id, 0, $row->product_id); } $ufield .= $product_userfileds[1]; // if ($product_userfileds[1] != "") { $count_no_user_field++; } if ($product_userfileds_final != '') { $wishlist_data = str_replace('{' . $userfieldArr[$ui] . '_lbl}', $product_userfileds[0], $wishlist_data); $wishlist_data = str_replace('{' . $userfieldArr[$ui] . '}', $product_userfileds[1], $wishlist_data); } else { $wishlist_data = str_replace('{' . $userfieldArr[$ui] . '_lbl}', $product_userfileds[0], $wishlist_data); $wishlist_data = str_replace('{' . $userfieldArr[$ui] . '}', $product_userfileds[1], $wishlist_data); } } $product_userfileds_form = "<form method='post' action='' id='user_fields_form' name='user_fields_form'>"; if ($ufield != "") { $wishlist_data = str_replace("{if product_userfield}", $product_userfileds_form, $wishlist_data); $wishlist_data = str_replace("{product_userfield end if}", "</form>", $wishlist_data); } else { $wishlist_data = str_replace("{if product_userfield}", "", $wishlist_data); $wishlist_data = str_replace("{product_userfield end if}", "", $wishlist_data); } } // Product User Field End /////////////////////////////////// Product accessory Start ///////////////////////////////// $accessory = $producthelper->getProductAccessory(0, $row->product_id); $totalAccessory = count($accessory); $wishlist_data = $producthelper->replaceAccessoryData($row->product_id, 0, $accessory, $wishlist_data, $isChilds); /////////////////////////////////// Product accessory End ///////////////////////////////// $wishlist_data = str_replace('{product_name}', $pname, $wishlist_data); $wishlist_data = str_replace('{product_number}', $pnumber, $wishlist_data); $wishlist_data = str_replace('{product_s_desc}', $pdesc, $wishlist_data); $wishlist_data = $producthelper->getExtraSectionTag($extraFieldName, $row->product_id, "1", $wishlist_data, 1); $wishlist_data = $producthelper->replaceCartTemplate($row->product_id, $row->category_id, 0, 0, $wishlist_data, $isChilds, $userfieldArr, $totalatt, $totalAccessory, $count_no_user_field); $rmore = "<a href='" . $link . "' title='" . $row->product_name . "'>" . JText::_('COM_REDSHOP_READ_MORE') . "</a>"; $wishlist_data = str_replace("{read_more}", $rmore, $wishlist_data); $wishlist_data = str_replace("{read_more_link}", $link, $wishlist_data); $wishlist_data = str_replace("{product_loop_start}", '', $wishlist_data); $wishlist_data = str_replace("{product_loop_end}", '', $wishlist_data); $wishlist_data = str_replace("{back_link}", '', $wishlist_data); $wishlist_data = str_replace("{back_link}", '', $wishlist_data); $wishlist_data = str_replace("{mail_link}", '', $wishlist_data); $wishlist_data = str_replace("{if product_on_sale}", '', $wishlist_data); $wishlist_data = str_replace("{product_on_sale end if}", '', $wishlist_data); $wishlist_data = str_replace("<table></table>", '', $wishlist_data); $wishlist_data = str_replace("{all_cart}", '', $wishlist_data); $wishlist_data = str_replace("{if product_on_sale}", "", $wishlist_data); $wishlist_data = str_replace("{product_on_sale end if}", "", $wishlist_data); $regdellink = JRoute::_("index.php?mydel=1&view=wishlist&wishlist_id=" . $row->product_id . "&task=mysessdelwishlist"); $mainregdellink = "<div><a href=\"" . $regdellink . "\">" . JText::_('COM_REDSHOP_REMOVE_PRODUCT_FROM_WISHLIST') . "</a></div>"; $wishlist_data = str_replace('{remove_product_link}', $mainregdellink, $wishlist_data); $mainid .= $row->product_id . ","; $totattid .= $totalatt . ","; $totcount_no_user_field .= $count_no_user_field . ","; $temp_template .= $wishlist_data; } $my = "<form name='frm' method='POST' action=''>"; $my .= "<input type='hidden' name='product_id' id='product_id' value='" . $mainid . "' >\n\n\t\t\t<input type='hidden' name='totacc_id' id='totacc_id' value='" . $totattid . "' >\n\t\t\t<input type='hidden' name='totcount_no_user_field' id='totcount_no_user_field' value='" . $totcount_no_user_field . "' >\n\t\t\t<input type='button' name='submit' onclick='return productalladdprice();' value='" . JText::_('COM_REDSHOP_ADD_TO_CART') . "'>\n\t\t\t</form>"; $data = $template_d1[0] . $temp_template . $template_d2[1]; $data = str_replace('{back_link}', '', $data); $data = str_replace('{all_cart}', $my, $data); $data = $redTemplate->parseredSHOPplugin($data); echo eval("?>" . $data . "<?php "); } }