Jump to content
tomerg3

[MODULE] Quantity Discounts - Display the quantity discounts in a more visible place.

Recommended Posts

This Module displays the quantity discounts as a final price (no %), directly below the product price (instead of a tab lower down the page).

The discount price will also update based on attribute impact.

Tested on PrestaShop 1.4, 1,5 and 1.6
 

http://www.presto-ch...-discounts.html

 

Direct Download: http://bit.ly/S12tKL

 

V1.1 was just released, it fixes a little bug when the prices were over 999

V1.2 released, it includes a fix for currencies with , for decimal amounts (IE Euro), and for prices over 999

V1.2.1 released, it includes a fix for currency signs with special characters (IE , . or digits)

V1.2.2 released, it includes support for PS 1.4

V1.2.3 Released
* Fix for "Product Price" discount (not a % or fixed amount).
* Added automatic upgrade notification.


V1.2.4 released
* Fix for "Quantity Discounts" text (was not translatable in last version).

 

V1.2.8 released
* Added support for PrestaShop 1.6

post-20153-0-96985100-1400879554_thumb.jpg

  • Like 1

Share this post


Link to post
Share on other sites

Thanks tomerg3 by this aggregate. Works for Me. ;) By

Share this post


Link to post
Share on other sites

There is something I would like to add:

How to aggregate text above discounts that it says: Price for Quantity: ??

Thanks

Share this post


Link to post
Share on other sites

V1.1 was just released, it fixes a little bug when the prices were over 999

  • Like 1

Share this post


Link to post
Share on other sites

Yet another excellant module tomerg3, one thing though, i have changed the word quantities to read "or more products", but would like to add the word each after the price, otherwise it might be a bit misleading to some customers.

24666_HLiJq7r3jC2tRnaNlxZh_t

Share this post


Link to post
Share on other sites
Yet another excellant module tomerg3, one thing though, i have changed the word quantities to read "or more products", but would like to add the word each after the price, otherwise it might be a bit misleading to some customers.


in quantitydiscount.tpl line #33 add the text at the end of the line (before the end ")

discountStr += "{$qd_quantity_discount.quantity|intval} or more ";

Share this post


Link to post
Share on other sites

jhnstcks: Mind sharing how you got to modify "quantities" to something else?


tomerg3: What jhnstcks wants to do is actually add the word "each" to the price in the quantity discount, not after the quantity. Without that specification, it looks as if if you buy 2 items, the price shown was for the 2 items and not the new price for each item.

So basically turning this:
2 quantities : $99.99

into this:
2 quantities : $99.99 each

Share this post


Link to post
Share on other sites

this is a snippet of my code

function writeDiscountsContent(price) {ldelim}
   var discountStr = "
"
   var discountedPrice = 0;
   {foreach from=$qd_quantity_discounts item='qd_quantity_discount' name='quantity_discounts'}
       discountStr += "{$qd_quantity_discount.quantity|intval} "
       {if $qd_quantity_discount.quantity|intval > 1}
           discountStr += "{l s='or more products' mod='quantitydiscounts'}: ";
       {else}
           discountStr += "{l s='product' mod='quantitydiscounts'}: ";
       {/if}
       {if $qd_quantity_discount.id_discount_type|intval == 1}
           discountedPrice = price - (price * {$qd_quantity_discount.value} / 100);
       {else}
           discountedPrice = price - {$qd_quantity_discount.value}; 
       {/if}
       discountStr += formatCurrency(discountedPrice, currencyFormat, currencySign, currencyBlank) + " each 
";
   {/foreach}        
   discountStr += "";



If you notice the 3rd last line of code at the end i have added "each", just before the end of the span

25656_iGAnFdbwV6cYBvBO7DM8_t

Share this post


Link to post
Share on other sites

jhnstcks: Could you let us know how you managed to modify the word "quantities"?. I'd rather have it show that in 'units' instead. Thanks in advance.

To recap what jhnstcks said:

In the quantitydiscounts package, open quantitydiscounts.tpl, look at line 44:

        discountStr += formatCurrency(discountedPrice, currencyFormat, currencySign, currencyBlank) + "
";



Change it to this

        discountStr += formatCurrency(discountedPrice, currencyFormat, currencySign, currencyBlank) + " each 
";

Share this post


Link to post
Share on other sites

I love this module but I am having one problem. Although I have discounts set to $50 of each unit if the customer buys more than 5 the product page shows $-49 and not $-50. The calculation in the cart is correct but the display abouve product price is not. How do I fix this. Link to page here

I too would like to add the word each after the price.

Thank you

Share this post


Link to post
Share on other sites

I love so much this module but I am having one problem.

In code, I see that price is fetched from html, but in spanish version with euro, price have comma (10,35 €). When returns price in float, price is not correct.

Funtion in quantitydiscounts.tpl:

function fetchCurrentPrice() {ldelim}
 var val = $("#our_price_display").text();
 var qd_price = "";

   for (var i = 0 ; i < val.length ; i++)
       if (/[0-9.,]/.test(val.charAt(i)))
         qd_price += val.charAt(i);

   return parseFloat(new_price);



I need that "comma" char switch to "point" char.


Thnx.

Share this post


Link to post
Share on other sites

How can i set in my code to show the quantity discounts only four Group_id=1, Group_id=2, Group_id=3 and for the rest it is not showing!

Regards
//WeraW

Share this post


Link to post
Share on other sites

There is a small bug with the module for certain price formats, it's on my to-do list....

Share this post


Link to post
Share on other sites

Instead of getting the price from the html text, I prefer to add this line in the function hookTop (from quantitydiscounts.php): $smarty->assign('precio', $product->getPriceWithoutReduct());
Then in quantitydiscounts.tpl I change the writeDiscountsContent function declaration to:
function writeDiscountsContent() {ldelim}

And add this: var price={$precio}

This works perfectly in "spanish"

Share this post


Link to post
Share on other sites
Instead of getting the price from the html text, I prefer to add this line in the function hookTop (from quantitydiscounts.php): $smarty->assign('precio', $product->getPriceWithoutReduct());
Then in quantitydiscounts.tpl I change the writeDiscountsContent function declaration to:
function writeDiscountsContent() {ldelim}

And add this: var price={$precio}

This works perfectly in "spanish"


This was not working for me, items were getting the price of other items from the shop...

Well here is my fix :

function fetchCurrentPrice() {ldelim}
   var val = $("#our_price_display").text();
   var qd_price = "";
   for (var i = 0 ; i < val.length ; i++)
       if (/[0-9.,]/.test(val.charAt(i)))
           if (val.charAt(i) == ',')
               qd_price += '.';
           else
               qd_price += val.charAt(i);

   return parseFloat(qd_price);
{rdelim}



Replace your fetchCurrentPrice function with the one above (it's in quantitydiscounts.tpl)

Share this post


Link to post
Share on other sites

this is a great idea but I cant figure out what is going on with this code
all the $ display is incorrect but it calculates in the cart correctly

first line, 10% off is 117.057, calculates correctly in cart, but shows $0.90 in the discount window, should show 1053.513
second, $15 off, shows $-14, calucates correctly in cart, should show 1155.57
same deal with the 3rd line was meant to be $100 shows -99

<!-- MODULE Discounts -->
{if isset($qd_quantity_discounts) AND $qd_quantity_discounts}
<style>
ul#idTab
{ldelim}
   display: none;
{rdelim}
</style>
[removed]

/**
* fetch the current price from the buy block text, parse it into a float and return it
*/
function fetchCurrentPrice() {ldelim}
   var val = $("#our_price_display").text();
   var qd_price = "";
   for (var i = 0 ; i < val.length ; i++)
       if (/[0-9.,]/.test(val.charAt(i)))
           qd_price += val.charAt(i);

   return parseFloat(qd_price);
{rdelim}

/**
* generate the discount area content (quantities and calculated discounted price)
* using the given single unit price
*/
function writeDiscountsContent(price) {ldelim}
   var discountStr = "
";
   var discountedPrice = 0;

   {foreach from=$qd_quantity_discounts item='qd_quantity_discount' name='quantity_discounts'}
       discountStr += "{$qd_quantity_discount.quantity|intval} ";
       {if $qd_quantity_discount.quantity|intval > 1}
           discountStr += "{l s='quantities' mod='quantitydiscounts'}: ";
       {else}
           discountStr += "{l s='quantity' mod='quantitydiscounts'}: ";
       {/if}
       {if $qd_quantity_discount.id_discount_type|intval == 1}
           discountedPrice = price - (price * {$qd_quantity_discount.value} / 100);
       {else}
           discountedPrice = price - {$qd_quantity_discount.value}; 
       {/if}
       discountStr += formatCurrency(discountedPrice, currencyFormat, currencySign, currencyBlank) + "
";
   {/foreach}        
   discountStr += "";

   return discountStr;
{rdelim}

$(document).ready(function () {ldelim}
   // remove the legacy quantities div and the tab above it
   $("#quantityDiscount").prev().css('display','none');
   $("#quantityDiscount").css('display','none');

   // hook the updateDisplay javascript call
   var origUpdateDisplay = window.updateDisplay;

   window.updateDisplay = function() {ldelim}
       origUpdateDisplay();

       var discountStr = writeDiscountsContent(fetchCurrentPrice());
       $('#discounts_block').replaceWith(discountStr);
   {rdelim}

   var discountStr = writeDiscountsContent(fetchCurrentPrice());

   price_found = false;
   $("#buy_block").children().each(function() {ldelim}
       // skip anything before the price div
       if ( $(this).attr('class') == "price" ) {ldelim}
           price_found = true;
       {rdelim}

       if (!price_found) {ldelim}
           return;
       {rdelim}

       // now skip any of the price sub items (old_price, reduction_percent, pack_price, price-ecotax)
       id = $(this).attr('id');
       if ( id == "" || id == "old_price" || id == "reduction_percent" || id == "pack_price" || id == "price-ecotax" )
           return;

       // ok, found something else so this is the end of the price block - print our stuff and reset the
       //  found flag (so we don't print on the next element as well)
       $(discountStr).insertBefore($(this));
       price_found = false;
   {rdelim});

{rdelim});
[removed]

{/if}
<!-- / MODULE Discounts -->




also, on another note, would be awesome if we could get these prices to show in the product listing, but its hard for me to play with it without it working properly. I was thinking on the stock standard template to pop it under the sale price, but have it list with abbreviations, smaller text and different colour

$1000
x3+ > $950ea
x5+ > $900ea
x10+ > $850ea

30836_XIkkdukMTYhSAiLeXdDv_t

30837_o8AnzaFlnQT6BicWAlrQ_t

Share this post


Link to post
Share on other sites

V1.2 released, it includes a fix for currencies with , for decimal amounts (IE Euro), and for prices over 999

Share this post


Link to post
Share on other sites

I'm pretty sure it's related to the 6 you have in the currency symbol, but just to be sure, can you post a screenshot of the discount page in the backoffice

Share this post


Link to post
Share on other sites

Yes, unfortunately, we use the figures in the currency - it is connected with the accounts in PDF.
Prestashop does not support Cyrillic characters to PDF (((

Share this post


Link to post
Share on other sites

Hi

First, thanks once again Tom for another great free module. I'm having the same problem as dt88. Is there any fix to that?

Thanks!

this is a great idea but I cant figure out what is going on with this code
all the $ display is incorrect but it calculates in the cart correctly

first line, 10% off is 117.057, calculates correctly in cart, but shows $0.90 in the discount window, should show 1053.513
second, $15 off, shows $-14, calucates correctly in cart, should show 1155.57
same deal with the 3rd line was meant to be $100 shows -99

Share this post


Link to post
Share on other sites

please send me a link to the product page and a screen shot of the discount rate, I'll check it out when I get a chance.

Share this post


Link to post
Share on other sites

Thanks Tom,

I've used amount instead of % coz it's easier to understand since the % output displays like how dt88 has described.

34290_hHIJl5cDqKFUv1b8TY7I_t

Share this post


Link to post
Share on other sites

Your problem is actually the same as Fant63, it will be addressed later this week.

Share this post


Link to post
Share on other sites

V1.2.1 released, it includes a fix for currency signs with special characters (IE , . or digits)

Share this post


Link to post
Share on other sites

Thanks Tom...works great now!

Not sure if this has been discussed but is there any way that products with attributes could be given quantity discounts if customer chooses different attributes of the same product?

Share this post


Link to post
Share on other sites

Hi Tom,

Thanks so much. I have used the option 1 for my store but now whenever I go to update the product attribute combination I get this error:

Fatal error: Call to undefined method Product::updateQuantityProductWithAttributeQuantity() in ~/tabs/AdminProducts.php on line 424

It updates fine but I get this error after modifying & I have to use the back button to get the page to load again.

Share this post


Link to post
Share on other sites

Hmm, I'm not sure, you can double check that everything was done correctly and using the correct PS version.

Share this post


Link to post
Share on other sites

Hi there,

I just downloaded and installed V1.2.2 on my PS 1.4.0.17 correctly, but I'm not able to find the discount tab anywhere in the control panel.... Any help will be more than wellcome..

Cheers

Share this post


Link to post
Share on other sites

Quantity discounts are added from the product editor page (Prices tab)

Share this post


Link to post
Share on other sites

Thank you so much, I can see it now. I was expecting a new tab in the product editor page named "Discounts" or something like that.

Share this post


Link to post
Share on other sites

I love this module.
But When I apply a quantity discount amount is whit taxes. But when it shows in the module is without taxes and when he gets into the basket it does with taxes. 8-/

Share this post


Link to post
Share on other sites

Thanks for your reply and pardon my English
Using version 1.4

Share this post


Link to post
Share on other sites

In the themes/prestashop/product.tpl

the discount amount is showed

-{convertPrice price=$quantity_discount.real_value|floatval}



but not how to replace in the code module

discountedPrice = price - {$qd_quantity_discount.reduction}; 



Help me please!

Share this post


Link to post
Share on other sites

Dear Sir

I Use ps 1.4.1, i Just download this module from http://www.presto-changeo.com/,
but this module does not working properly. appear properly in some products but others are not true.

How to add "@" which in Indonesia means the unit price
12 Quantities : @ Rp 11.213 in fact the truth is 14.950 (attachment discount_background.png)

strangely when I input quantity = 12, view on chart is 14.950 *12 -. it's true

How solved this problem ?
rgds,
bmg


nb: sorry about my english

47138_Z0A4rZtba4UdZeFDNl9v_t

47139_RNyAo5awSqhOEU2iELjX_t

Share this post


Link to post
Share on other sites

Price Discounts are shown in Descending order.


How to show Price Discounts in Ascending order?

Like this:

50 Quantities: $2.70
100 Quantities: $1.88
250 Quantities: $1.35
500 Quantities: $1.20
1000 Quantities: $1.15



Also, how to hide price discounts when customer is not logged in?

thanks.

Share this post


Link to post
Share on other sites

How to hide Quantity Discounts when the user is not logged?

please see attachments.
Thanks.

48695_xzpGBleXGxAjIM4EDIhl_t

48696_JHngQWD84qVDEq6JL2sF_t

Share this post


Link to post
Share on other sites

Hello, I´m new in this comunity.

How could I invert the array? Actually, after I install the module, the prestashop show me it in this array:

NORMAL PRICE
8 quantities:
5 quantities:
3 quantities:


I want the invert array:

NORMAL PRICE
3 quantities:
5 quantities:
8 quantities:

Thanks in advance

Share this post


Link to post
Share on other sites

Him I have problem with Prestashop 1.4.3. The Quantity Discount is not work correctly. Is this Support for PrestaShop 1.4.3?? Thanks

49149_BSZkB29uEmsG34LVBjKR_t

Share this post


Link to post
Share on other sites

Hi skykit, when you input a new specific price of your product, you need apply a reduction of your initial price, for example $10 and select to apply it on "Amount" or "Percentage".

Have you tried it?

I had your same problem but in 1.4.2.5 version. Version 1.4.3 give to me some problems when I add products in the shopping cart.

Good luck

49153_XRqhRkV6VIcpxAm3Zgge_t

Share this post


Link to post
Share on other sites

Hi ill7, I think I made the wrong setting. Now it shows correctly. Thanks for the suggestion. By the way, do you find the solution of showing format as by order:

3 quantities:
5 quantities:
8 quantities:

Thanks


Hi skykit, when you input a new specific price of your product, you need apply a reduction of your initial price, for example $10 and select to apply it on "Amount" or "Percentage".

Have you tried it?

I had your same problem but in 1.4.2.5 version. Version 1.4.3 give to me some problems when I add products in the shopping cart.

Good luck

Share this post


Link to post
Share on other sites

Not at the moment, I can´t find a solution for invert the format of quantities.

I hope some kind soul could help us :)

If I find the solution, I will post here.

Share this post


Link to post
Share on other sites

hi guys!

To invert the listing of the quantity discounts:
go to classes folder, then edit SpecificPrice.php
change all ASC to DESC.

That's what i did. Hope it helps.

Share this post


Link to post
Share on other sites

Hi dramony !!!

Thanks for your HELP! :)

In my "SpecificPrice.php" it had wrote "DESC" and I have changed it for "ASC".

Now it looks correctly.

Thanks you very much

Share this post


Link to post
Share on other sites

Hello guys!!

Great module ... I am a newbee here in Prestashop ... can anyone tell me if there is any known issues with this module while working on PS1.4.3 ??? I am going to deploy it on my site , but wanted to be sure that there is no side effects with this, i did not mean to offend the developer(s), but just want to be safe. So can anyone please give me a link to check how this module working as well.

Share this post


Link to post
Share on other sites

Where can I find how to change the font size, and color, and the background color? Is there a css file where this can be changed?

Share this post


Link to post
Share on other sites

I have the PS v1.4.6.2 and simply not displaying nothing, some one can help me?

Share this post


Link to post
Share on other sites

This mod has been confusing the hell out of me but finally I get it. I had the same issues as Skyit on 1.4.3 as I was setting a set price instead of a discount amount. All good now and the mod is working as it should for me :) Thanks

Share this post


Link to post
Share on other sites

Him I have problem with Prestashop 1.4.3. The Quantity Discount is not work correctly. Is this Support for PrestaShop 1.4.3?? Thanks

 

For those people like skykit (and me) that we have intruduced (or mass imported like me) the reduced price (instead of apllying a reduction).

 

For the module will work correctly, it needs to modify quantitydiscounts.php and replace this line:

discountedPrice = price - {$qd_quantity_discount.reduction};

for this one:

 

discountedPrice = {$qd_quantity_discount.price};

 

Hope this will help.

Regards.

Share this post


Link to post
Share on other sites

Hi Tomer!!!!

 

Great Module!!! Thank you!!!! I attach to you a few ideas we did in PPT that would be awesome to have them in a future version...

 

Thank you!!!

post-274044-0-51304900-1323889549_thumb.png

post-274044-0-16688900-1323889560_thumb.png

post-274044-0-72712500-1323889568_thumb.png

Share this post


Link to post
Share on other sites

V1.2.3 Released

* Fix for "Product Price" discount (not a % or fixed amount).

* Added automatic upgrade notification.

  • Like 1

Share this post


Link to post
Share on other sites

i install the modul, but i dont know where to find the setting, try to find it in catalog, edit product

1. info 2.images 3.prices 4.combination 5.features 6.customization 7.attachment

 

dont seem the "discount" information

 

prestashop 1.4.2.5

Share this post


Link to post
Share on other sites

The module doesn't have a configuration page, it uses Javascript to display below the price in the Front End

Share this post


Link to post
Share on other sites

V1.2.4 released

* Fix for "Quantity Discounts" text (was not translatable in last version).

Share this post


Link to post
Share on other sites

Hi.

I have some issue with version 1.2.7

I do have price rules (quantity discounts) setup on most products however your module shows up only in one of them which is weird.

Two examples:

One product which is on my website for very long time http://www.thebestshop.eu/shop/blank-cartomizers/130-dct-dual-coil-cartomizer-with-hole.html

New product added to stock last night http://www.thebestshop.eu/shop/blank-cartomizers/230-ce2-dct-single-coil-cartomizer.html

 

Same price, same discount rule but quantity discount is displayed only on one of them.

Any solution? Please help.

Share this post


Link to post
Share on other sites

I have found one bug.

Module is working properly only for products without combinations.

Can you help please.

Share this post


Link to post
Share on other sites

When I enable the module I have this product...

The half product page disappear  :(

 

Any solution?

post-374665-0-33512800-1386464233_thumb.jpg

Share this post


Link to post
Share on other sites

The module uses Javascript to add the discounts section in the "buy_block" form.

 

It looks like it is getting messed up because of something in your theme, possibly an open tag.

 

You may want to compare the entire buy_block form that's in your theme, to the default theme.

Share this post


Link to post
Share on other sites

You mean at global.css file?

This is the buy block at css file.

Can you help me please?

 

 

#buy_block {margin:20px 0 0 0;border-width:1px 0 0 0;border-style:solid;}
#buy_block p {}


/* price */
#buy_block div.price {padding:20px 0;overflow:hidden;}

#buy_block span.our_price_display {height:27px;display:block;float:left;}
#buy_block span#our_price_display {display:block;float:left;padding:0px 0 0 0;font-size:20px;}

#buy_block span.our_price_display_tax {display:block;float:left;padding:6px 0 0 5px;}


/* quantity */
#buy_block #quantity_wanted_p {float:right;padding:0 10px 0 0;}
#buy_block #quantity_wanted_p label {float:right;padding:6px 7px 0 0;text-align:right;}
#buy_block #quantity_wanted_p #quantity_wanted {width:20px;height:15px;float:right;padding:5px;text-align:center;}


/* add to cart */
#buy_block #add_to_cart {float:right;margin:0;padding:0;}
#buy_block #add_to_cart input {display:none;}


/* minimal quantity (optional) */
#buy_block #minimal_quantity_wanted_p {margin:0;padding:17px 0;border-width:1px 0 0 0;border-style:solid;}
#buy_block #minimal_quantity_wanted_p #minimal_quantity_label {margin:0 5px;}


/* other product options */
#buy_block .other_options {border-width:1px 0 0 0;border-style:solid;}


/* taxes & discounts */
#buy_block #other_prices {width:50%;float:left;padding:10px 0 0 0;}

#buy_block #other_prices,
#buy_block #other_prices p,
#buy_block #other_prices span {font:12px "Arial";}

#buy_block #other_prices > p {width:100%;min-height:18px;margin:0;padding:13px 0 0 0; }
#buy_block #other_prices > p#old_price{color:#33A33B;}

#buy_block #old_price {text-decoration:line-through;}
#buy_block #reduction_percent {}
#buy_block .pack_price {}
#buy_block .price-ecotax {color:#229922;}

#buy_block #pQuantityAvailable {font-weight:bold;}
#buy_block #pQuantityAvailable span {font-weight:bold;}

#buy_block #last_quantities {font-weight:bold !important;color:#ff0000;}

#buy_block #product_reference label {font-weight:bold;}


/* attributes */
#buy_block #attributes {width:50%;float:right;padding:10px 0 0 0;}
#buy_block #attributes p {margin:0;padding:10px 0 0 0;overflow:hidden;}

#buy_block span.on_sale,
#buy_block span.discount {height:18px;display:block;float:right;margin:10px 0 0 0;padding:3px 7px 0 7px;background:#2b2b2b;color:#fff;}

#buy_block #attributes label {float:right;padding:3px 7px 0 0;text-align:right;}
#buy_block #attributes select {width:120px;height:21px;float:right;padding:1px;}
 

Share this post


Link to post
Share on other sites

I am trying to find the error but nothing.
If you can please check the file
 

{*
* 2007-2012 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <contact@prestashop.com>
*  @copyright  2007-2012 PrestaShop SA
*  @version  Release: $Revision: 14514 $
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*}

{include file="$tpl_dir./errors.tpl"}
{if $errors|@count == 0}
<script type="text/javascript">
// <![CDATA[

// PrestaShop internal settings
var currencySign = '{$currencySign|html_entity_decode:2:"UTF-8"}';
var currencyRate = '{$currencyRate|floatval}';
var currencyFormat = '{$currencyFormat|intval}';
var currencyBlank = '{$currencyBlank|intval}';
var taxRate = {$tax_rate|floatval};
var jqZoomEnabled = {if $jqZoomEnabled}true{else}false{/if};

//JS Hook
var oosHookJsCodeFunctions = new Array();

// Parameters
var id_product = '{$product->id|intval}';
var productHasAttributes = {if isset($groups)}true{else}false{/if};
var quantitiesDisplayAllowed = {if $display_qties == 1}true{else}false{/if};
var quantityAvailable = {if $display_qties == 1 && $product->quantity}{$product->quantity}{else}0{/if};
var allowBuyWhenOutOfStock = {if $allow_oosp == 1}true{else}false{/if};
var availableNowValue = '{$product->available_now|escape:'quotes':'UTF-8'}';
var availableLaterValue = '{$product->available_later|escape:'quotes':'UTF-8'}';
var productPriceTaxExcluded = {$product->getPriceWithoutReduct(true)|default:'null'} - {$product->ecotax};
var reduction_percent = {if $product->specificPrice AND $product->specificPrice.reduction AND $product->specificPrice.reduction_type == 'percentage'}{$product->specificPrice.reduction*100}{else}0{/if};
var reduction_price = {if $product->specificPrice AND $product->specificPrice.reduction AND $product->specificPrice.reduction_type == 'amount'}{$product->specificPrice.reduction}{else}0{/if};
var specific_price = {if $product->specificPrice AND $product->specificPrice.price}{$product->specificPrice.price}{else}0{/if};
var specific_currency = {if $product->specificPrice AND $product->specificPrice.id_currency}true{else}false{/if};
var group_reduction = '{$group_reduction}';
var default_eco_tax = {$product->ecotax};
var ecotaxTax_rate = {$ecotaxTax_rate};
var currentDate = '{$smarty.now|date_format:'%Y-%m-%d %H:%M:%S'}';
var maxQuantityToAllowDisplayOfLastQuantityMessage = {$last_qties};
var noTaxForThisProduct = {if $no_tax == 1}true{else}false{/if};
var displayPrice = {$priceDisplay};
var productReference = '{$product->reference|escape:'htmlall':'UTF-8'}';
var productAvailableForOrder = {if (isset($restricted_country_mode) AND $restricted_country_mode) OR $PS_CATALOG_MODE}'0'{else}'{$product->available_for_order}'{/if};
var productShowPrice = '{if !$PS_CATALOG_MODE}{$product->show_price}{else}0{/if}';
var productUnitPriceRatio = '{$product->unit_price_ratio}';
var idDefaultImage = {if isset($cover.id_image_only)}{$cover.id_image_only}{else}0{/if};
var ipa_default = {if isset($ipa_default)}{$ipa_default}{else}0{/if};

// Customizable field
var img_ps_dir = '{$img_ps_dir}';
var customizationFields = new Array();
{assign var='imgIndex' value=0}
{assign var='textFieldIndex' value=0}
{foreach from=$customizationFields item='field' name='customizationFields'}
	{assign var="key" value="pictures_`$product->id`_`$field.id_customization_field`"}
	customizationFields[{$smarty.foreach.customizationFields.index|intval}] = new Array();
	customizationFields[{$smarty.foreach.customizationFields.index|intval}][0] = '{if $field.type|intval == 0}img{$imgIndex++}{else}textField{$textFieldIndex++}{/if}';
	customizationFields[{$smarty.foreach.customizationFields.index|intval}][1] = {if $field.type|intval == 0 && isset($pictures.$key) && $pictures.$key}2{else}{$field.required|intval}{/if};
{/foreach}

// Images
var img_prod_dir = '{$img_prod_dir}';
var combinationImages = new Array();

{if isset($combinationImages)}
	{foreach from=$combinationImages item='combination' key='combinationId' name='f_combinationImages'}
		combinationImages[{$combinationId}] = new Array();
		{foreach from=$combination item='image' name='f_combinationImage'}
			combinationImages[{$combinationId}][{$smarty.foreach.f_combinationImage.index}] = {$image.id_image|intval};
		{/foreach}
	{/foreach}
{/if}

combinationImages[0] = new Array();
{if isset($images)}
	{foreach from=$images item='image' name='f_defaultImages'}
		combinationImages[0][{$smarty.foreach.f_defaultImages.index}] = {$image.id_image};
	{/foreach}
{/if}

// Translations
var doesntExist = '{l s='The product does not exist in this model. Please choose another.' js=1}';
var doesntExistNoMore = '{l s='This product is no longer in stock' js=1}';
var doesntExistNoMoreBut = '{l s='with those attributes but is available with others' js=1}';
var uploading_in_progress = '{l s='Uploading in progress, please wait...' js=1}';
var fieldRequired = '{l s='Please fill in all required fields, then save the customization.' js=1}';

{if isset($groups)}
	// Combinations
	{foreach from=$combinations key=idCombination item=combination}
		addCombination({$idCombination|intval}, new Array({$combination.list}), {$combination.quantity}, {$combination.price}, {$combination.ecotax}, {$combination.id_image}, '{$combination.reference|addslashes}', {$combination.unit_impact}, {$combination.minimal_quantity});
	{/foreach}
	// Colors
	{if $colors|@count > 0}
		{if $product->id_color_default}var id_color_default = {$product->id_color_default|intval};{/if}
	{/if}
{/if}
//]]>
</script>

{include file="$tpl_dir./breadcrumb.tpl"}
<div id="primary_block" class="clearfix">
	<h1>{$product->name|escape:'htmlall':'UTF-8'}</h1>

	{if isset($adminActionDisplay) && $adminActionDisplay}
	<div id="admin-action">
		<p>{l s='This product is not visible to your customers.'}
		<input type="hidden" id="admin-action-product-id" value="{$product->id}" />
		<input type="submit" value="{l s='Publish'}" class="exclusive" onclick="submitPublishProduct('{$base_dir}{$smarty.get.ad}', 0)"/>
		<input type="submit" value="{l s='Back'}" class="exclusive" onclick="submitPublishProduct('{$base_dir}{$smarty.get.ad}', 1)"/>
		</p>
		<div class="clear" ></div>
		<p id="admin-action-result"></p>
		</p>
	</div>
	{/if}

	{if isset($confirmation) && $confirmation}
	<p class="confirmation">
		{$confirmation}
	</p>
	{/if}

	<!-- right infos-->
	<div id="pb-right-column">
		<!-- product img-->
		<div id="image-block">
		{if $have_image}
			<img src="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'large')}"
				{if $jqZoomEnabled}class="jqzoom" alt="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'thickbox')}"{else} title="{$product->name|escape:'htmlall':'UTF-8'}" alt="{$product->name|escape:'htmlall':'UTF-8'}" {/if} id="bigpic" width="{$largeSize.width}" height="{$largeSize.height}" />
		{else}
			<img src="{$img_prod_dir}{$lang_iso}-default-large.jpg" id="bigpic" alt="" title="{$cover.legend|escape:'htmlall':'UTF-8'}" width="{$largeSize.width}" height="{$largeSize.height}" />
		{/if}
		</div>

		{if isset($images) && count($images) > 0}
		<!-- thumbnails -->
		<div id="views_block" {if isset($images) && count($images) < 2}class="hidden"{/if}>
		{if isset($images) && count($images) > 3}<span class="view_scroll_spacer"><a id="view_scroll_left" class="hidden" title="{l s='Other views'}" href="javascript:{ldelim}{rdelim}">{l s='Previous'}</a></span>{/if}
		<div id="thumbs_list">
			<ul id="thumbs_list_frame">
				{if isset($images)}
					{foreach from=$images item=image name=thumbnails}
					{assign var=imageIds value="`$product->id`-`$image.id_image`"}
					<li id="thumbnail_{$image.id_image}">
						<a href="{$link->getImageLink($product->link_rewrite, $imageIds, 'thickbox')}" rel="other-views" class="thickbox {if (isset($image.cover) AND $image.cover == 1) OR (!isset($image.cover) AND $smarty.foreach.thumbnails.first)}shown{/if}" title="{$image.legend|htmlspecialchars}">
							<img id="thumb_{$image.id_image}" src="{$link->getImageLink($product->link_rewrite, $imageIds, 'medium')}" alt="{$image.legend|htmlspecialchars}" height="{$mediumSize.height}" width="{$mediumSize.width}" />
						</a>
					</li>
					{/foreach}
				{/if}
			</ul>
		</div>
		{if isset($images) && count($images) > 3}<a id="view_scroll_right" title="{l s='Other views'}" href="javascript:{ldelim}{rdelim}">{l s='Next'}</a>{/if}
		</div>
		{/if}
		{if isset($images) && count($images) > 1}<p class="align_center clear"><span id="wrapResetImages" style="display: none;"><img src="{$img_dir}icon/cancel_16x18.gif" alt="{l s='Cancel'}" width="16" height="18"/> <a id="resetImages" href="{$link->getProductLink($product)}" onclick="$('span#wrapResetImages').hide('slow');return (false);">{l s='Display all pictures'}</a></span></p>{/if}
		<!-- usefull links-->
		<ul id="usefull_link_block">
			{if $HOOK_EXTRA_LEFT}{$HOOK_EXTRA_LEFT}{/if}
			<li><a href="javascript:print();">{l s='Print'}</a><br class="clear" /></li>
			{if $have_image && !$jqZoomEnabled}
			<li><span id="view_full_size" class="span_link">{l s='View full size'}</span></li>
			{/if}
		</ul>
	</div>

	<!-- left infos-->
	<div id="pb-left-column">
		{if $product->description_short OR $packItems|@count > 0}
		<div id="short_description_block">
			{if $product->description_short}
				<div id="short_description_content" class="rte align_justify">{$product->description_short}</div>
			{/if}
			{if $product->description}
			<p class="buttons_bottom_block"><a href="javascript:{ldelim}{rdelim}" class="button">{l s='More details'}</a></p>
			{/if}
			{if $packItems|@count > 0}
				<h3>{l s='Pack content'}</h3>
				{foreach from=$packItems item=packItem}
					<div class="pack_content">
						{$packItem.pack_quantity} x <a href="{$link->getProductLink($packItem.id_product, $packItem.link_rewrite, $packItem.category)}">{$packItem.name|escape:'htmlall':'UTF-8'}</a>
						<p>{$packItem.description_short}</p>
					</div>
				{/foreach}
			{/if}
		</div>
		{/if}

		{if isset($colors) && $colors}
		<!-- colors -->
		<div id="color_picker">
			<p>{l s='Pick a color:' js=1}</p>
			<div class="clear"></div>
			<ul id="color_to_pick_list">
			{foreach from=$colors key='id_attribute' item='color'}
				<li><a id="color_{$id_attribute|intval}" class="color_pick" style="background: {$color.value};" onclick="updateColorSelect({$id_attribute|intval});$('#wrapResetImages').show('slow');" title="{$color.name}">{if file_exists($col_img_dir|cat:$id_attribute|cat:'.jpg')}<img src="{$img_col_dir}{$id_attribute}.jpg" alt="{$color.name}" width="20" height="20" />{/if}</a></li>
			{/foreach}
			</ul>
			<div class="clear"></div>
		</div>
		{/if}
		
		

		{if ($product->show_price AND !isset($restricted_country_mode)) OR isset($groups) OR $product->reference OR (isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS)}
		<!-- add to cart form-->
		<form id="buy_block" {if $PS_CATALOG_MODE AND !isset($groups) AND $product->quantity > 0}class="hidden"{/if} action="{$link->getPageLink('cart.php')}" method="post">

			<!-- hidden datas -->
			<p class="hidden">
				<input type="hidden" name="token" value="{$static_token}" />
				<input type="hidden" name="id_product" value="{$product->id|intval}" id="product_page_product_id" />
				<input type="hidden" name="add" value="1" />
				<input type="hidden" name="id_product_attribute" id="idCombination" value="" />
			</p>
			
			

			<!-- prices -->
			{if $product->show_price AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE}
				<p class="price">
					{if !$priceDisplay || $priceDisplay == 2}
						{assign var='productPrice' value=$product->getPrice(true, $smarty.const.NULL, 2)}
						{assign var='productPriceWithoutRedution' value=$product->getPriceWithoutReduct(false, $smarty.const.NULL)}
					{elseif $priceDisplay == 1}
						{assign var='productPrice' value=$product->getPrice(false, $smarty.const.NULL, 2)}
						{assign var='productPriceWithoutRedution' value=$product->getPriceWithoutReduct(true, $smarty.const.NULL)}
					{/if}
					{if $product->on_sale}
						<img src="{$img_dir}onsale_{$lang_iso}.gif" alt="{l s='On sale'}" class="on_sale_img"/>
						<span class="on_sale">{l s='On sale!'}</span>
					{elseif $product->specificPrice AND $product->specificPrice.reduction AND $productPriceWithoutRedution > $productPrice}
						<span class="discount">{l s='Reduced price!'}</span>
					{/if}
					<br />
					<span class="our_price_display">
					{if $priceDisplay >= 0 && $priceDisplay <= 2}
						<span id="our_price_display">{convertPrice price=$productPrice}</span>
							{if $tax_enabled  && ((isset($display_tax_label) && $display_tax_label == 1) OR !isset($display_tax_label))}
								{if $priceDisplay == 1}{l s='tax excl.'}{else}{l s='tax incl.'}{/if}
							{/if}
					{/if}
					</span>
					{if $priceDisplay == 2}
						<br />
						<span id="pretaxe_price"><span id="pretaxe_price_display">{convertPrice price=$product->getPrice(false, $smarty.const.NULL, 2)}</span> {l s='tax excl.'}</span>
					{/if}
					<br />
				</p>
				{if $product->specificPrice AND $product->specificPrice.reduction}
					<p id="old_price"><span class="bold">
					{if $priceDisplay >= 0 && $priceDisplay <= 2}
						{if $productPriceWithoutRedution > $productPrice}
							<span id="old_price_display">{convertPrice price=$productPriceWithoutRedution}</span>
								{if $tax_enabled && $display_tax_label == 1}
									{if $priceDisplay == 1}{l s='tax excl.'}{else}{l s='tax incl.'}{/if}
								{/if}
						{/if}
					{/if}
					</span>
					</p>

				{/if}
				{if $product->specificPrice AND $product->specificPrice.reduction_type == 'percentage'}
					<p id="reduction_percent">{l s='(price reduced by'} <span id="reduction_percent_display">{$product->specificPrice.reduction*100}</span> %{l s=')'}</p>
				{/if}
				{if $packItems|@count}
					<p class="pack_price">{l s='instead of'} <span style="text-decoration: line-through;">{convertPrice price=$product->getNoPackPrice()}</span></p>
					<br class="clear" />
				{/if}
				{if $product->ecotax != 0}
					<p class="price-ecotax">{l s='include'} <span id="ecotax_price_display">{if $priceDisplay == 2}{$ecotax_tax_exc|convertAndFormatPrice}{else}{$ecotax_tax_inc|convertAndFormatPrice}{/if}</span> {l s='for green tax'}
						{if $product->specificPrice AND $product->specificPrice.reduction}
						<br />{l s='(not impacted by the discount)'}
						{/if}
					</p>
				{/if}
				{if !empty($product->unity) && $product->unit_price_ratio > 0.000000}
				    {math equation="pprice / punit_price"  pprice=$productPrice  punit_price=$product->unit_price_ratio assign=unit_price}
					<p class="unit-price"><span id="unit_price_display">{convertPrice price=$unit_price}</span> {l s='per'} {$product->unity|escape:'htmlall':'UTF-8'}</p>
				{/if}
				{*close if for show price*}
			{/if}

			{if isset($groups)}
			<!-- attributes -->
			<div id="attributes">
			{foreach from=$groups key=id_attribute_group item=group}
			{if $group.attributes|@count}
			<p>
				<label for="group_{$id_attribute_group|intval}">{$group.name|escape:'htmlall':'UTF-8'} :</label>
				{assign var="groupName" value="group_$id_attribute_group"}
				<select name="{$groupName}" id="group_{$id_attribute_group|intval}" onchange="javascript:findCombination();{if $colors|@count > 0}$('#wrapResetImages').show('slow');{/if};">
					{foreach from=$group.attributes key=id_attribute item=group_attribute}
						<option value="{$id_attribute|intval}"{if (isset($smarty.get.$groupName) && $smarty.get.$groupName|intval == $id_attribute) || $group.default == $id_attribute} selected="selected"{/if} title="{$group_attribute|escape:'htmlall':'UTF-8'}">{$group_attribute|escape:'htmlall':'UTF-8'}</option>
					{/foreach}
				</select>
			</p>
			{/if}
			{/foreach}
			</div>
			{/if}

			<p id="product_reference" {if isset($groups) OR !$product->reference}style="display: none;"{/if}><label for="product_reference">{l s='Reference :'} </label><span class="editable">{$product->reference|escape:'htmlall':'UTF-8'}</span></p>

			<!-- quantity wanted -->
			<p id="quantity_wanted_p"{if (!$allow_oosp && $product->quantity <= 0) OR $virtual OR !$product->available_for_order OR $PS_CATALOG_MODE} style="display: none;"{/if}>
				<label>{l s='Quantity :'}</label>
				<input type="text" name="qty" id="quantity_wanted" class="text" value="{if isset($quantityBackup)}{$quantityBackup|intval}{else}{if $product->minimal_quantity > 1}{$product->minimal_quantity}{else}1{/if}{/if}" size="2" maxlength="3" {if $product->minimal_quantity > 1}onkeyup="checkMinimalQuantity({$product->minimal_quantity});"{/if} />
			</p>

			<!-- minimal quantity wanted -->
			<p id="minimal_quantity_wanted_p"{if $product->minimal_quantity <= 1 OR !$product->available_for_order OR $PS_CATALOG_MODE} style="display: none;"{/if}>{l s='You must add '} <b id="minimal_quantity_label">{$product->minimal_quantity}</b> {l s=' as a minimum quantity to buy this product.'}</p>
			{if $product->minimal_quantity > 1}
			<script type="text/javascript">
				checkMinimalQuantity();
			</script>
			{/if}

			<!-- availability -->
			<p id="availability_statut"{if ($product->quantity <= 0 && !$product->available_later && $allow_oosp) OR ($product->quantity > 0 && !$product->available_now) OR !$product->available_for_order OR $PS_CATALOG_MODE} style="display: none;"{/if}>
				<span id="availability_label">{l s='Availability:'}</span>
				<span id="availability_value"{if $product->quantity <= 0} class="warning_inline"{/if}>
					{if $product->quantity <= 0}{if $allow_oosp}{$product->available_later}{else}{l s='This product is no longer in stock'}{/if}{else}{$product->available_now}{/if}
				</span>
			</p>

			<!-- number of item in stock -->
			{if ($display_qties == 1 && !$PS_CATALOG_MODE && $product->available_for_order)}
			<p id="pQuantityAvailable"{if $product->quantity <= 0} style="display: none;"{/if}>
				<span id="quantityAvailable">{$product->quantity|intval}</span>
				<span {if $product->quantity > 1} style="display: none;"{/if} id="quantityAvailableTxt">{l s='item in stock'}</span>
				<span {if $product->quantity == 1} style="display: none;"{/if} id="quantityAvailableTxtMultiple">{l s='items in stock'}</span>
			</p>
			{/if}
			<!-- Out of stock hook -->
			{if !$allow_oosp}
			<p id="oosHook"{if $product->quantity > 0} style="display: none;"{/if}>
				{$HOOK_PRODUCT_OOS}
			</p>
			{/if}

			<p class="warning_inline" id="last_quantities"{if ($product->quantity > $last_qties OR $product->quantity <= 0) OR $allow_oosp OR !$product->available_for_order OR $PS_CATALOG_MODE} style="display: none;"{/if} >{l s='Warning: Last items in stock!'}</p>

			{if $product->online_only}
				<p>{l s='Online only'}</p>
			{/if}

			<p{if (!$allow_oosp && $product->quantity <= 0) OR !$product->available_for_order OR (isset($restricted_country_mode) AND $restricted_country_mode) OR $PS_CATALOG_MODE} style="display: none;"{/if} id="add_to_cart" class="buttons_bottom_block"><input type="submit" name="Submit" value="{l s='Add to cart'}" class="exclusive" /></p>
			{if isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS}{$HOOK_PRODUCT_ACTIONS}{/if}
			<div class="clear"></div>
		</form>
		{/if}
		{if $HOOK_EXTRA_RIGHT}{$HOOK_EXTRA_RIGHT}{/if}
	</div>
</div>

{if $quantity_discounts}
<!-- quantity discount -->
<ul class="idTabs">
	<li><a style="cursor: pointer" class="selected">{l s='Quantity discount'}</a></li>
</ul>
<div id="quantityDiscount">
	<table class="std">
		<tr>
			{foreach from=$quantity_discounts item='quantity_discount' name='quantity_discounts'}
				<th>{$quantity_discount.quantity|intval}
				{if $quantity_discount.quantity|intval > 1}
					{l s='quantities'}
				{else}
					{l s='quantity'}
				{/if}
				</th>
			{/foreach}
		</tr>
		<tr>
			{foreach from=$quantity_discounts item='quantity_discount' name='quantity_discounts'}
				<td>
				{if $quantity_discount.price != 0 OR $quantity_discount.reduction_type == 'amount'}
					-{convertPrice price=$quantity_discount.real_value|floatval}
				{else}
					-{$quantity_discount.real_value|floatval}%
				{/if}
				</td>
			{/foreach}
		</tr>
	</table>
</div>
{/if}

{$HOOK_PRODUCT_FOOTER}

<!-- description and features -->
{if $product->description || $features || $accessories || $HOOK_PRODUCT_TAB || $attachments}
<div id="more_info_block" class="clear">
	<ul id="more_info_tabs" class="idTabs idTabsShort">
		{if $product->description}<li><a id="more_info_tab_more_info" href="#idTab1">{l s='More info'}</a></li>{/if}
		{if $features}<li><a id="more_info_tab_data_sheet" href="#idTab2">{l s='Data sheet'}</a></li>{/if}
		{if $attachments}<li><a id="more_info_tab_attachments" href="#idTab9">{l s='Download'}</a></li>{/if}
		{if isset($accessories) AND $accessories}<li><a href="#idTab4">{l s='Accessories'}</a></li>{/if}
		{$HOOK_PRODUCT_TAB}
	</ul>
	<div id="more_info_sheets" class="sheets align_justify">
	{if $product->description}
		<!-- full description -->
		<div id="idTab1" class="rte">{$product->description}</div>
	{/if}
	{if $features}
		<!-- product's features -->
		<ul id="idTab2" class="bullet">
		{foreach from=$features item=feature}
			<li><span>{$feature.name|escape:'htmlall':'UTF-8'}</span> {$feature.value|escape:'htmlall':'UTF-8'}</li>
		{/foreach}
		</ul>
	{/if}
	{if $attachments}
		<ul id="idTab9" class="bullet">
		{foreach from=$attachments item=attachment}
			<li><a href="{$link->getPageLink('attachment.php', true)}?id_attachment={$attachment.id_attachment}">{$attachment.name|escape:'htmlall':'UTF-8'}</a><br />{$attachment.description|escape:'htmlall':'UTF-8'}</li>
		{/foreach}
		</ul>
	{/if}
	{if isset($accessories) AND $accessories}
		<!-- accessories -->
		<ul id="idTab4" class="bullet">
			<div class="block products_block accessories_block clearfix">
				<div class="block_content">
					<ul>
					{foreach from=$accessories item=accessory name=accessories_list}
						{assign var='accessoryLink' value=$link->getProductLink($accessory.id_product, $accessory.link_rewrite, $accessory.category)}
						<li class="ajax_block_product {if $smarty.foreach.accessories_list.first}first_item{elseif $smarty.foreach.accessories_list.last}last_item{else}item{/if} product_accessories_description">
							<h5><a href="{$accessoryLink|escape:'htmlall':'UTF-8'}">{$accessory.name|truncate:22:'...':true|escape:'htmlall':'UTF-8'}</a></h5>
							<div class="product_desc">
								<a href="{$accessoryLink|escape:'htmlall':'UTF-8'}" title="{$accessory.legend|escape:'htmlall':'UTF-8'}" class="product_image"><img src="{$link->getImageLink($accessory.link_rewrite, $accessory.id_image, 'medium')}" alt="{$accessory.legend|escape:'htmlall':'UTF-8'}" width="{$mediumSize.width}" height="{$mediumSize.height}" /></a>
								<a href="{$accessoryLink|escape:'htmlall':'UTF-8'}" title="{l s='More'}" class="product_description">{$accessory.description_short|strip_tags|truncate:70:'...'}</a>
							</div>
							<p class="product_accessories_price">
								{if $accessory.show_price AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE}<span class="price">{if $priceDisplay != 1}{displayWtPrice p=$accessory.price}{else}{displayWtPrice p=$accessory.price_tax_exc}{/if}</span>{/if}
								<a class="button" href="{$accessoryLink|escape:'htmlall':'UTF-8'}" title="{l s='View'}">{l s='View'}</a>
								{if ($accessory.allow_oosp || $accessory.quantity > 0) AND $accessory.available_for_order AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE}
									<a class="exclusive button ajax_add_to_cart_button" href="{$link->getPageLink('cart.php')}?qty=1&id_product={$accessory.id_product|intval}&token={$static_token}&add" rel="ajax_id_product_{$accessory.id_product|intval}" title="{l s='Add to cart'}">{l s='Add to cart'}</a>
								{else}
									<span class="exclusive">{l s='Add to cart'}</span>
									<span class="availability">{if (isset($accessory.quantity_all_versions) && $accessory.quantity_all_versions > 0)}{l s='Product available with different options'}{else}{l s='Out of stock'}{/if}</span>
								{/if}
							</p>
						</li>

					{/foreach}
					</ul>
				</div>
			</div>
		</ul>
	{/if}
	{$HOOK_PRODUCT_TAB_CONTENT}
	</div>
</div>
{/if}

<!-- Customizable products -->
{if $product->customizable}
	<ul class="idTabs">
		<li><a style="cursor: pointer">{l s='Product customization'}</a></li>
	</ul>
	<div class="customization_block">
		<form method="post" action="{$customizationFormTarget}" enctype="multipart/form-data" id="customizationForm">
			<p>
				<img src="{$img_dir}icon/infos.gif" alt="Informations" />
				{l s='After saving your customized product, remember to add it to your cart.'}
				{if $product->uploadable_files}<br />{l s='Allowed file formats are: GIF, JPG, PNG'}{/if}
			</p>
			{if $product->uploadable_files|intval}
			<h2>{l s='Pictures'}</h2>
			<ul id="uploadable_files">
				{counter start=0 assign='customizationField'}
				{foreach from=$customizationFields item='field' name='customizationFields'}
					{if $field.type == 0}
						<li class="customizationUploadLine{if $field.required} required{/if}">{assign var='key' value='pictures_'|cat:$product->id|cat:'_'|cat:$field.id_customization_field}
							{if isset($pictures.$key)}<div class="customizationUploadBrowse">
									<img src="{$pic_dir}{$pictures.$key}_small" alt="" />
									<a href="{$link->getProductDeletePictureLink($product, $field.id_customization_field)}" title="{l s='Delete'}" >
										<img src="{$img_dir}icon/delete.gif" alt="{l s='Delete'}" class="customization_delete_icon" width="11" height="13" />
									</a>
								</div>{/if}
							<div class="customizationUploadBrowse"><input type="file" name="file{$field.id_customization_field}" id="img{$customizationField}" class="customization_block_input {if isset($pictures.$key)}filled{/if}" />{if $field.required}<sup>*</sup>{/if}
							<div class="customizationUploadBrowseDescription">{if !empty($field.name)}{$field.name}{else}{l s='Please select an image file from your hard drive'}{/if}</div></div>
						</li>
						{counter}
					{/if}
				{/foreach}
			</ul>
			{/if}
			<div class="clear"></div>
			{if $product->text_fields|intval}
			<h2>{l s='Texts'}</h2>
			<ul id="text_fields">
				{counter start=0 assign='customizationField'}
				{foreach from=$customizationFields item='field' name='customizationFields'}
					{if $field.type == 1}
						<li class="customizationUploadLine{if $field.required} required{/if}">{assign var='key' value='textFields_'|cat:$product->id|cat:'_'|cat:$field.id_customization_field}
							{if !empty($field.name)}{$field.name}{/if}{if $field.required}<sup>*</sup>{/if}<textarea type="text" name="textField{$field.id_customization_field}" id="textField{$customizationField}" rows="1" cols="40" class="customization_block_input" />{if isset($textFields.$key)}{$textFields.$key|stripslashes}{/if}</textarea>
						</li>
						{counter}
					{/if}
				{/foreach}
			</ul>
			{/if}
			<p style="clear: left;" id="customizedDatas">
				<input type="hidden" name="ipa_customization" id="ipa_customization" value="{$ipa_customization}" />
				<input type="hidden" name="quantityBackup" id="quantityBackup" value="" />
				<input type="hidden" name="submitCustomizedDatas" value="1" />
				<input type="button" class="button" value="{l s='Save'}" onclick="javascript:saveCustomization()" />
				<span id="ajax-loader" style="display:none"><img src="{$img_ps_dir}loader.gif" alt="loader" /></span>
			</p>
		</form>
		<p class="clear required"><sup>*</sup> {l s='required fields'}</p>
	</div>
{/if}

{if $packItems|@count > 0}
	<div>
		<h2>{l s='Pack content'}</h2>
		{include file="$tpl_dir./product-list.tpl" products=$packItems}
	</div>
{/if}

{/if}


Share this post


Link to post
Share on other sites