/** * Display Product add price * * @return void */ public function displayProductaddprice() { ob_clean(); $get = JRequest::get('get'); $producthelper = new producthelper(); $carthelper = new rsCarthelper(); $total_attribute = 0; $product_id = $get['product_id']; $quantity = $get['qunatity']; $data = array(); $data['attribute_data'] = str_replace("::", "##", $get['attribute_data']); $data['property_data'] = str_replace("::", "##", $get['property_data']); $data['subproperty_data'] = str_replace("::", "##", $get['subproperty_data']); $data['accessory_data'] = $get['accessory_data']; $data['acc_quantity_data'] = $get['acc_quantity_data']; $data['acc_attribute_data'] = str_replace("::", "##", $get['acc_attribute_data']); $data['acc_property_data'] = str_replace("::", "##", $get['acc_property_data']); $data['acc_subproperty_data'] = str_replace("::", "##", $get['acc_subproperty_data']); $data['quantity'] = $quantity; $cartdata = $carthelper->generateAttributeArray($data); $retAttArr = $producthelper->makeAttributeCart($cartdata, $product_id, 0, '', $quantity); $ProductPriceArr = $producthelper->getProductNetPrice($product_id, 0, $quantity); $acccartdata = $carthelper->generateAccessoryArray($data); $retAccArr = $producthelper->makeAccessoryCart($acccartdata, $product_id); $accessory_price = $retAccArr[1]; $accessory_vat = $retAccArr[2]; $product_price = ($retAttArr[1] + $retAttArr[2]) * $quantity + $accessory_price + $accessory_vat; $product_main_price = ($retAttArr[1] + $retAttArr[2]) * $quantity + $accessory_price + $accessory_vat; $product_old_price = $ProductPriceArr['product_old_price'] * $quantity; $product_price_saving = $ProductPriceArr['product_price_saving'] * $quantity; $product_discount_price = $ProductPriceArr['product_discount_price'] * $quantity; $product_price_novat = $retAttArr[1] * $quantity + $accessory_price; $product_price_incl_vat = $ProductPriceArr['product_price_incl_vat'] * $quantity + $accessory_price + $accessory_vat; $price_excluding_vat = $retAttArr[1] * $quantity + $accessory_price; $seoProductPrice = $ProductPriceArr['seoProductPrice'] * $quantity; $seoProductSavingPrice = $ProductPriceArr['seoProductSavingPrice'] * $quantity; echo $product_price . ":" . $product_main_price . ":" . $product_old_price . ":" . $product_price_saving . ":" . $product_discount_price . ":" . $product_price_novat . ":" . $product_price_incl_vat . ":" . $price_excluding_vat . ":" . $seoProductPrice . ":" . $seoProductSavingPrice; exit; }
function display_products($rows) { $url = JURI::base(); $extra_data = new producthelper(); $producthelper = new producthelper(); for ($i = 0; $i < count($rows); $i++) { $row = $rows[$i]; $Itemid = $this->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); $productArr = $producthelper->getProductNetPrice($row->product_id); $product_price_discount = $productArr['productPrice'] + $productArr['productVat']; if ($row->product_full_image) { echo $thum_image = "<div class='mod_wishlist_product_image' >" . ($thum_image = $producthelper->getProductImage($row->product_id, $link, "100", "100") . "\n\t\t\t</div>"); } echo "<a href='" . $link . "'>" . $row->product_name . "</a><br>"; 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'>" . $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'>" . $producthelper->getProductFormattedPrice($product_price) . "</div>"; } } else { echo "<div class='mod_redproducts_price'>" . $producthelper->getProductFormattedPrice($product_price) . "</div>"; } } else { echo "<div class='mod_redproducts_price'>" . $producthelper->getProductFormattedPrice($product_price) . "</div>"; } echo "<br><a href='" . $link . "'>" . JText::_('COM_REDSHOP_READ_MORE') . "</a> "; echo $addtocartdata = $producthelper->replaceCartTemplate($row->product_id); echo "<div>" . $addtocartdata . "</div>"; } }
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; }
/** * 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); }
$productInfo = $producthelper->getProductById($row->product_id); if ($image) { $thumb = $productInfo->product_full_image; if (WATERMARK_PRODUCT_IMAGE) { $thum_image = $redhelper->watermark('product', $thumb, $thumbwidth, $thumbheight, WATERMARK_PRODUCT_THUMB_IMAGE, '0'); echo "<div class='mod_redshop_products_image'><img src=" . $thum_image . "></div>"; } else { $thum_image = RedShopHelperImages::getImagePath($thumb, '', 'thumb', 'product', $thumbwidth, $thumbheight, USE_IMAGE_SIZE_SWAPPING); echo "<div class='mod_redshop_products_image'><a href='" . $link . "' title='{$row->product_name}'><img src=" . $thum_image . "></a></div>"; } } if (!empty($stock_status)) { echo $stock_status; } if (!$row->not_for_sale && $show_price) { $productArr = $producthelper->getProductNetPrice($row->product_id); if ($show_vat != '0') { $product_price = $productArr['product_old_price']; $product_price_discount = $productArr['productPrice'] + $productArr['productVat']; } else { $product_price = $productArr['product_old_price_excl_vat']; $product_price_discount = $productArr['productPrice']; } if (SHOW_PRICE && (!DEFAULT_QUOTATION_MODE || DEFAULT_QUOTATION_MODE && SHOW_QUOTATION_PRICE)) { if (!$product_price) { $product_price_dis = $producthelper->getPriceReplacement($product_price); } else { $product_price_dis = $producthelper->getProductFormattedPrice($product_price); } $disply_text = "<div class='mod_redshop_price'><div class='mod_redshop_products_price'>" . $product_price_dis . "</div>"; if ($row->product_on_sale && $product_price_discount > 0) {
$h_thumb = THUMB_HEIGHT; $w_thumb = THUMB_WIDTH; } $temp_template = ''; $extraFieldName = $extraField->getSectionFieldNameArray(1, 1, 1); if (count($MyWishlist) > 0) { $mainid = null; $totattid = null; $totcount_no_user_field = null; foreach ($MyWishlist as $row) { $wishlistuserfielddata = $producthelper->getwishlistuserfieldata($row->wishlist_id, $row->product_id); $link = JRoute::_('index.php?option=com_redshop&view=product&pid=' . $row->product_id . '&Itemid=' . $Itemid); $link_remove = JRoute::_('index.php?option=com_redshop&view=account&layout=mywishlist&wishlist_id=' . $wishlist_id . '&pid=' . $row->product_id . '&remove=1&Itemid=' . $Itemid); $thum_image = $producthelper->getProductImage($row->product_id, $link, $w_thumb, $h_thumb); $product_price = $producthelper->getProductPrice($row->product_id); $product_price_discount = $producthelper->getProductNetPrice($row->product_id); $pname = "<a href='" . $link . "' >" . $row->product_name . "</a>"; $wishlist_data = str_replace($tag, $thum_image, $wishlist_desc); $wishlist_data = str_replace('{product_number}', $row->product_number, $wishlist_data); $wishlist_data = str_replace('{product_name}', $pname, $wishlist_data); /*if($product_price > $product_price_discount) { $wishlist_data = str_replace('{product_price}', $producthelper->getProductFormattedPrice($product_price_discount) , $wishlist_data); }else{ $wishlist_data = str_replace('{product_price}', $producthelper->getProductFormattedPrice($product_price) , $wishlist_data); }*/ $wishlist_data = str_replace('{product_s_desc}', $row->product_s_desc, $wishlist_data); // Checking for child products start if (strstr($wishlist_data, "{child_products}")) { $parentproductid = $row->product_id; if ($this->data->product_parent_id != 0) {
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 "); } }