Ejemplo n.º 1
0
 public function displayAdditionalImage($product_id = 0, $accessory_id = 0, $relatedprd_id = 0, $property_id = 0, $subproperty_id = 0, $main_imgwidth = 0, $main_imgheight = 0, $redview = "", $redlayout = "")
 {
     $redshopconfig = new Redconfiguration();
     $redTemplate = new Redtemplate();
     $stockroomhelper = new rsstockroomhelper();
     $url = JURI::base();
     $option = JRequest::getVar('option');
     $redhelper = new redhelper();
     if ($accessory_id != 0) {
         $accessory = $this->getProductAccessory($accessory_id);
         $product_id = $accessory[0]->child_product_id;
     }
     $product = $this->getProductById($product_id);
     $producttemplate = $redTemplate->getTemplate("product", $product->product_template);
     // Get template for stockroom status
     if ($accessory_id != 0) {
         $template_desc = $redTemplate->getTemplate("accessory_product");
         $template_desc = $template_desc[0]->template_desc;
     } elseif ($relatedprd_id != 0) {
         $template_desc = $redTemplate->getTemplate("related_product");
         $template_desc = $template_desc[0]->template_desc;
     } else {
         $template_desc = $producttemplate[0]->template_desc;
     }
     $producttemplate = $producttemplate[0]->template_desc;
     if ($redlayout == 'categoryproduct' || $redlayout == 'detail') {
         if (strstr($producttemplate, "{product_thumb_image_3}")) {
             $pimg_tag = '{product_thumb_image_3}';
             $ph_thumb = CATEGORY_PRODUCT_THUMB_HEIGHT_3;
             $pw_thumb = CATEGORY_PRODUCT_THUMB_WIDTH_3;
         } elseif (strstr($producttemplate, "{product_thumb_image_2}")) {
             $pimg_tag = '{product_thumb_image_2}';
             $ph_thumb = CATEGORY_PRODUCT_THUMB_HEIGHT_2;
             $pw_thumb = CATEGORY_PRODUCT_THUMB_WIDTH_2;
         } elseif (strstr($producttemplate, "{product_thumb_image_1}")) {
             $pimg_tag = '{product_thumb_image_1}';
             $ph_thumb = CATEGORY_PRODUCT_THUMB_HEIGHT;
             $pw_thumb = CATEGORY_PRODUCT_THUMB_WIDTH;
         } else {
             $pimg_tag = '{product_thumb_image}';
             $ph_thumb = CATEGORY_PRODUCT_THUMB_HEIGHT;
             $pw_thumb = CATEGORY_PRODUCT_THUMB_WIDTH;
         }
     } else {
         if (strstr($producttemplate, "{product_thumb_image_3}")) {
             $pimg_tag = '{product_thumb_image_3}';
             $ph_thumb = PRODUCT_MAIN_IMAGE_HEIGHT_3;
             $pw_thumb = PRODUCT_MAIN_IMAGE_3;
         } elseif (strstr($producttemplate, "{product_thumb_image_2}")) {
             $pimg_tag = '{product_thumb_image_2}';
             $ph_thumb = PRODUCT_MAIN_IMAGE_HEIGHT_2;
             $pw_thumb = PRODUCT_MAIN_IMAGE_2;
         } elseif (strstr($producttemplate, "{product_thumb_image_1}")) {
             $pimg_tag = '{product_thumb_image_1}';
             $ph_thumb = PRODUCT_MAIN_IMAGE_HEIGHT;
             $pw_thumb = PRODUCT_MAIN_IMAGE;
         } else {
             $pimg_tag = '{product_thumb_image}';
             $ph_thumb = PRODUCT_MAIN_IMAGE_HEIGHT;
             $pw_thumb = PRODUCT_MAIN_IMAGE;
         }
     }
     if (strstr($producttemplate, "{more_images_3}")) {
         $mph_thumb = PRODUCT_ADDITIONAL_IMAGE_HEIGHT_3;
         $mpw_thumb = PRODUCT_ADDITIONAL_IMAGE_3;
     } elseif (strstr($producttemplate, "{more_images_2}")) {
         $mph_thumb = PRODUCT_ADDITIONAL_IMAGE_HEIGHT_2;
         $mpw_thumb = PRODUCT_ADDITIONAL_IMAGE_2;
     } elseif (strstr($producttemplate, "{more_images_1}")) {
         $mph_thumb = PRODUCT_ADDITIONAL_IMAGE_HEIGHT;
         $mpw_thumb = PRODUCT_ADDITIONAL_IMAGE;
     } else {
         $mph_thumb = PRODUCT_ADDITIONAL_IMAGE_HEIGHT;
         $mpw_thumb = PRODUCT_ADDITIONAL_IMAGE;
     }
     if ($main_imgwidth != 0 || $main_imgheight != 0) {
         $pw_thumb = $main_imgwidth;
         $ph_thumb = $main_imgheight;
     }
     $ImageAttributes = $this->getdisplaymainImage($product_id, $property_id, $subproperty_id, $pw_thumb, $ph_thumb, $redview);
     $aHrefImageResponse = $ImageAttributes['aHrefImageResponse'];
     $mainImageResponse = $ImageAttributes['mainImageResponse'];
     $productmainimg = $ImageAttributes['productmainimg'];
     $aTitleImageResponse = $ImageAttributes['aTitleImageResponse'];
     $imagename = $ImageAttributes['imagename'];
     //		$ImageAttributes['type']		= $type;
     $attrbimg = $ImageAttributes['attrbimg'];
     $pr_number = $ImageAttributes['pr_number'];
     //$view				= $ImageAttributes['view'];
     $prodadditionImg = "";
     $propadditionImg = "";
     $subpropadditionImg = "";
     $product_availability_date_lbl = '';
     $product_availability_date = '';
     $media_image = $this->getAdditionMediaImage($product_id, "product");
     $tmp_prodimg = "";
     $val_prodadd = count($media_image);
     for ($m = 0; $m < count($media_image); $m++) {
         $thumb = $media_image[$m]->media_name;
         $alttext = $this->getAltText('product', $media_image[$m]->section_id, '', $media_image[$m]->media_id);
         if (!$alttext) {
             $alttext = $media_image[$m]->media_name;
         }
         if ($thumb && $thumb != $media_image[$m]->product_full_image && is_file(REDSHOP_FRONT_IMAGES_RELPATH . "product/" . $thumb)) {
             if (WATERMARK_PRODUCT_ADDITIONAL_IMAGE) {
                 $pimg = $redhelper->watermark('product', $thumb, $mpw_thumb, $mph_thumb, WATERMARK_PRODUCT_ADDITIONAL_IMAGE, "1");
                 $linkimage = $redhelper->watermark('product', $thumb, '', '', WATERMARK_PRODUCT_ADDITIONAL_IMAGE, "0");
                 $hoverimg_path = $redhelper->watermark('product', $thumb, ADDITIONAL_HOVER_IMAGE_WIDTH, ADDITIONAL_HOVER_IMAGE_HEIGHT, WATERMARK_PRODUCT_ADDITIONAL_IMAGE, '2');
             } else {
                 $pimg = RedShopHelperImages::getImagePath($thumb, '', 'thumb', 'product', $mpw_thumb, $mph_thumb, USE_IMAGE_SIZE_SWAPPING);
                 $linkimage = REDSHOP_FRONT_IMAGES_ABSPATH . "product/" . $thumb;
                 $hoverimg_path = RedShopHelperImages::getImagePath($thumb, '', 'thumb', 'product', ADDITIONAL_HOVER_IMAGE_WIDTH, ADDITIONAL_HOVER_IMAGE_HEIGHT, USE_IMAGE_SIZE_SWAPPING);
             }
             if (PRODUCT_ADDIMG_IS_LIGHTBOX) {
                 $prodadditionImg_div_start = "<div class='additional_image'><a href='" . $linkimage . "' title='" . $alttext . "'  rel=\"myallimg\">";
                 $prodadditionImg_div_end = "</a></div>";
                 $prodadditionImg .= $prodadditionImg_div_start;
                 $prodadditionImg .= "<img src='" . $pimg . "' alt='" . $alttext . "' title='" . $alttext . "'>";
                 $producthrefend = "";
             } else {
                 if (WATERMARK_PRODUCT_ADDITIONAL_IMAGE) {
                     $img_path = $redhelper->watermark('product', $thumb, $pw_thumb, $ph_thumb, WATERMARK_PRODUCT_ADDITIONAL_IMAGE, '0');
                 } else {
                     $img_path = RedShopHelperImages::getImagePath($thumb, '', 'thumb', 'product', $pw_thumb, $ph_thumb, USE_IMAGE_SIZE_SWAPPING);
                 }
                 $filename_thumb = REDSHOP_FRONT_IMAGES_RELPATH . "product/" . $product->product_thumb_image;
                 $filename_org = REDSHOP_FRONT_IMAGES_RELPATH . "product/" . $media_image[$m]->product_full_image;
                 if (is_file($filename_thumb)) {
                     $thumb_original = $product->product_thumb_image;
                 } elseif (is_file($filename_org)) {
                     $thumb_original = $media_image[$m]->product_full_image;
                 } else {
                     $thumb_original = PRODUCT_DEFAULT_IMAGE;
                 }
                 if (WATERMARK_PRODUCT_THUMB_IMAGE) {
                     $img_path_org = $redhelper->watermark('product', $thumb_original, $pw_thumb, $ph_thumb, WATERMARK_PRODUCT_THUMB_IMAGE, '0');
                 } else {
                     $img_path_org = RedShopHelperImages::getImagePath($thumb_original, '', 'thumb', 'product', $pw_thumb, $ph_thumb, USE_IMAGE_SIZE_SWAPPING);
                 }
                 $prodadditionImg_div_start = "<div class='additional_image' onmouseover='display_image_add(\"" . $img_path . "\"," . $product_id . ");' onmouseout='display_image_add_out(\"" . $img_path_org . "\"," . $product_id . ");'>";
                 $prodadditionImg_div_end = "</div>";
                 $prodadditionImg .= $prodadditionImg_div_start;
                 $prodadditionImg .= '<a href="javascript:void(0)" >' . "<img src='" . $pimg . "' alt='" . $alttext . "' title='" . $alttext . "' style='cursor: auto;'>";
                 $producthrefend = "</a>";
             }
             if (ADDITIONAL_HOVER_IMAGE_ENABLE) {
                 $prodadditionImg .= "<img src='" . $hoverimg_path . "' alt='" . $alttext . "' title='" . $alttext . "' class='redImagepreview'>";
             }
             $prodadditionImg .= $producthrefend;
             $prodadditionImg .= $prodadditionImg_div_end;
             $tmp_prodimg = $prodadditionImg;
         }
     }
     if ($val_prodadd == 0) {
         $prodadditionImg = " ";
         $propadditionImg = " ";
     }
     if ($property_id > 0) {
         $media_image = $this->getAdditionMediaImage($property_id, "property");
         if (count($media_image) == 0) {
             $propadditionImg = $tmp_prodimg;
         } else {
             for ($m = 0; $m < count($media_image); $m++) {
                 $thumb = $media_image[$m]->media_name;
                 $alttext = $this->getAltText('property', $media_image[$m]->section_id, '', $media_image[$m]->media_id);
                 if (!$alttext) {
                     $alttext = $thumb;
                 }
                 if ($thumb && $thumb != $media_image[$m]->property_main_image && is_file(REDSHOP_FRONT_IMAGES_RELPATH . "property/" . $thumb)) {
                     if (PRODUCT_ADDIMG_IS_LIGHTBOX) {
                         $thumbUrl = RedShopHelperImages::getImagePath($thumb, '', 'thumb', 'property', $mpw_thumb, $mph_thumb, USE_IMAGE_SIZE_SWAPPING);
                         $propadditionImg_div_start = "<div class='additional_image'><a href='" . REDSHOP_FRONT_IMAGES_ABSPATH . "property/" . $thumb . "' title='" . $alttext . "' rel=\"myallimg\">";
                         $propadditionImg_div_end = "</a></div>";
                         $propadditionImg .= $propadditionImg_div_start;
                         $propadditionImg .= "<img src='" . $thumbUrl . "' alt='" . $alttext . "' title='" . $alttext . "'>";
                         $prophrefend = "";
                     } else {
                         $imgs_path = RedShopHelperImages::getImagePath($thumb, '', 'thumb', 'property', $pw_thumb, $ph_thumb, USE_IMAGE_SIZE_SWAPPING);
                         $property_filename_org = REDSHOP_FRONT_IMAGES_RELPATH . "property/" . $imagename;
                         if (is_file($property_filename_org)) {
                             $property_thumb_original = $imagename;
                             $property_img_path_org = RedShopHelperImages::getImagePath($property_thumb_original, '', 'thumb', 'property', $pw_thumb, $ph_thumb, USE_IMAGE_SIZE_SWAPPING);
                         } else {
                             $property_thumb_original = $thumb_original;
                             $property_img_path_org = RedShopHelperImages::getImagePath($property_thumb_original, '', 'thumb', 'product', $pw_thumb, $ph_thumb, USE_IMAGE_SIZE_SWAPPING);
                         }
                         $propadditionImg_div_start = "<div class='additional_image' onmouseover='display_image_add(\"" . $imgs_path . "\"," . $product_id . ");' onmouseout='display_image_add_out(\"" . $property_img_path_org . "\"," . $product_id . ");'>";
                         $propadditionImg_div_end = "</div>";
                         $thumbUrl = RedShopHelperImages::getImagePath($thumb, '', 'thumb', 'property', $mpw_thumb, $mph_thumb, USE_IMAGE_SIZE_SWAPPING);
                         $propadditionImg .= $propadditionImg_div_start;
                         $propadditionImg .= "<a href='javascript:void(0)'>" . "<img src='" . $thumbUrl . "' alt='" . $alttext . "' title='" . $alttext . "' style='cursor: auto;'>";
                         $prophrefend = "</a>";
                     }
                     if (ADDITIONAL_HOVER_IMAGE_ENABLE) {
                         $thumbUrl = RedShopHelperImages::getImagePath($thumb, '', 'thumb', 'property', ADDITIONAL_HOVER_IMAGE_WIDTH, ADDITIONAL_HOVER_IMAGE_HEIGHT, USE_IMAGE_SIZE_SWAPPING);
                         $propadditionImg .= "<img src='" . $thumbUrl . "' alt='" . $alttext . "' title='" . $alttext . "' class='redImagepreview'>";
                     }
                     $propadditionImg .= $prophrefend;
                     $propadditionImg .= $propadditionImg_div_end;
                 }
             }
         }
     }
     if ($subproperty_id > 0) {
         //Display Sub-Property Number
         $media_image = $this->getAdditionMediaImage($subproperty_id, "subproperty");
         for ($m = 0; $m < count($media_image); $m++) {
             $thumb = $media_image[$m]->media_name;
             $alttext = $this->getAltText('subproperty', $media_image[$m]->section_id, '', $media_image[$m]->media_id);
             if (!$alttext) {
                 $alttext = $thumb;
             }
             $filedir = is_file(REDSHOP_FRONT_IMAGES_RELPATH . "subproperty/" . $thumb) ? 'subproperty' : 'property';
             if ($thumb && $thumb != $media_image[$m]->subattribute_color_main_image && is_file(REDSHOP_FRONT_IMAGES_RELPATH . $filedir . "/" . $thumb)) {
                 if (PRODUCT_ADDIMG_IS_LIGHTBOX) {
                     $subpropadditionImg_div_start = "<div class='additional_image'><a href='" . REDSHOP_FRONT_IMAGES_ABSPATH . $filedir . "/" . $thumb . "' title='" . $alttext . "' rel=\"myallimg\">";
                     $subpropadditionImg_div_end = "</a></div>";
                     $thumbUrl = RedShopHelperImages::getImagePath($thumb, '', 'thumb', $filedir, $mpw_thumb, $mph_thumb, USE_IMAGE_SIZE_SWAPPING);
                     $subpropadditionImg .= $subpropadditionImg_div_start;
                     $subpropadditionImg .= "<img src='" . $thumbUrl . "' alt='" . $alttext . "' title='" . $alttext . "'>";
                     $subprophrefend = "";
                 } else {
                     $imgs_path = RedShopHelperImages::getImagePath($thumb, '', 'thumb', $filedir, $pw_thumb, $ph_thumb, USE_IMAGE_SIZE_SWAPPING);
                     $subproperty_filename_org = REDSHOP_FRONT_IMAGES_RELPATH . "subproperty/" . $imagename;
                     if (is_file($subproperty_filename_org)) {
                         $subproperty_thumb_original = $media_image[$m]->subattribute_color_image;
                         $subproperty_img_path_org = RedShopHelperImages::getImagePath($subproperty_thumb_original, '', 'thumb', 'subproperty', $pw_thumb, $ph_thumb, USE_IMAGE_SIZE_SWAPPING);
                     } else {
                         $subproperty_img_path_org = $property_img_path_org;
                     }
                     $subpropadditionImg_div_start = "<div class='additional_image' onmouseover='display_image_add(\"" . $imgs_path . "\"," . $product_id . ");' onmouseout='display_image_add_out(\"" . $subproperty_img_path_org . "\"," . $product_id . ");' >";
                     $subpropadditionImg_div_end = "</div>";
                     $thumbUrl = RedShopHelperImages::getImagePath($thumb, '', 'thumb', $filedir, $mpw_thumb, $mph_thumb, USE_IMAGE_SIZE_SWAPPING);
                     $subpropadditionImg .= $subpropadditionImg_div_start;
                     $subpropadditionImg .= "<a href='javascript:void(0)'>" . "<img src='" . $thumbUrl . "' alt='" . $alttext . "' title='" . $alttext . "' style='cursor: auto;'>";
                     $subprophrefend = "</a>";
                 }
                 if (ADDITIONAL_HOVER_IMAGE_ENABLE) {
                     $thumbUrl = RedShopHelperImages::getImagePath($thumb, '', 'thumb', $filedir, ADDITIONAL_HOVER_IMAGE_WIDTH, ADDITIONAL_HOVER_IMAGE_HEIGHT, USE_IMAGE_SIZE_SWAPPING);
                     $subpropadditionImg .= "<img src='" . $thumbUrl . "' alt='" . $alttext . "' title='" . $alttext . "' class='redImagepreview'>";
                 }
                 $subpropadditionImg .= $subprophrefend;
                 $subpropadditionImg .= $subpropadditionImg_div_end;
             }
         }
     }
     $response = "";
     if ($subpropadditionImg != "") {
         $response = "<div>" . $subpropadditionImg . "</div>";
     } elseif ($propadditionImg != "") {
         $response = "<div>" . $propadditionImg . "</div>";
     } elseif ($prodadditionImg != "") {
         $response = "<div>" . $prodadditionImg . "</div>";
     }
     $ProductAttributeDelivery = "";
     $attributeFlag = false;
     if ($accessory_id == 0) {
         if ($subproperty_id) {
             $ProductAttributeDelivery = $this->getProductMinDeliveryTime($product_id, $subproperty_id, "subproperty", 0);
             if ($ProductAttributeDelivery) {
                 $attributeFlag = true;
             }
         }
         if ($property_id && $attributeFlag == false) {
             $ProductAttributeDelivery = $this->getProductMinDeliveryTime($product_id, $property_id, "property", 0);
             if ($ProductAttributeDelivery) {
                 $attributeFlag = true;
             }
         }
         if ($product_id && $attributeFlag == false) {
             $ProductAttributeDelivery = $this->getProductMinDeliveryTime($product_id);
         }
     }
     $stock_status = '';
     $stockamountTooltip = "";
     $productinstock = 0;
     $stockamountSrc = "";
     $stockImgFlag = false;
     $notify_stock = '';
     if (USE_STOCKROOM == 1 && $accessory_id == 0) {
         if ($subproperty_id) {
             $productinstock = $stockroomhelper->getStockAmountwithReserve($subproperty_id, "subproperty");
             $stockamountList = $stockroomhelper->getStockAmountImage($subproperty_id, "subproperty", $productinstock);
             //				if(count($stockamountList)>0)
             //				{
             $stockImgFlag = true;
             //				}
         }
         if ($property_id && $stockImgFlag == false) {
             $productinstock = $stockroomhelper->getStockAmountwithReserve($property_id, "property");
             $stockamountList = $stockroomhelper->getStockAmountImage($property_id, "property", $productinstock);
             //				if(count($stockamountList)>0)
             //				{
             $stockImgFlag = true;
             //				}
         }
         if ($product_id && $stockImgFlag == false) {
             $productinstock = $stockroomhelper->getStockAmountwithReserve($product_id);
             $stockamountList = $stockroomhelper->getStockAmountImage($product_id, "product", $productinstock);
         }
         if (count($stockamountList) > 0) {
             $stockamountTooltip = $stockamountList[0]->stock_amount_image_tooltip;
             $stockamountSrc = REDSHOP_FRONT_IMAGES_ABSPATH . 'stockroom/' . $stockamountList[0]->stock_amount_image;
         }
     }
     // Stockroom status code->Ushma
     if (strstr($template_desc, "{stock_status") || strstr($template_desc, "{stock_notify_flag}") || strstr($template_desc, "{product_availability_date}")) {
         // for c**t attributes
         $attributes_set = array();
         if ($product->attribute_set_id > 0) {
             $attributes_set = $this->getProductAttribute(0, $product->attribute_set_id, 0, 1);
         }
         $attributes = $this->getProductAttribute($product->product_id);
         $attributes = array_merge($attributes, $attributes_set);
         $totalatt = count($attributes);
         $productStockStatus = $this->getproductStockStatus($product->product_id, $totalatt, $property_id, $subproperty_id);
         if (strstr($template_desc, "{stock_status")) {
             $stocktag = strstr($template_desc, "{stock_status");
             $newstocktag = explode("}", $stocktag);
             $realstocktag = $newstocktag[0] . "}";
             $stock_tag = substr($newstocktag[0], 1);
             $sts_array = explode(":", $stock_tag);
             $avail_class = "available_stock_cls";
             if (isset($sts_array[1]) && $sts_array[1] != "") {
                 $avail_class = $sts_array[1];
             }
             $out_stock_class = "out_stock_cls";
             if (isset($sts_array[2]) && $sts_array[2] != "") {
                 $out_stock_class = $sts_array[2];
             }
             $pre_order_class = "pre_order_cls";
             if (isset($sts_array[3]) && $sts_array[3] != "") {
                 $pre_order_class = $sts_array[3];
             }
             if (!$productStockStatus['regular_stock']) {
                 if ($productStockStatus['preorder'] && !$productStockStatus['preorder_stock'] || !$productStockStatus['preorder']) {
                     $stock_status = "<span id='stock_status_div" . $product_id . "'><div id='" . $out_stock_class . "' class='" . $out_stock_class . "'>" . JText::_('COM_REDSHOP_OUT_OF_STOCK') . "</div></span>";
                 } else {
                     $stock_status = "<span id='stock_status_div" . $product_id . "'><div id='" . $pre_order_class . "' class='" . $pre_order_class . "'>" . JText::_('COM_REDSHOP_PRE_ORDER') . "</div></span>";
                 }
             } else {
                 $stock_status = "<span id='stock_status_div" . $product_id . "'><div id='" . $avail_class . "' class='" . $avail_class . "'>" . JText::_('COM_REDSHOP_AVAILABLE_STOCK') . "</div></span>";
             }
         }
         if (strstr($template_desc, "{stock_notify_flag}")) {
             $userArr = $this->_session->get('rs_user');
             $is_login = $userArr['rs_is_user_login'];
             $users_info_id = $userArr['rs_user_info_id'];
             $user_id = $userArr['rs_userid'];
             $is_notified = $this->isAlreadyNotifiedUser($user_id, $product->product_id, $property_id, $subproperty_id);
             if (!$productStockStatus['regular_stock'] && $is_login && $users_info_id) {
                 if ($productStockStatus['preorder'] && !$productStockStatus['preorder_stock'] || !$productStockStatus['preorder']) {
                     if ($is_notified) {
                         $notify_stock = "<span>" . JText::_('COM_REDSHOP_ALREADY_REQUESTED_FOR_NOTIFICATION') . "</span>";
                     } else {
                         $notify_stock = '<span >' . JText::_('COM_REDSHOP_NOTIFY_STOCK_LBL') . '</span><input type="button" name="" value="' . JText::_('COM_REDSHOP_NOTIFY_STOCK') . '" class="notifystockbtn" title="' . JText::_('COM_REDSHOP_NOTIFY_STOCK_LBL') . '" onclick="getStocknotify(\'' . $product->product_id . '\',\'' . $property_id . '\', \'' . $subproperty_id . '\');">';
                     }
                 } else {
                     $notify_stock = "";
                 }
             } else {
                 $notify_stock = '';
             }
         }
         if (strstr($template_desc, "{product_availability_date}")) {
             if (!$productStockStatus['regular_stock'] && $productStockStatus['preorder']) {
                 if ($product->product_availability_date != "") {
                     $product_availability_date_lbl = JText::_('COM_REDSHOP_PRODUCT_AVAILABILITY_DATE_LBL') . ": ";
                     $product_availability_date = $redshopconfig->convertDateFormat($product->product_availability_date);
                 } else {
                     $product_availability_date_lbl = "";
                     $product_availability_date = "";
                 }
             } else {
                 $product_availability_date_lbl = "";
                 $product_availability_date = "";
             }
         }
     }
     $ret = array();
     $ret['response'] = $response;
     $ret['aHrefImageResponse'] = $aHrefImageResponse;
     $ret['aTitleImageResponse'] = $aTitleImageResponse;
     $ret['mainImageResponse'] = $mainImageResponse;
     $ret['stockamountSrc'] = $stockamountSrc;
     $ret['stockamountTooltip'] = $stockamountTooltip;
     $ret['ProductAttributeDelivery'] = $ProductAttributeDelivery;
     $ret['attrbimg'] = $attrbimg;
     $ret['pr_number'] = $pr_number;
     $ret['productinstock'] = $productinstock;
     $ret['stock_status'] = $stock_status;
     $ret['product_mainimg'] = $productmainimg;
     $ret['ImageName'] = $imagename;
     $ret['notifyStock'] = $notify_stock;
     $ret['product_availability_date_lbl'] = $product_availability_date_lbl;
     $ret['product_availability_date'] = $product_availability_date;
     //$ret['view']			=$view;
     return $ret;
 }
Ejemplo n.º 2
0
 $row = $this->detail[$i];
 $data_add .= $middletemplate_desc;
 $cItemid = $objhelper->getCategoryItemid($row->category_id);
 if ($cItemid != "") {
     $tmpItemid = $cItemid;
 } else {
     $tmpItemid = $this->itemid;
 }
 $link = JRoute::_('index.php?option=com_redshop&view=category&cid=' . $row->category_id . '&layout=detail&Itemid=' . $tmpItemid);
 $middlepath = REDSHOP_FRONT_IMAGES_RELPATH . 'category/';
 $title = " title='" . $row->category_name . "' ";
 $alt = " alt='" . $row->category_name . "' ";
 $product_img = REDSHOP_FRONT_IMAGES_ABSPATH . "noimage.jpg";
 $linkimage = $product_img;
 if ($row->category_full_image && file_exists($middlepath . $row->category_full_image)) {
     $product_img = $objhelper->watermark('category', $row->category_full_image, $w_thumb, $h_thumb, WATERMARK_CATEGORY_THUMB_IMAGE, '0');
     $linkimage = $objhelper->watermark('category', $row->category_full_image, '', '', WATERMARK_CATEGORY_IMAGE, '0');
 } elseif (CATEGORY_DEFAULT_IMAGE && file_exists($middlepath . CATEGORY_DEFAULT_IMAGE)) {
     $product_img = $objhelper->watermark('category', CATEGORY_DEFAULT_IMAGE, $w_thumb, $h_thumb, WATERMARK_CATEGORY_THUMB_IMAGE, '0');
     $linkimage = $objhelper->watermark('category', CATEGORY_DEFAULT_IMAGE, '', '', WATERMARK_CATEGORY_IMAGE, '0');
 }
 if (CAT_IS_LIGHTBOX) {
     $cat_thumb = "<a rel=\"myallimg\" href='" . $linkimage . "'  " . $title . ">";
 } 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>';
Ejemplo n.º 3
0
    }
    $template_desc = $template_start . $cart_mdata . $template_end;
}
if (strstr($template_desc, "{manufacturer_image}")) {
    $mh_thumb = MANUFACTURER_THUMB_HEIGHT;
    $mw_thumb = MANUFACTURER_THUMB_WIDTH;
    $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 = $row->manufacturer_name;
            }
            if (WATERMARK_MANUFACTURER_IMAGE) {
                $manufacturer_img = $redhelper->watermark('manufacturer', $media_image[$m]->media_name, "", "", WATERMARK_MANUFACTURER_IMAGE);
                $maintype = "watermarked/main";
            } else {
                $maintype = "manufacturer/";
            }
            if (WATERMARK_MANUFACTURER_THUMB_IMAGE) {
                $manufacturer_img = $redhelper->watermark('manufacturer', $media_image[$m]->media_name, "", "", WATERMARK_MANUFACTURER_THUMB_IMAGE);
                $thumbtype = "watermarked/main";
            } else {
                $thumbtype = "manufacturer/";
            }
            $thumbUrl = RedShopHelperImages::getImagePath($media_image[$m]->media_name, '', 'thumb', $thumbtype, $mw_thumb, $mh_thumb, USE_IMAGE_SIZE_SWAPPING);
            $thum_image = "<a title='" . $altText . "' class=\"modal\" href='" . REDSHOP_FRONT_IMAGES_ABSPATH . $maintype . $media_image[$m]->media_name . "'   rel=\"{handler: 'image', size: {}}\">\n\t\t\t\t<img alt='" . $altText . "' title='" . $altText . "' src='" . $thumbUrl . "'></a>";
        }
    }
    $template_desc = str_replace("{manufacturer_image}", $thum_image, $template_desc);
Ejemplo n.º 4
0
    public function replaceCartItem($data, $cart = array(), $replace_button, $quotation_mode = 0)
    {
        JPluginHelper::importPlugin('redshop_product');
        $dispatcher = JDispatcher::getInstance();
        $prdItemid = JRequest::getInt('Itemid');
        $option = JRequest::getVar('option', 'com_redshop');
        $Itemid = $this->_redhelper->getCheckoutItemid();
        $url = JURI::base(true);
        $mainview = JRequest::getVar('view');
        if ($Itemid == 0) {
            $Itemid = JRequest::getInt('Itemid');
        }
        $cart_tr = '';
        $i = 0;
        $idx = $cart['idx'];
        $fieldArray = $this->_extraFieldFront->getSectionFieldList(17, 0, 0);
        if (is_file(REDSHOP_FRONT_IMAGES_RELPATH . ADDTOCART_DELETE)) {
            $delete_img = ADDTOCART_DELETE;
        } else {
            $delete_img = "defaultcross.jpg";
        }
        for ($i = 0; $i < $idx; $i++) {
            if (isset($cart[$i]['giftcard_id']) && $cart[$i]['giftcard_id']) {
                $giftcard_id = $cart[$i]['giftcard_id'];
                $giftcardData = $this->_producthelper->getGiftcardData($giftcard_id);
                $link = JRoute::_('index.php?option=' . $option . '&view=giftcard&gid=' . $giftcard_id . '&Itemid=' . $Itemid);
                $product_name = "<div  class='product_name'><a href='" . $link . "'>" . $giftcardData->giftcard_name . "</a></div>";
                if (strstr($data, "{product_name_nolink}")) {
                    $product_name_nolink = "<div  class='product_name'>{$giftcardData->giftcard_name}</a></div>";
                    $cart_mdata = str_replace("{product_name_nolink}", $product_name_nolink, $data);
                    if (strstr($data, "{product_name}")) {
                        $cart_mdata = str_replace("{product_name}", "", $cart_mdata);
                    }
                } else {
                    $cart_mdata = str_replace("{product_name}", $product_name, $data);
                }
                // $cart_mdata=str_replace("{product_name}",$product_name,$data);
                $cart_mdata = str_replace("{product_attribute}", '', $cart_mdata);
                $cart_mdata = str_replace("{product_accessory}", '', $cart_mdata);
                $cart_mdata = str_replace("{product_wrapper}", '', $cart_mdata);
                $cart_mdata = str_replace("{product_old_price}", '', $cart_mdata);
                $cart_mdata = str_replace("{vat_info}", '', $cart_mdata);
                $cart_mdata = str_replace("{update_cart}", '', $cart_mdata);
                $cart_mdata = str_replace("{product_number}", '', $cart_mdata);
                $cart_mdata = str_replace("{attribute_price_without_vat}", '', $cart_mdata);
                $cart_mdata = str_replace("{attribute_price_with_vat}", '', $cart_mdata);
                if ($quotation_mode && !SHOW_QUOTATION_PRICE) {
                    $cart_mdata = str_replace("{product_total_price}", "", $cart_mdata);
                    $cart_mdata = str_replace("{product_price}", "", $cart_mdata);
                } else {
                    $cart_mdata = str_replace("{product_price}", $this->_producthelper->getProductFormattedPrice($cart[$i]['product_price']), $cart_mdata);
                    $cart_mdata = str_replace("{product_total_price}", $this->_producthelper->getProductFormattedPrice($cart[$i]['product_price'] * $cart[$i]['quantity'], true), $cart_mdata);
                }
                $cart_mdata = str_replace("{if product_on_sale}", '', $cart_mdata);
                $cart_mdata = str_replace("{product_on_sale end if}", '', $cart_mdata);
                $thumbUrl = RedShopHelperImages::getImagePath($giftcardData->giftcard_image, '', 'thumb', 'giftcard', CART_THUMB_WIDTH, CART_THUMB_HEIGHT, USE_IMAGE_SIZE_SWAPPING);
                $giftcard_image = "<div  class='giftcard_image'><img src='" . $thumbUrl . "'></div>";
                $cart_mdata = str_replace("{product_thumb_image}", $giftcard_image, $cart_mdata);
                $user_fields = $this->_producthelper->GetProdcutUserfield($i, 13);
                $cart_mdata = str_replace("{product_userfields}", $user_fields, $cart_mdata);
                $cart_mdata = str_replace("{product_price_excl_vat}", $this->_producthelper->getProductFormattedPrice($cart[$i]['product_price']), $cart_mdata);
                $cart_mdata = str_replace("{product_total_price_excl_vat}", $this->_producthelper->getProductFormattedPrice($cart[$i]['product_price'] * $cart[$i]['quantity']), $cart_mdata);
                $cart_mdata = str_replace("{attribute_change}", '', $cart_mdata);
                $cart_mdata = str_replace("{product_attribute_price}", "", $cart_mdata);
                $cart_mdata = str_replace("{product_attribute_number}", "", $cart_mdata);
                $cart_mdata = str_replace("{product_tax}", "", $cart_mdata);
                // ProductFinderDatepicker Extra Field
                $cart_mdata = $this->_producthelper->getProductFinderDatepickerValue($cart_mdata, $product_id, $fieldArray, $giftcard = 1);
                $remove_product = '<form style="" class="rs_hiddenupdatecart" name="delete_cart' . $i . '" method="POST" >
				<input type="hidden" name="giftcard_id" value="' . $cart[$i]['giftcard_id'] . '">
				<input type="hidden" name="cart_index" value="' . $i . '">
				<input type="hidden" name="task" value="">
				<input type="hidden" name="Itemid" value="' . $Itemid . '">
				<img class="delete_cart" src="' . REDSHOP_FRONT_IMAGES_ABSPATH . $delete_img . '" title="' . JText::_('COM_REDSHOP_DELETE_PRODUCT_FROM_CART_LBL') . '" alt="' . JText::_('COM_REDSHOP_DELETE_PRODUCT_FROM_CART_LBL') . '" onclick="document.delete_cart' . $i . '.task.value=\'delete\';document.delete_cart' . $i . '.submit();"></form>';
                if (QUANTITY_TEXT_DISPLAY) {
                    $cart_mdata = str_replace("{remove_product}", $remove_product, $cart_mdata);
                } else {
                    $cart_mdata = str_replace("{remove_product}", $remove_product, $cart_mdata);
                }
            } else {
                $product_id = $cart[$i]['product_id'];
                $product = $this->_producthelper->getProductById($product_id);
                $quantity = $cart[$i]['quantity'];
                $retAttArr = $this->_producthelper->makeAttributeCart($cart[$i]['cart_attribute'], $product_id, 0, 0, $quantity, $data);
                $cart_attribute = $retAttArr[0];
                $retAccArr = $this->_producthelper->makeAccessoryCart($cart[$i]['cart_accessory'], $product_id, $data);
                $cart_accessory = $retAccArr[0];
                $ItemData = $this->_producthelper->getMenuInformation(0, 0, '', 'product&pid=' . $product_id);
                if (count($ItemData) > 0) {
                    $Itemid = $ItemData->id;
                } else {
                    $Itemid = $this->_redhelper->getItemid($product_id);
                }
                $link = JRoute::_('index.php?option=' . $option . '&view=product&pid=' . $product_id . '&Itemid=' . $Itemid);
                $pname = $product->product_name;
                $product_name = "<div  class='product_name'><a href='" . $link . "'>" . $pname . "</a></div>";
                $product_image = "";
                $prd_image = '';
                $type = 'product';
                if (WANT_TO_SHOW_ATTRIBUTE_IMAGE_INCART && isset($cart[$i]['hidden_attribute_cartimage'])) {
                    $image_path = REDSHOP_FRONT_IMAGES_ABSPATH;
                    $product_image = str_replace($image_path, '', $cart[$i]['hidden_attribute_cartimage']);
                }
                if ($product_image && is_file(REDSHOP_FRONT_IMAGES_RELPATH . $product_image)) {
                    $val = explode("/", $product_image);
                    $prd_image = $val[1];
                    $type = $val[0];
                } elseif ($product->product_full_image && is_file(REDSHOP_FRONT_IMAGES_RELPATH . "product/" . $product->product_full_image)) {
                    $prd_image = $product->product_full_image;
                    $type = 'product';
                } elseif (is_file(REDSHOP_FRONT_IMAGES_RELPATH . "product/" . PRODUCT_DEFAULT_IMAGE)) {
                    $prd_image = PRODUCT_DEFAULT_IMAGE;
                    $type = 'product';
                }
                $isAttributeImage = false;
                if (isset($cart[$i]['attributeImage'])) {
                    $isAttributeImage = is_file(REDSHOP_FRONT_IMAGES_RELPATH . "mergeImages/" . $cart[$i]['attributeImage']);
                }
                if ($isAttributeImage) {
                    $prd_image = $cart[$i]['attributeImage'];
                    $type = 'mergeImages';
                }
                if ($prd_image !== '') {
                    $redhelper = new redhelper();
                    if (WATERMARK_CART_THUMB_IMAGE && file_exists(REDSHOP_FRONT_IMAGES_RELPATH . "product/" . WATERMARK_IMAGE)) {
                        $product_cart_img = $redhelper->watermark($type, $prd_image, CART_THUMB_WIDTH, CART_THUMB_HEIGHT, WATERMARK_CART_THUMB_IMAGE, '0');
                        $product_image = "<div  class='product_image'><img src='" . $product_cart_img . "'></div>";
                    } else {
                        $thumbUrl = RedShopHelperImages::getImagePath($prd_image, '', 'thumb', $type, CART_THUMB_WIDTH, CART_THUMB_HEIGHT, USE_IMAGE_SIZE_SWAPPING);
                        $product_image = "<div  class='product_image'><img src='" . $thumbUrl . "'></div>";
                    }
                } else {
                    $product_image = "<div  class='product_image'></div>";
                }
                // Trigger to change product image.
                $dispatcher->trigger('changeCartOrderItemImage', array(&$cart, &$product_image, $product, $i));
                $chktag = $this->_producthelper->getApplyVatOrNot($data);
                $product_total_price = "<div class='product_price'>";
                if (!$quotation_mode || $quotation_mode && SHOW_QUOTATION_PRICE) {
                    if (!$chktag) {
                        $product_total_price .= $this->_producthelper->getProductFormattedPrice($cart[$i]['product_price_excl_vat'] * $quantity);
                    } else {
                        $product_total_price .= $this->_producthelper->getProductFormattedPrice($cart[$i]['product_price'] * $quantity);
                    }
                }
                $product_total_price .= "</div>";
                $product_old_price = "";
                $product_price = "<div class='product_price'>";
                if (!$quotation_mode || $quotation_mode && SHOW_QUOTATION_PRICE) {
                    if (!$chktag) {
                        $product_price .= $this->_producthelper->getProductFormattedPrice($cart[$i]['product_price_excl_vat'], true);
                    } else {
                        $product_price .= $this->_producthelper->getProductFormattedPrice($cart[$i]['product_price'], true);
                    }
                    if (isset($cart[$i]['product_old_price'])) {
                        $product_old_price = $cart[$i]['product_old_price'];
                        if (!$chktag) {
                            $product_old_price = $cart[$i]['product_old_price_excl_vat'];
                        }
                        $product_old_price = $this->_producthelper->getProductFormattedPrice($product_old_price, true);
                    }
                }
                $product_price .= "</div>";
                $wrapper_name = "";
                if (array_key_exists('wrapper_id', $cart[$i]) && $cart[$i]['wrapper_id']) {
                    $wrapper = $this->_producthelper->getWrapper($product_id, $cart[$i]['wrapper_id']);
                    if (count($wrapper) > 0) {
                        $wrapper_name = JText::_('COM_REDSHOP_WRAPPER') . ": " . $wrapper[0]->wrapper_name;
                        if (!$quotation_mode || $quotation_mode && SHOW_QUOTATION_PRICE) {
                            $wrapper_name .= "(" . $this->_producthelper->getProductFormattedPrice($cart[$i]['wrapper_price'], true) . ")";
                        }
                    }
                }
                $cart_mdata = '';
                if (strstr($data, "{product_name_nolink}")) {
                    $product_name_nolink = "";
                    $product_name_nolink = "<div  class='product_name'>{$product->product_name}</a></div>";
                    $cart_mdata = str_replace("{product_name_nolink}", $product_name_nolink, $data);
                    if (strstr($data, "{product_name}")) {
                        $cart_mdata = str_replace("{product_name}", "", $cart_mdata);
                    }
                } else {
                    $cart_mdata = str_replace("{product_name}", $product_name, $data);
                }
                $cart_mdata = str_replace("{product_s_desc}", $product->product_s_desc, $cart_mdata);
                // Replace Attribute data
                if (strstr($cart_mdata, "{product_attribute_loop_start}") && strstr($cart_mdata, "{product_attribute_loop_end}")) {
                    $templateattibute_sdata = explode('{product_attribute_loop_start}', $cart_mdata);
                    $templateattibute_start = $templateattibute_sdata[0];
                    $templateattibute_edata = explode('{product_attribute_loop_end}', $templateattibute_sdata[1]);
                    $templateattibute_end = $templateattibute_edata[1];
                    $templateattibute_middle = $templateattibute_edata[0];
                    $pro_detail = '';
                    $sum_total = count($cart[$i]['cart_attribute']);
                    $temp_tpi = $cart[$i]['cart_attribute'];
                    if ($sum_total > 0) {
                        for ($tpi = 0; $tpi < $sum_total; $tpi++) {
                            $product_attribute_name = "";
                            $product_attribute_value = "";
                            $product_attribute_value_price = "";
                            $product_attribute_name = $temp_tpi[$tpi]['attribute_name'];
                            if (count($temp_tpi[$tpi]['attribute_childs']) > 0) {
                                $product_attribute_value = ": " . $temp_tpi[$tpi]['attribute_childs'][0]['property_name'];
                                if (count($temp_tpi[$tpi]['attribute_childs'][0]['property_childs']) > 0) {
                                    $product_attribute_value .= ": " . $temp_tpi[$tpi]['attribute_childs'][0]['property_childs'][0]['subattribute_color_title'] . ": " . $temp_tpi[$tpi]['attribute_childs'][0]['property_childs'][0]['subproperty_name'];
                                }
                                $product_attribute_value_price = $temp_tpi[$tpi]['attribute_childs'][0]['property_price'];
                                if (count($temp_tpi[$tpi]['attribute_childs'][0]['property_childs']) > 0) {
                                    $product_attribute_value_price = $product_attribute_value_price + $temp_tpi[$tpi]['attribute_childs'][0]['property_childs'][0]['subproperty_price'];
                                }
                                $product_attribute_value_price = $this->_producthelper->getProductFormattedPrice($product_attribute_value_price);
                            }
                            $data_add_pro = $templateattibute_middle;
                            $data_add_pro = str_replace("{product_attribute_name}", $product_attribute_name, $data_add_pro);
                            $data_add_pro = str_replace("{product_attribute_value}", $product_attribute_value, $data_add_pro);
                            $data_add_pro = str_replace("{product_attribute_value_price}", $product_attribute_value_price, $data_add_pro);
                            $pro_detail .= $data_add_pro;
                        }
                    }
                    $cart_mdata = str_replace($templateattibute_middle, $pro_detail, $cart_mdata);
                }
                if (count($cart[$i]['cart_attribute']) > 0) {
                    $cart_mdata = str_replace("{attribute_label}", JText::_("COM_REDSHOP_ATTRIBUTE"), $cart_mdata);
                } else {
                    $cart_mdata = str_replace("{attribute_label}", "", $cart_mdata);
                }
                $cart_mdata = str_replace("{product_number}", $product->product_number, $cart_mdata);
                $cart_mdata = str_replace("{product_vat}", $cart[$i]['product_vat'] * $cart[$i]['quantity'], $cart_mdata);
                $user_fields = $this->_producthelper->GetProdcutUserfield($i);
                $cart_mdata = str_replace("{product_userfields}", $user_fields, $cart_mdata);
                $user_custom_fields = $this->_producthelper->GetProdcutfield($i);
                $cart_mdata = str_replace("{product_customfields}", $user_custom_fields, $cart_mdata);
                $cart_mdata = str_replace("{product_customfields_lbl}", JText::_("COM_REDSHOP_PRODUCT_CUSTOM_FIELD"), $cart_mdata);
                $discount_calc_output = isset($cart[$i]['discount_calc_output']) && $cart[$i]['discount_calc_output'] ? $cart[$i]['discount_calc_output'] . "<br />" : "";
                $cart_mdata = str_replace("{product_attribute}", $discount_calc_output . $cart_attribute, $cart_mdata);
                $cart_mdata = str_replace("{product_accessory}", $cart_accessory, $cart_mdata);
                $cart_mdata = str_replace("{product_attribute_price}", "", $cart_mdata);
                $cart_mdata = str_replace("{product_attribute_number}", "", $cart_mdata);
                $cart_mdata = $this->_producthelper->getProductOnSaleComment($product, $cart_mdata, $product_old_price);
                $cart_mdata = str_replace("{product_old_price}", $product_old_price, $cart_mdata);
                $cart_mdata = str_replace("{product_wrapper}", $wrapper_name, $cart_mdata);
                $cart_mdata = str_replace("{product_thumb_image}", $product_image, $cart_mdata);
                $cart_mdata = str_replace("{attribute_price_without_vat}", '', $cart_mdata);
                $cart_mdata = str_replace("{attribute_price_with_vat}", '', $cart_mdata);
                // ProductFinderDatepicker Extra Field Start
                $cart_mdata = $this->_producthelper->getProductFinderDatepickerValue($cart_mdata, $product_id, $fieldArray);
                $product_price_excl_vat = $cart[$i]['product_price_excl_vat'];
                if (!$quotation_mode || $quotation_mode && SHOW_QUOTATION_PRICE) {
                    $cart_mdata = str_replace("{product_price_excl_vat}", $this->_producthelper->getProductFormattedPrice($product_price_excl_vat), $cart_mdata);
                    $cart_mdata = str_replace("{product_total_price_excl_vat}", $this->_producthelper->getProductFormattedPrice($product_price_excl_vat * $quantity), $cart_mdata);
                } else {
                    $cart_mdata = str_replace("{product_price_excl_vat}", "", $cart_mdata);
                    $cart_mdata = str_replace("{product_total_price_excl_vat}", "", $cart_mdata);
                }
                // $cart[$i]['product_price_excl_vat'] = $product_price_excl_vat;
                $this->_session->set('cart', $cart);
                if ($product->product_type == 'subscription') {
                    $subscription_detail = $this->_producthelper->getProductSubscriptionDetail($product->product_id, $cart[$i]['subscription_id']);
                    $selected_subscription = $subscription_detail->subscription_period . " " . $subscription_detail->period_type;
                    $cart_mdata = str_replace("{product_subscription_lbl}", JText::_('COM_REDSHOP_SUBSCRIPTION'), $cart_mdata);
                    $cart_mdata = str_replace("{product_subscription}", $selected_subscription, $cart_mdata);
                } else {
                    $cart_mdata = str_replace("{product_subscription_lbl}", "", $cart_mdata);
                    $cart_mdata = str_replace("{product_subscription}", "", $cart_mdata);
                }
                if ($replace_button) {
                    $update_attribute = '';
                    if ($mainview == 'cart') {
                        $attchange = JURI::root() . 'index.php?option=com_redshop&view=cart&layout=change_attribute&tmpl=component&pid=' . $product_id . '&cart_index=' . $i;
                        $update_attribute = '<a class="modal" rel="{handler: \'iframe\', size: {x: 550, y: 400}}" href="' . $attchange . '">' . JText::_('COM_REDSHOP_CHANGE_ATTRIBUTE') . '</a>';
                    }
                    if ($cart_attribute != "") {
                        $cart_mdata = str_replace("{attribute_change}", $update_attribute, $cart_mdata);
                    } else {
                        $cart_mdata = str_replace("{attribute_change}", "", $cart_mdata);
                    }
                    $update_cart_none = '<label>' . $quantity . '</label>';
                    $update_img = '';
                    if ($mainview == 'checkout') {
                        $update_cart = $quantity;
                    } else {
                        $update_cart = '<form style="padding:0px;margin:0px;" name="update_cart' . $i . '" method="POST" >';
                        $update_cart .= '<input class="inputbox" type="text" value="' . $quantity . '" name="quantity" id="quantitybox' . $i . '" size="' . DEFAULT_QUANTITY . '" maxlength="' . DEFAULT_QUANTITY . '" onchange="validateInputNumber(this.id);">';
                        $update_cart .= '<input type="hidden" name="product_id" value="' . $product_id . '">
								<input type="hidden" name="cart_index" value="' . $i . '">
								<input type="hidden" name="Itemid" value="' . $Itemid . '">
								<input type="hidden" name="task" value="">';
                        if (is_file(REDSHOP_FRONT_IMAGES_RELPATH . ADDTOCART_UPDATE)) {
                            $update_img = ADDTOCART_UPDATE;
                        } else {
                            $update_img = "defaultupdate.jpg";
                        }
                        $update_cart .= '<img class="update_cart" src="' . REDSHOP_FRONT_IMAGES_ABSPATH . $update_img . '" title="' . JText::_('COM_REDSHOP_UPDATE_PRODUCT_FROM_CART_LBL') . '" alt="' . JText::_('COM_REDSHOP_UPDATE_PRODUCT_FROM_CART_LBL') . '" onclick="document.update_cart' . $i . '.task.value=\'update\';document.update_cart' . $i . '.submit();">';
                        $update_cart .= '</form>';
                    }
                    $update_cart_minus_plus = '<form name="update_cart' . $i . '" method="POST">';
                    $update_cart_minus_plus .= '<input type="text" id="quantitybox' . $i . '" name="quantity"  size="1"  value="' . $quantity . '" /><input type="button" id="minus" value="-"
									    onClick="quantity.value = (quantity.value) ; var qty1 = quantity.value; if( !isNaN( qty1 ) &amp;&amp; qty1 > 1 ) quantity.value--;return false;">';
                    $update_cart_minus_plus .= '<input type="button" value="+"
									    onClick="quantity.value = (+quantity.value+1)"><input type="hidden" name="product_id" value="' . $product_id . '">
																	<input type="hidden" name="cart_index" value="' . $i . '">
																	<input type="hidden" name="Itemid" value="' . $Itemid . '">
																	<input type="hidden" name="task" value=""><img class="update_cart" src="' . REDSHOP_FRONT_IMAGES_ABSPATH . $update_img . '" title="' . JText::_('COM_REDSHOP_UPDATE_PRODUCT_FROM_CART_LBL') . '" alt="' . JText::_('COM_REDSHOP_UPDATE_PRODUCT_FROM_CART_LBL') . '" onclick="document.update_cart' . $i . '.task.value=\'update\';document.update_cart' . $i . '.submit();">
									</form>
									';
                    if (is_file(REDSHOP_FRONT_IMAGES_RELPATH . ADDTOCART_DELETE)) {
                        $delete_img = ADDTOCART_DELETE;
                    } else {
                        $delete_img = "defaultcross.jpg";
                    }
                    $empty_cart = '<form style="padding:0px;margin:0px;" name="delete_cart' . $i . '" method="POST" >
								<input type="hidden" name="product_id" value="' . $product_id . '">
								<input type="hidden" name="task" value="">
								<input type="hidden" name="Itemid" value="' . $Itemid . '">
								<img class="delete_cart" src="' . REDSHOP_FRONT_IMAGES_ABSPATH . $delete_img . '"  onclick="document.delete_cart' . $i . '.task.value=\'delete\';document.delete_cart' . $i . '.submit();"></form>';
                    if ($mainview == 'checkout') {
                        $remove_product = '';
                    } else {
                        $remove_product = '<form style="padding:0px;margin:0px;" name="delete_cart' . $i . '" method="POST" >
								<input type="hidden" name="product_id" value="' . $product_id . '">
								<input type="hidden" name="cart_index" value="' . $i . '">
								<input type="hidden" name="task" value="">
								<input type="hidden" name="Itemid" value="' . $Itemid . '">
								<img class="delete_cart" src="' . REDSHOP_FRONT_IMAGES_ABSPATH . $delete_img . '" title="' . JText::_('COM_REDSHOP_DELETE_PRODUCT_FROM_CART_LBL') . '" alt="' . JText::_('COM_REDSHOP_DELETE_PRODUCT_FROM_CART_LBL') . '" onclick="document.delete_cart' . $i . '.task.value=\'delete\';document.delete_cart' . $i . '.submit();"></form>';
                    }
                    if (QUANTITY_TEXT_DISPLAY) {
                        if (strstr($cart_mdata, "{quantity_increase_decrease}") && $mainview == 'cart') {
                            $cart_mdata = str_replace("{quantity_increase_decrease}", $update_cart_minus_plus, $cart_mdata);
                            $cart_mdata = str_replace("{update_cart}", '', $cart_mdata);
                        } else {
                            $cart_mdata = str_replace("{quantity_increase_decrease}", $update_cart, $cart_mdata);
                            $cart_mdata = str_replace("{update_cart}", $update_cart, $cart_mdata);
                        }
                        $cart_mdata = str_replace("{remove_product}", $remove_product, $cart_mdata);
                    } else {
                        $cart_mdata = str_replace("{quantity_increase_decrease}", $update_cart_minus_plus, $cart_mdata);
                        $cart_mdata = str_replace("{update_cart}", $update_cart_none, $cart_mdata);
                        $cart_mdata = str_replace("{remove_product}", $remove_product, $cart_mdata);
                    }
                } else {
                    $cart_mdata = str_replace("{update_cart}", $quantity, $cart_mdata);
                    $cart_mdata = str_replace("{remove_product}", '', $cart_mdata);
                    $cart_mdata = str_replace("{attribute_change}", '', $cart_mdata);
                }
                $cart_mdata = $this->_producthelper->replaceVatinfo($cart_mdata);
                $cart_mdata = str_replace("{product_price}", $product_price, $cart_mdata);
                $cart_mdata = str_replace("{product_total_price}", $product_total_price, $cart_mdata);
            }
            // Plugin support:  Process the product plugin for cart item
            $dispatcher->trigger('onCartItemDisplay', array(&$cart_mdata, $cart, $i));
            $cart_tr .= $cart_mdata;
        }
        return $cart_tr;
    }
Ejemplo n.º 5
0
        }
        //		$cart_tr .=$cart_mdata ;
        //		$cname = $manufacturer_products[$i]->category_name;
    }
}
$template_desc = $template_start . $cart_mdata . $template_end;
if (strstr($template_desc, "{manufacturer_image}")) {
    $mh_thumb = MANUFACTURER_THUMB_HEIGHT;
    $mw_thumb = MANUFACTURER_THUMB_WIDTH;
    $thum_image = "";
    $media_image = $producthelper->getAdditionMediaImage($manufacturer->manufacturer_id, "manufacturer");
    $m = 0;
    //	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)) {
        $wimg = $redhelper->watermark('manufacturer', $media_image[$m]->media_name, $mw_thumb, $mh_thumb, WATERMARK_MANUFACTURER_THUMB_IMAGE, '0');
        $linkimage = $redhelper->watermark('manufacturer', $media_image[$m]->media_name, '', '', WATERMARK_MANUFACTURER_IMAGE, '0');
        $altText = $producthelper->getAltText('manufacturer', $manufacturer->manufacturer_id);
        if (!$altText) {
            $altText = $manufacturer->manufacturer_name;
        }
        $thum_image = "<a title='" . $altText . "' class=\"modal\" href='" . $linkimage . "'   rel=\"{handler: 'image', size: {}}\">\n\t\t\t\t<img alt='" . $altText . "' title='" . $altText . "' src='" . $wimg . "'></a>";
    }
    //	}
    $template_desc = str_replace("{manufacturer_image}", $thum_image, $template_desc);
}
$manlink = JRoute::_('index.php?option=com_redshop&view=manufacturers&layout=detail&mid=' . $manufacturer->manufacturer_id . '&Itemid=' . $Itemid);
$manproducts = JRoute::_('index.php?option=com_redshop&view=manufacturers&layout=products&mid=' . $manufacturer->manufacturer_id . '&Itemid=' . $Itemid);
$template_desc = str_replace("{manufacturer_name}", $manufacturer->manufacturer_name, $template_desc);
// Extra field display
$extraFieldName = $extraField->getSectionFieldNameArray(10, 1, 1);
Ejemplo n.º 6
0
 $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 {
                 $manufacturer_img = RedShopHelperImages::getImagePath($media_image[$m]->media_name, '', 'thumb', 'manufacturer', $mw_thumb, $mh_thumb, USE_IMAGE_SIZE_SWAPPING);
             }
             if (PRODUCT_IS_LIGHTBOX == 1) {
                 $thum_image = "<a title='" . $altText . "' class=\"modal\" href='" . REDSHOP_FRONT_IMAGES_ABSPATH . "manufacturer/" . $media_image[$m]->media_name . "'   rel=\"{handler: 'image', size: {}}\">\n\t\t\t\t\t\t\t<img alt='" . $altText . "' title='" . $altText . "' src='" . $manufacturer_img . "'></a>";
             } else {
                 $thum_image = "<a title='" . $altText . "' href='" . $manproducts . "'>\n\t\t\t\t\t\t\t<img alt='" . $altText . "' title='" . $altText . "' src='" . $manufacturer_img . "'></a>";
             }
         }
     }
     $middledata = str_replace($mimg_tag, $thum_image, $middledata);
 }
 $middledata = str_replace("{manufacturer_description}", $row->manufacturer_desc, $middledata);
 $middledata = str_replace("{manufacturer_link}", $link, $middledata);
 $middledata = str_replace("{manufacturer_allproductslink}", $manproducts, $middledata);
Ejemplo n.º 7
0
">
				<?php 
            echo $pagetitle;
            ?>
			</h1>
		<?php 
        }
    }
}
if ($gid != 0) {
    $count_no_user_field = 0;
    $detail = $detail[0];
    $template = str_replace("{giftcard_name}", $detail->giftcard_name, $template);
    $template = str_replace("{giftcard_desc}", $detail->giftcard_desc, $template);
    if (strstr($template, "{giftcard_image}")) {
        $product_img = $objhelper->watermark('giftcard', $detail->giftcard_image, GIFTCARD_THUMB_WIDTH, GIFTCARD_THUMB_HEIGHT, WATERMARK_GIFTCART_THUMB_IMAGE, '0');
        $linkimage = $objhelper->watermark('giftcard', $detail->giftcard_image, '', '', WATERMARK_GIFTCART_IMAGE, '0');
        $thum_image = "<a class=\"modal\" href='" . $linkimage . "' title='" . $detail->giftcard_name . "' rel=\"{handler: 'image', size: {}}\">";
        $thum_image .= "<img src='" . $product_img . "' title='" . $detail->giftcard_name . "' alt='" . $detail->giftcard_name . "'>";
        $thum_image .= "</a>";
        $template = str_replace("{giftcard_image}", $thum_image, $template);
    }
    $template = str_replace("{giftcard_value}", $producthelper->getProductFormattedPrice($detail->giftcard_value), $template);
    $template = str_replace("{giftcard_value_lbl}", JText::_('COM_REDSHOP_GIFTCARD_VALUE_LBL'), $template);
    if ($detail->customer_amount != 1) {
        $template = str_replace("{giftcard_price_lbl}", JText::_('COM_REDSHOP_GIFTCARD_PRICE_LBL'), $template);
    } else {
        $template = str_replace("{giftcard_price_lbl}", '', $template);
    }
    if ($detail->customer_amount != 1) {
        $template = str_replace("{giftcard_price}", $producthelper->getProductFormattedPrice($detail->giftcard_price), $template);
Ejemplo n.º 8
0
     $Itemid = $ItemData->id;
 } else {
     $Itemid = $redhelper->getItemid($row->product_id, $category_id);
 }
 $link = JRoute::_('index.php?option=' . $option . '&view=product&pid=' . $row->product_id . '&cid=' . $category_id . '&Itemid=' . $Itemid);
 if ($vertical_product) {
     echo "<div class='mod_redshop_products'>";
 } else {
     echo "<div class='mod_redshop_products_horizontal'>";
 }
 echo "<div class='mod_redshop_products_outer'><div class='mod_redshop_products_inner'>";
 $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 {