Jump to content

Discount price how to show price with discount?


siwilson

Recommended Posts

Hi Siwilson,

 

where do you want it? product list page, or elsewhere?

 

old_price_display:

{convertPrice price=$productPriceWithoutRedution}

our_price_display:

{convertPrice price=$productPrice}

percentage:

{$product->specificPrice.reduction*100}

Link to comment
Share on other sites

Hi siwilson,

 

40 quantities : (655-125)X40 = 21200

30 quantities : (655-095)X30 = 16800

20 quantities: (655-055)X20 = 12000

 

the sum:

{convertPrice price=(($productPrice-$quantity_discount.real_value)*$quantity_discount.quantity)}

Link to comment
Share on other sites

okay sorry, the file: product.tpl in your theme folder (blackwhite).

edit product.tpl, search: " quantity discount ", after that you see something like this:

 

<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}

{convertPrice price=(($productPrice-$quantity_discount.real_value)*$quantity_discount.quantity)}

 

 

 

{else}

-{$quantity_discount.real_value|floatval}%

{/if} </td>

{/foreach} </tr>

</table>

</div>

  • Like 1
Link to comment
Share on other sites

Many thanks!

 

I have amended the file, but i don't think it does what i need it to do?

 

I would like the price to reflect the total price with discount, so 40 QTY would be £price minus discount amount = total price with (£6.55-£1.25 = £5.30) discount, if this makes sense?

Link to comment
Share on other sites

does not matter :)

(£6.55-£1.25 = £5.30) make the sum:

{convertPrice price=($productPrice-$quantity_discount.real_value)}

is easy explained:

$productPrice = default price

$quantity_discount.real_value = quantity discount

 

so calculation is: $productPrice minus $quantity_discount.real_value

these two values we do in class: convertPrice price() that makes together:

convertPrice price=($productPrice-$quantity_discount.real_value)

 

see the code properly,and you see that it is not difficult.. ;)

  • Like 1
Link to comment
Share on other sites

I have still don't get the correct value :( maybe im stupid...

 

Here is my code

<!-- quantity discount -->
{if $quantity_discounts}

<div id="quantityDiscount">

	<ul class="idTabs">
		<h6>{l s='Quantity discount'}</h6>
	</ul>
 <p>Price reduction per bag depending on bag quantity ordered</p>
	<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'}
					-[color=#ff0000]{convertPrice price=($productPrice-$quantity_discount.real_value)}[/color]
				{else}
					-{$quantity_discount.real_value|floatval}%
				{/if}
				</td>
			{/foreach}
		</tr>
	</table>
</div>

Link to comment
Share on other sites

Sorry for the delay, and thanks for your help.

 

It still doesnt work, though i think i know why.

 

In admin the three discount prices are set as a specifc price, not the original price minus a discount, if that makes sense?

Link to comment
Share on other sites

hmm, still not displaying correctly, strange! I have attached the whole code and a screen shot of the admin

{*
* 2007-2011 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 [email protected] 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 <[email protected]>
*  @copyright  2007-2011 PrestaShop SA
*  @version  Release: $Revision: 1.4 $
*  @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}

{include file="$tpl_dir./breadcrumb.tpl"}
<!-- right infos-->
<div id="primary_block" class="clearfix">
{if isset($adminActionDisplay) && $adminActionDisplay}
<div id="admin-action">
 <p>{l s='This product is not visible to your customers.'}
 <input id="admin-action-product-id" value="{$product->id}" type="hidden">
 <input value="{l s='Publish'}" class="exclusive" onclick="submitPublishProduct('{$base_dir}{$smarty.get.ad}', 0)" type="submit">
 <input value="{l s='Back'}" class="exclusive" onclick="submitPublishProduct('{$base_dir}{$smarty.get.ad}', 1)" type="submit">
 </p>
 <div class="clear"></div>
 <p id="admin-action-result"></p>
 <p></p>
</div>
{/if}
<!-- left infos-->
<div id="pb-right-column">
 <!-- product img-->
  {if $have_image && !$jqZoomEnabled}
<li><span id="view_full_size" class="view_full_size"> </span></li>
  {/if}
  <div id="image-block">
{if $have_image}
  <img src="%7B$link-%3EgetImageLink%28$product-%3Elink_rewrite,%20$cover.id_image,%20%27large%27%29%7D" {if="" $jqzoomenabled}class="jqzoom" alt="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'thickbox')}" {else}="" title="{$product->name|escape:'htmlall':'UTF-8'}" {="" if}="" id="bigpic" height="{$largeSize.height}" width="{$largeSize.width}">
 {else}
  <img src="%7B$img_prod_dir%7D%7B$lang_iso%7D-default-large.jpg" id="bigpic" alt="" title="{$product->name|escape:'htmlall':'UTF-8'}" height="{$largeSize.height}" width="{$largeSize.width}">
 {/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="%7B$link-%3EgetImageLink%28$product-%3Elink_rewrite,%20$imageIds,%20%27thickbox%27%29%7D" rel="other-views" class="thickbox {if $smarty.foreach.thumbnails.first}shown{/if}" title="{$image.legend|htmlspecialchars}">
   <img id="thumb_{$image.id_image}" src="%7B$link-%3EgetImageLink%28$product-%3Elink_rewrite,%20$imageIds,%20%27medium%27%29%7D" alt="{$image.legend|htmlspecialchars}" height="50" width="50">
  </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="%7B$img_dir%7Dicon/cancel_16x18.gif" alt="{l s='Cancel'}" height="18" width="16">
	  <a id="resetImages" href="%7B$link-%3EgetProductLink%28$product%29%7D" onclick="$('span#wrapResetImages').hide('slow');return (false);">{l s='Display all pictures'}</a>
	 </span>
	</p>
   {/if}
 </div>
<!-- right infos-->
<div id="pb-left-column">
 <h1>{$product->name|escape:'htmlall':'UTF-8'}</h1>
 {if $product->description_short}
  <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 if_more_details">{l s='More details'}</a></p>
  {/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>
	 </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)="" $product-="">quantity > 0}class="hidden"{/if} action="{$link->getPageLink('cart.php')}" method="post">
 {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="%7B$img_col_dir%7D%7B$id_attribute%7D.jpg" alt="{$color.name}" height="20" width="20">{/if}</a></li>
  {/foreach}
  </ul>
  <div class="clear"></div>
 </div>
 {/if}

  <!-- hidden datas -->
  <p class="hidden">
<input name="token" value="{$static_token}" type="hidden">
<input name="id_product" value="{$product->id|intval}" id="product_page_product_id" type="hidden">
<input name="add" value="1" type="hidden">
<input name="id_product_attribute" id="idCombination" value="" type="hidden">
  </p>
  {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}
 <!-- quantity discount -->
{if $quantity_discounts}

<div id="quantityDiscount">

	<ul class="idTabs">
		<h6>{l s='Quantity discount'}</h6>
	</ul>
 <p>Price reduction per bag depending on bag quantity ordered</p>

			{foreach from=$quantity_discounts item='quantity_discount' name='quantity_discounts'}

			{/foreach}

			{foreach from=$quantity_discounts item='quantity_discount' name='quantity_discounts'}

			{/foreach}
		<table class="std">
		<tbody><tr><th>{$quantity_discount.quantity|intval}
				{if $quantity_discount.quantity|intval > 1}
					{l s='quantities'}
				{else}
					{l s='quantity'}
				{/if}
				</th></tr>
		<tr><td>
				{if $quantity_discount.price != 0 OR $quantity_discount.reduction_type == 'amount'}
					-{convertPrice price=($productPrice-$quantity_discount.real_value)}
				{else}
					-{$quantity_discount.real_value|floatval}%
				{/if}
				</td></tr>
	</tbody></table>
</div>
{/if}
  <!-- prices -->
  {if $product->show_price AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE}
		 <div id="global_price">
		  <ul>
		   <li>
<p class="price">
 {if !$priceDisplay || $priceDisplay == 2}
  {assign var='productPrice' value=$product->getPrice(true, $smarty.const.NULL)}
  {assign var='productPriceWithoutRedution' value=$product->getPriceWithoutReduct(false, $smarty.const.NULL)}
 {elseif $priceDisplay == 1}
  {assign var='productPrice' value=$product->getPrice(false, $smarty.const.NULL)}
  {assign var='productPriceWithoutRedution' value=$product->getPriceWithoutReduct(true, $smarty.const.NULL)}
 {/if}
 {if $product->on_sale}
  <img src="%7B$img_dir%7Donsale_%7B$lang_iso%7D.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}
 {if $priceDisplay == 2}

  <span id="pretaxe_price">
					 <span id="pretaxe_price_display">{convertPrice price=$product->getPrice(false, $smarty.const.NULL)}</span> <b>{l s='tax excl.'}</b>
					</span>

 {/if}
</p>
{if $product->specificPrice AND $product->specificPrice.reduction_type == 'percentage'}
 <span id="reduction_percent_display">{l s='( - '} {$product->specificPrice.reduction*100} %{l s=')'}</span>
{/if}
{if $packItems|@count}
 {l s='instead of'} <span style="text-decoration: line-through;">{convertPrice price=$product->getNoPackPrice()}</span>

{/if}
{if $product->specificPrice AND $product->specificPrice.reduction}
			 <span id="old_price" class="bold">
			  {if $priceDisplay >= 0 && $priceDisplay <= 2}
				{if $productPriceWithoutRedution > $productPrice}
				  <span id="old_price_display">{convertPrice price=$productPriceWithoutRedution}</span>
				   {if $tax_enabled}
					{if $priceDisplay == 1}{l s='tax excl.'}{else}{l s='tax incl.'}{/if}
				   {/if}
				{/if}
			{/if}
			 </span>
{/if}

{if $product->ecotax != 0}
 {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}

{l s='(not impacted by the discount)'}
  {/if}
{/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}

			{if $priceDisplay >= 0 && $priceDisplay <= 2}
			<p class="our_order_price">
 <span class="our_price_display">
  <span id="our_price_display">{convertPrice price=$productPrice}</span>
 {if $tax_enabled}
  {if $priceDisplay == 1}{l s='Inc VAT.'}{else}{l s='Inc VAT.'}{/if}
 {/if}
</span>
			</p>
   {/if}
{*close if for show price*}
		   </li>
		  </ul>
		 </div>
  {/if}
	   <div class="clear"></div>
	   <div{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_it">
  <!-- 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}>
		<input 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-="" type="text">minimal_quantity > 1}onkeyup="checkMinimalQuantity({$product->minimal_quantity});"{/if} />
  </p>
  <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">
		 <input name="Submit" value="{l s='Add to cart'}" class="add_to_cart" type="submit">
		<p></p>
	   </p{if></div{if></form></div>

  <!-- 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}

  {/if}
  <div class="clear"></div>
  <!-- availability -->
  <p id="availability_statut" {if="" ($product-="">quantity == 0 && !$product->available_later) 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>
  <div class="clear"></div>
  <!-- number of item in stock -->
  {if ($product->quantity <= $last_qties OR isset($combination.list))}
  <p id="pQuantityAvailable" {if="" $display_qties="" !="1" or="" $product-="">quantity <= 0 OR !$product->available_for_order OR $PS_CATALOG_MODE} 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}
  <div class="clear"></div>
  <!-- Out of stock hook -->
  <p id="oosHook" {if="" $product-="">quantity > 0} style="display: none;"{/if}>
{$HOOK_PRODUCT_OOS}
  </p>
  <div class="clear"></div>
  <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}






  {if isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS}{$HOOK_PRODUCT_ACTIONS}{/if}

 {/if}
  <div class="clear"></div>
		<!-- usefull links-->
		<ul id="usefull_link_block">
		 <div class="addthis_toolbox addthis_default_style ">
		  <a href="http://www.addthis.com/bookmark.php" class="addthis_button_email"><img src="%7B$img_dir%7Demail.png" alt="email" height="16" width="16"></a>	  
		  <a class="addthis_button_preferred_12"><img src="%7B$img_dir%7Ddelicious.png" alt="delicious" height="16" width="16"></a>
		  <a class="addthis_button_preferred_6"><img src="%7B$img_dir%7Dtwitter.png" alt="twitter" height="16" width="16"></a>
		  <a class="addthis_button_preferred_8"></a>
		  <a class="addthis_button_preferred_10"></a>
		  <a class="addthis_button_compact"><img src="%7B$img_dir%7Daddthis.png" alt="addthis" height="16" width="18"></a>
		  <a class="addthis_counter addthis_bubble_style"></a>
		  <a class="addthis_button_facebook_like" fb:like:layout="button_count" style="margin:-2px 0 0 3px; float:right;"></a>
		  <!-- AddThis Button END -->
		 </div>
		</ul>
  <div class="clear"></div>

 {if $HOOK_EXTRA_RIGHT}{$HOOK_EXTRA_RIGHT}{/if}
</div>



 <!-- packItems -->
{if $packItems|@count > 0}
   <div>
		<h2>{l s='Pack content'}</h2>
		{include file="$tpl_dir./product-list.tpl" products=$packItems}
	</div>
	<div class="clear" style="margin-bottom:1em"></div>
{/if}
 <!-- confirmation -->
{if isset($confirmation) && $confirmation}
 <p class="confirmation">
 {$confirmation}
</p>
{/if}
 <!-- description and features -->
{if $product->description || $features || $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='Quantity / Volume'}</a></li>{/if}
		{if $attachments}<li><a id="more_info_tab_attachments" href="#idTab9">{l s='Download'}</a></li>{/if}
		{if $product->customizable}<li><a href="#idTab20">{l s='Product customization'}</a></li>{/if}
		{if count($categoryProducts) > 0}<li><a id="more_info_tab_more_info" href="#idTab15">{l s='we have also...'}</a></li>{/if}
		{if isset($orderProducts) && count($orderProducts)}<li><a id="more_info_tab_more_info" href="#idTab16">{l s='best sellers'}</a></li>{/if}
		{$HOOK_PRODUCT_TAB}
	</ul>
	<div id="more_info_sheets" class="sheets align_justify">
	<!-- full description -->
	{if $product->description}
	 <div id="idTab1" class="rte">{$product->description}</div>
	{/if}

	<!-- product's features -->
	{if $features}
	 <ul id="idTab2">
		{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">
		{foreach from=$attachments item=attachment}
			<li><a href="%7B$base_dir%7Dattachment.php?id_attachment=%7B$attachment.id_attachment%7D">{$attachment.name|escape:'htmlall':'UTF-8'}</a>
{$attachment.description|escape:'htmlall':'UTF-8'}</li>
		{/foreach}
		</ul>
	{/if}
	{$HOOK_PRODUCT_TAB_CONTENT}
	{$HOOK_PRODUCT_FOOTER}
	<!-- Customizable products -->
	{if $product->customizable}
	 <div class="customization_block" id="idTab20">
	  <form method="post" action="{$customizationFormTarget}" enctype="multipart/form-data" id="customizationForm">
				<p>
					<img src="%7B$img_dir%7Dicon/infos.gif" alt="Informations">
					{l s='After saving your customized product, remember to add it to your cart.'}
					{if $product->uploadable_files}
{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="%7B$pic_dir%7D%7B$pictures.$key%7D_small" alt=""><a href="%7B$link-%3EgetUrlWith%28%27deletePicture%27,%20$field.id_customization_field%29%7D"><img src="%7B$img_dir%7Dicon/delete.gif" alt="{l s='Delete'}" class="customization_delete_icon" height="13" width="11"></a></div>{/if}
								<div class="customizationUploadBrowse"><input name="file{$field.id_customization_field}" id="img{$customizationField}" class="customization_block_input {if isset($pictures.$key)}filled{/if}" type="file">{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="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}
	</div>
 </div>
{/if}
</div>
{/if}
<!-- Addthis -->

post-124283-0-77944100-1335260315_thumb.jpg

Link to comment
Share on other sites

Hey m8, the problem is that you are asking prestashop to subtract the discount's amount from the already discounted price, so replace

 

-{convertPrice price=($productPrice-$quantity_discount.real_value)}

 

with

 

{convertPrice price=($productPriceWithoutRedution-$quantity_discount.real_value)}

 

tested and working

  • Like 1
Link to comment
Share on other sites

  • 1 month later...
  • 2 months later...

Anybody knows by any change how to make it so it takes into consideration the attributes??? In my case, each attribute has a different price so i need the prices to be displayed according to the attribute selected...... Many thanks!!!

 

This is my code

 

 

<td><b>Price Per Unit</b></td>

{foreach from=$quantity_discounts item='quantity_discount' name='quantity_discounts'}

<td>

{if $quantity_discount.price != 0 OR $quantity_discount.reduction_type == 'amount'}

{$quantity_discount.real_value|floatval}

{else}

{convertPrice price=($productPrice -(($productPrice + product_attribute *$quantity_discount.real_value)/100))}{/if}

</td>

{/foreach}

</tr>

 

It displays a table with the discount on the quantity discounts tab but only gives you the price based on the default attribute so, is it possible to change this to auto update the table according to your attribute choice?? Many thanks!!!

Edited by kugi (see edit history)
Link to comment
Share on other sites

  • 3 months later...
  • 10 months later...

{convertPrice price=$productPrice-(($productPrice/100)*$quantity_discount.real_value)}

 

There you go ;-)

 

Thank You. This is work perfect in PS 1.5.6

<td>{$quantity_discount.quantity|intval}</td>
                <td>
                     {if $quantity_discount.price >= 0 OR $quantity_discount.reduction_type == 'amount'}
                       {convertPrice price=$productPrice-(($productPrice/100)*$quantity_discount.real_value)}
                   {else}
                       {convertPrice price=$productPrice-(($productPrice/100)*$quantity_discount.real_value)}
                   {/if}
                </td>
Link to comment
Share on other sites

  • 1 month later...

 

 

  Could you please attach here readymade modified file for Prestashop 1.5.6.1 (better) or 1.5.6.0 for default theme? I am not programmer and would like test your solutiion by replacing appropriate files. Thanks!

{*
* 2007-2013 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 [email protected] 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 <[email protected]>
*  @copyright  2007-2013 PrestaShop SA
*  @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 productBasePriceTaxExcluded = {$product->base_price} - {$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|floatval}{else}0{/if};
var specific_price = {if $product->specificPrice AND $product->specificPrice.price}{$product->specificPrice.price}{else}0{/if};
var product_specific_price = new Array();
{foreach from=$product->specificPrice key='key_specific_price' item='specific_price_value'}
	product_specific_price['{$key_specific_price}'] = '{$specific_price_value}';
{/foreach}
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 stock_management = {$stock_management|intval};
{if !isset($priceDisplayPrecision)}
	{assign var='priceDisplayPrecision' value=2}
{/if}
{if !$priceDisplay || $priceDisplay == 2}
	{assign var='productPrice' value=$product->getPrice(true, $smarty.const.NULL, $priceDisplayPrecision)}
	{assign var='productPriceWithoutReduction' value=$product->getPriceWithoutReduct(false, $smarty.const.NULL)}
{elseif $priceDisplay == 1}
	{assign var='productPrice' value=$product->getPrice(false, $smarty.const.NULL, $priceDisplayPrecision)}
	{assign var='productPriceWithoutReduction' value=$product->getPriceWithoutReduct(true, $smarty.const.NULL)}
{/if}


var productPriceWithoutReduction = '{$productPriceWithoutReduction}';
var productPrice = '{$productPrice}';

// 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='This combination does not exist for this product. Please select another combination.' 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 be patient.' js=1}';
var fieldRequired = '{l s='Please fill in all the required fields before saving your customization.' js=1}';

{if isset($groups)}
	// Combinations
	{foreach from=$combinations key=idCombination item=combination}
		var specific_price_combination = new Array();
		var available_date = new Array();
		specific_price_combination['reduction_percent'] = {if $combination.specific_price AND $combination.specific_price.reduction AND $combination.specific_price.reduction_type == 'percentage'}{$combination.specific_price.reduction*100}{else}0{/if};
		specific_price_combination['reduction_price'] = {if $combination.specific_price AND $combination.specific_price.reduction AND $combination.specific_price.reduction_type == 'amount'}{$combination.specific_price.reduction}{else}0{/if};
		specific_price_combination['price'] = {if $combination.specific_price AND $combination.specific_price.price}{$combination.specific_price.price}{else}0{/if};
		specific_price_combination['reduction_type'] = '{if $combination.specific_price}{$combination.specific_price.reduction_type}{/if}';
		specific_price_combination['id_product_attribute'] = {if $combination.specific_price}{$combination.specific_price.id_product_attribute|intval}{else}0{/if};
		available_date['date'] = '{$combination.available_date}';
		available_date['date_formatted'] = '{dateFormat date=$combination.available_date full=false}';
		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}, available_date, specific_price_combination);
	{/foreach}
{/if}

{if isset($attributesCombinations)}
	// Combinations attributes informations
	var attributesCombinations = new Array();
	{foreach from=$attributesCombinations key=id item=aC}
		tabInfos = new Array();
		tabInfos['id_attribute'] = '{$aC.id_attribute|intval}';
		tabInfos['attribute'] = '{$aC.attribute}';
		tabInfos['group'] = '{$aC.group}';
		tabInfos['id_attribute_group'] = '{$aC.id_attribute_group|intval}';
		attributesCombinations.push(tabInfos);
	{/foreach}
{/if}
//]]>
</script>

{include file="$tpl_dir./breadcrumb.tpl"}
<div id="primary_block" class="clearfix">

	{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|escape:'htmlall':'UTF-8'}', 0, '{$smarty.get.adtoken|escape:'htmlall':'UTF-8'}')"/>
		<input type="submit" value="{l s='Back'}" class="exclusive" onclick="submitPublishProduct('{$base_dir}{$smarty.get.ad|escape:'htmlall':'UTF-8'}', 1, '{$smarty.get.adtoken|escape:'htmlall':'UTF-8'}')"/>
		</p>
		<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}
			<span id="view_full_size">
				<img src="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'large_default')|escape:'html'}"{if $jqZoomEnabled && $have_image} class="jqzoom"{/if} title="{$product->name|escape:'htmlall':'UTF-8'}" alt="{$product->name|escape:'htmlall':'UTF-8'}" id="bigpic" width="{$largeSize.width}" height="{$largeSize.height}"/>
				<span class="span_link">{l s='Maximize'}</span>
			</span>
		{else}
			<span id="view_full_size">
				<img src="{$img_prod_dir}{$lang_iso}-default-large_default.jpg" id="bigpic" alt="" title="{$product->name|escape:'htmlall':'UTF-8'}" width="{$largeSize.width}" height="{$largeSize.height}" />
				<span class="span_link">{l s='Maximize'}</span>
			</span>
		{/if}
		</div>
		{if isset($images) && count($images) > 0}
		<!-- thumbnails -->
		<div id="views_block" class="clearfix {if isset($images) && count($images) < 2}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_default')|escape:'html'}" rel="other-views" class="thickbox{if $smarty.foreach.thumbnails.first} shown{/if}" title="{$image.legend|htmlspecialchars}">
							<img id="thumb_{$image.id_image}" src="{$link->getImageLink($product->link_rewrite, $imageIds, 'medium_default')|escape:'html'}" 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="resetimg clear"><span id="wrapResetImages" style="display: none;"><img src="{$img_dir}icon/cancel_11x13.gif" alt="{l s='Cancel'}" width="11" height="13"/> <a id="resetImages" href="{$link->getProductLink($product)|escape:'html'}" 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 class="print"><a href="javascript:print();">{l s='Print'}</a></li>
			{if $have_image && !$jqZoomEnabled}
			{/if}
		</ul>
	</div>

	<!-- left infos-->
	<div id="pb-left-column">
		<h1>{$product->name|escape:'htmlall':'UTF-8'}</h1>

		{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}
			<div class="short_description_pack">
				<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)|escape:'html'}">{$packItem.name|escape:'htmlall':'UTF-8'}</a>
					<p>{$packItem.description_short}</p>
				</div>
				{/foreach}
			</div>
			{/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" class="clearfix">
			{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')|escape:'html'}" 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>

			<div class="product_attributes">
				{if isset($groups)}
				<!-- attributes -->
				<div id="attributes">
				<div class="clear"></div>
				{foreach from=$groups key=id_attribute_group item=group}
					{if $group.attributes|@count}
						<fieldset class="attribute_fieldset">
							<label class="attribute_label" for="group_{$id_attribute_group|intval}">{$group.name|escape:'htmlall':'UTF-8'} : </label>
							{assign var="groupName" value="group_$id_attribute_group"}
							<div class="attribute_list">
							{if ($group.group_type == 'select')}
								<select name="{$groupName}" id="group_{$id_attribute_group|intval}" class="attribute_select" onchange="findCombination();getProductAttribute();">
									{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>
							{elseif ($group.group_type == 'color')}
								<ul id="color_to_pick_list" class="clearfix">
									{assign var="default_colorpicker" value=""}
									{foreach from=$group.attributes key=id_attribute item=group_attribute}
									<li{if $group.default == $id_attribute} class="selected"{/if}>
										<a id="color_{$id_attribute|intval}" class="color_pick{if ($group.default == $id_attribute)} selected{/if}" style="background: {$colors.$id_attribute.value};" title="{$colors.$id_attribute.name}" onclick="colorPickerClick(this);getProductAttribute();">
											{if file_exists($col_img_dir|cat:$id_attribute|cat:'.jpg')}
												<img src="{$img_col_dir}{$id_attribute}.jpg" alt="{$colors.$id_attribute.name}" width="20" height="20" /><br />
											{/if}
										</a>
									</li>
									{if ($group.default == $id_attribute)}
										{$default_colorpicker = $id_attribute}
									{/if}
									{/foreach}
								</ul>
								<input type="hidden" class="color_pick_hidden" name="{$groupName}" value="{$default_colorpicker}" />
							{elseif ($group.group_type == 'radio')}
								<ul>
									{foreach from=$group.attributes key=id_attribute item=group_attribute}
										<li>
											<input type="radio" class="attribute_radio" name="{$groupName}" value="{$id_attribute}" {if ($group.default == $id_attribute)} checked="checked"{/if} onclick="findCombination();getProductAttribute();" />
											<span>{$group_attribute|escape:'htmlall':'UTF-8'}</span>
										</li>
									{/foreach}
								</ul>
							{/if}
							</div>
						</fieldset>
					{/if}
				{/foreach}
				
				
				<p class="attribute_label" id="product_reference" {if isset($groups) OR !$product->reference}style="display: none;"{/if}>
				<label>{l s='Reference:'} </label>
				<span class="editable" style="font-weight:bold;">{$product->reference|escape:'htmlall':'UTF-8'}</span>
			</p>

				
				</div>
			{/if}
			

			<!-- Out of stock hook -->
			<div id="oosHook"{if $product->quantity > 0} style="display: none;"{/if}>
				{$HOOK_PRODUCT_OOS}
			</div>

			<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>
		</div>

		<div class="content_prices clearfix">
		
		
		<div style="float:right;">
			
			<p id="add_to_cart" {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} 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>
		
		
		<div style="float:left;">
		
			<!-- prices -->
			{if $product->show_price AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE}

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

			<div class="price">
				<p 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}
				</p>

				{if $product->on_sale}

				{elseif $product->specificPrice AND $product->specificPrice.reduction AND $productPriceWithoutReduction > $productPrice}
					<span class="discount">{l s='Reduced price!'}</span>
				{/if}
				{if $priceDisplay == 2}
					<br />
					<span id="pretaxe_price"><span id="pretaxe_price_display">{convertPrice price=$product->getPrice(false, $smarty.const.NULL)}</span> {l s='tax excl.'}</span>
				{/if}
			</div>
			<p id="reduction_percent" {if !$product->specificPrice OR $product->specificPrice.reduction_type != 'percentage'} style="display:none;"{/if}><span id="reduction_percent_display">{if $product->specificPrice AND $product->specificPrice.reduction_type == 'percentage'}-{$product->specificPrice.reduction*100}%{/if}</span></p>
			<p id="reduction_amount" {if !$product->specificPrice OR $product->specificPrice.reduction_type != 'amount' || $product->specificPrice.reduction|intval ==0} style="display:none"{/if}>
				<span id="reduction_amount_display">
				{if $product->specificPrice AND $product->specificPrice.reduction_type == 'amount' AND $product->specificPrice.reduction|intval !=0}
					-{convertPrice price=$productPriceWithoutReduction-$productPrice|floatval}
				{/if}
				</span>
			</p>
			<p id="old_price"{if !$product->specificPrice || !$product->specificPrice.reduction} class="hidden"{/if}>
			{if $priceDisplay >= 0 && $priceDisplay <= 2}
					<span id="old_price_display">{if $productPriceWithoutReduction > $productPrice}{convertPrice price=$productPriceWithoutReduction}{/if}</span>
					<!-- {if $tax_enabled && $display_tax_label == 1}{if $priceDisplay == 1}{l s='tax excl.'}{else}{l s='tax incl.'}{/if}{/if} -->
			{/if}
			</p>
			{if $packItems|@count && $productPrice < $product->getNoPackPrice()}
				<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}
			
			
			<!-- 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>
			<p id="availability_date"{if ($product->quantity > 0) OR !$product->available_for_order OR $PS_CATALOG_MODE OR !isset($product->available_date) OR $product->available_date < $smarty.now|date_format:'%Y-%m-%d'} style="display: none;"{/if}>
				<span id="availability_date_label">{l s='Availability date:'}</span>
				<span id="availability_date_value">{dateFormat date=$product->available_date full=false}</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 style="font-weight:bold;" {if $product->quantity > 1} style="display: none;"{/if} id="quantityAvailableTxt">{l s='Dostępny:'}</span>
				<span style="font-weight:bold;" {if $product->quantity == 1} style="display: none;"{/if} id="quantityAvailableTxtMultiple">{l s='Dostępnych:'}</span>
				<span id="quantityAvailable">{$product->quantity|intval}</span> sztuk
			</p>
			{/if}
			
			<!-- 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='This product is not sold individually. You must select at least'} <b id="minimal_quantity_label">{$product->minimal_quantity}</b> {l s='quantity for this product.'}
			</p>
			{if $product->minimal_quantity > 1}
			<script type="text/javascript">
				checkMinimalQuantity();
			</script>
			{/if}
			</div>
			<div class="clear"></div>
			
			
			<div class="clear"></div>
		</div>
		</form>
		{/if}
		{if isset($HOOK_EXTRA_RIGHT) && $HOOK_EXTRA_RIGHT}{$HOOK_EXTRA_RIGHT}{/if}
	</div>
</div>

{if (isset($quantity_discounts) && count($quantity_discounts) > 0)}
<!-- quantity discount -->
<ul class="idTabs clearfix">
	<li><a href="#discount" style="cursor: pointer" class="selected">{l s='Sliding scale pricing'}</a></li>
</ul>
<div id="quantityDiscount">
	<table class="std">
        <thead>
            <tr>
                <th>{l s='Product'}</th>
                <th>Od ilości</th>
                <th>Cena</th>
            </tr>
        </thead>
		<tbody>
            {foreach from=$quantity_discounts item='quantity_discount' name='quantity_discounts'}
            <tr id="quantityDiscount_{$quantity_discount.id_product_attribute}" class="quantityDiscount_{$quantity_discount.id_product_attribute}">
                <td>
                    {if (isset($quantity_discount.attributes) && ($quantity_discount.attributes))}
                        {$product->getProductName($quantity_discount.id_product, $quantity_discount.id_product_attribute)}
                    {else}
                        {$product->getProductName($quantity_discount.id_product)}
                    {/if}
                </td>
                <td>{$quantity_discount.quantity|intval}</td>
                <td>
                     {if $quantity_discount.price >= 0 OR $quantity_discount.reduction_type == 'amount'}
                       {convertPrice price=$productPrice-(($productPrice/100)*$quantity_discount.real_value)}
                   {else}
                       {convertPrice price=$productPrice-(($productPrice/100)*$quantity_discount.real_value)}
                   {/if}
                </td>
            </tr>
            {/foreach}
        </tbody>
	</table>
</div>
{/if}
{if isset($HOOK_PRODUCT_FOOTER) && $HOOK_PRODUCT_FOOTER}{$HOOK_PRODUCT_FOOTER}{/if}

<!-- description and features -->
{if (isset($product) && $product->description) || (isset($features) && $features) || (isset($accessories) && $accessories) || (isset($HOOK_PRODUCT_TAB) && $HOOK_PRODUCT_TAB) || (isset($attachments) && $attachments) || isset($product) && $product->customizable}
<div id="more_info_block" class="clear">
	<ul id="more_info_tabs" class="idTabs idTabsShort clearfix">
		{if $product->description}<li><a id="more_info_tab_more_info" href="#idTab1">Specyfikacja produktu</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}
		{if isset($product) && $product->customizable}<li><a href="#idTab10">{l s='Product customization'}</a></li>{/if}
		{$HOOK_PRODUCT_TAB}
	</ul>
	<div id="more_info_sheets" class="sheets align_justify">
	{if isset($product) && $product->description}
		<!-- full description -->
		<div id="idTab1" class="rte">{$product->description}</div>
	{/if}
	{if isset($features) && $features}
		<!-- product's features -->
		<ul id="idTab2" class="bullet">
		{foreach from=$features item=feature}
            {if isset($feature.value)}
			    <li><span>{$feature.name|escape:'htmlall':'UTF-8'}</span> {$feature.value|escape:'htmlall':'UTF-8'}</li>
            {/if}
		{/foreach}
		</ul>
	{/if}
	{if isset($attachments) && $attachments}
		<ul id="idTab9" class="" style="list-style:none;">
		{foreach from=$attachments item=attachment}
			<li> <a href="{$link->getPageLink('attachment', true, NULL, "id_attachment={$attachment.id_attachment}")|escape:'html'}">{$attachment.name|escape:'htmlall':'UTF-8'}</a><br />{$attachment.description|escape:'htmlall':'UTF-8'}</li>
		{/foreach}
		</ul>
	{/if}
	{if isset($accessories) AND $accessories}
		<!-- accessories -->
		<div 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}
						{if ($accessory.allow_oosp || $accessory.quantity_all_versions > 0 || $accessory.quantity > 0) AND $accessory.available_for_order AND !isset($restricted_country_mode)}
							{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">
								<p class="s_title_block">
									<a href="{$accessoryLink|escape:'htmlall':'UTF-8'}">{$accessory.name|escape:'htmlall':'UTF-8'}</a>
									{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}
								</p>
								<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_default')|escape:'html'}" alt="{$accessory.legend|escape:'htmlall':'UTF-8'}" width="{$mediumSize.width}" height="{$mediumSize.height}" /></a>
									<div class="block_description">
										<a href="{$accessoryLink|escape:'htmlall':'UTF-8'}" title="{l s='More'}" class="product_description">{$accessory.description_short|strip_tags|truncate:400:'...'}</a>
									</div>
									<div class="clear_product_desc"> </div>
								</div>
								
								<p class="clearfix" style="margin-top:5px">
									<a class="btn-medium-gray" style="color:#fff;float:left;" href="{$accessoryLink|escape:'htmlall':'UTF-8'}" title="{l s='View'}">{l s='View'}</a>
									{if !$PS_CATALOG_MODE && ($accessory.allow_oosp || $accessory.quantity > 0)}
									<a class="btn-medium-orange ajax_add_to_cart_button" style="color:#fff;float:left;" href="{$link->getPageLink('cart', true, NULL, "qty=1&id_product={$accessory.id_product|intval}&token={$static_token}&add")|escape:'html'}" rel="ajax_id_product_{$accessory.id_product|intval}" title="{l s='Add to cart'}">{l s='Add to cart'}</a>
									{/if}
								</p>
								
							</li>
						{/if}
					{/foreach}
					</ul>
				</div>
			</div>
		</div>
	{/if}

	<!-- Customizable products -->
	{if isset($product) && $product->customizable}
		<div id="idTab10" class="bullet customization_block">
			<form method="post" action="{$customizationFormTarget}" enctype="multipart/form-data" id="customizationForm" class="clearfix">
				<p class="infoCustomizable">
					{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}
				<div class="customizableProductsFile">
					<h3>{l s='Pictures'}</h3>
					<ul id="uploadable_files" class="clearfix">
						{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)|escape:'html'}" 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">
										<label class="customizationUploadBrowseDescription">{if !empty($field.name)}{$field.name}{else}{l s='Please select an image file from your computer'}{/if}{if $field.required}<sup>*</sup>{/if}</label>
										<input type="file" name="file{$field.id_customization_field}" id="img{$customizationField}" class="customization_block_input {if isset($pictures.$key)}filled{/if}" />
									</div>
								</li>
								{counter}
							{/if}
						{/foreach}
					</ul>
				</div>
				{/if}
				{if $product->text_fields|intval}
				<div class="customizableProductsText">
					<h3>{l s='Text'}</h3>
					<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}">
							<label for ="textField{$customizationField}">{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}</label>
							<textarea 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>
				</div>
				{/if}
				<p id="customizedDatas">
					<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 isset($HOOK_PRODUCT_TAB_CONTENT) && $HOOK_PRODUCT_TAB_CONTENT}{$HOOK_PRODUCT_TAB_CONTENT}{/if}
	</div>
</div>
{/if}
{if isset($packItems) && $packItems|@count > 0}
	<div id="blockpack">
		<h2>{l s='Pack content'}</h2>
		{include file="$tpl_dir./product-list.tpl" products=$packItems}
	</div>
{/if}
{/if}

Here You go :)

If any questions please dont hesitate to ask :)

Edited by kisweb (see edit history)
Link to comment
Share on other sites

  • 2 months later...

Hi Guys which tpl file is that.

 

i need to adjust the customer group discount, is that stored in variable : group_reduction ?  where can i fix the math for this, instead of discount i need to increase by % rather than decrease by %

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...