Jump to content

Quantity discount - wrong price


Recommended Posts

Hi,

 

I have an issue on my site.. I addapted my product.tpl to show actual price after quanitity discount, but the price is other then the discounted price in my cart. This problem occures only when I set up a discount from 1 piece. The cart discount is counted from "main price", the discount price in my table in product.tpl is counted from discounted price.. The included image explains it better then I do :) So which price is the right one? And how can I display the right one in my table on product page?

My code in product.tpl:

<!-- 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='from (qty)'}</th>
		    <th> {l s='discount'}</th>
		    <th> Cena </th>
	    </tr>
    </thead>
 <tbody>
	    <tr id="noQuantityDiscount">
					   </tr>
	    {foreach from=$quantity_discounts item='quantity_discount' name='quantity_discounts'}
	    <tr id="quantityDiscount_{$quantity_discount.id_product_attribute}">
		    <td>{$quantity_discount.quantity|intval} +</td>
		    <td>
			    {if $quantity_discount.price != 0 OR $quantity_discount.reduction_type == 'amount'}
				   -{convertPrice price=$quantity_discount.real_value|floatval}/ks
			   {else}
				   -{$quantity_discount.real_value|floatval}%
			   {/if}
		    </td>
		    <td> <b>
					  {if $quantity_discount.price != 0 OR $quantity_discount.reduction_type == 'amount'}
	 {convertPrice price=$productPrice-$quantity_discount.real_value|floatval}/ks	 </t>
    {else}
		    -{$quantity_discount.real_value|floatval}%
    {/if}
    </td>
	    </tr>
	    {/foreach}
    </tbody>
</table>
</div>
{/if}

post-442591-0-67855500-1377778786_thumb.jpg

Link to comment
Share on other sites

Solved! I changed my code:

<!-- 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='from (qty)'}</th>
		    <th> {l s='discount'}</th>
		    <th> Cena </th>
	    </tr>
    </thead>
 <tbody>
	    <tr id="noQuantityDiscount">
					   </tr>
	    {foreach from=$quantity_discounts item='quantity_discount' name='quantity_discounts'}
	    <tr id="quantityDiscount_{$quantity_discount.id_product_attribute}">
		    <td>{$quantity_discount.quantity|intval} +</td>
		    <td>
			    {if $quantity_discount.price != 0 OR $quantity_discount.reduction_type == 'amount'}
				   -{convertPrice price=$quantity_discount.real_value|floatval}/ks
			   {else}
				   -{$quantity_discount.real_value|floatval}%
			   {/if}
		    </td>
		    <td> <b>
					  {if $quantity_discount.price != 0 OR $quantity_discount.reduction_type == 'amount'}
	 {convertPrice price=$productPriceWithoutReduction-$quantity_discount.real_value|floatval}/ks	 </t>
    {else}
		    -{$quantity_discount.real_value|floatval}%
    {/if}
    </td>
	    </tr>
	    {/foreach}
    </tbody>
</table>
</div>
{/if}

  • Like 1
Link to comment
Share on other sites

  • 5 months later...
  • 1 year later...
  • 1 year later...

So I am on presta 1.6.1.0 now and this problem is here again, but now I can not find the proper solution. I have a product with base price 3,5eur. For a regular customer I have a discount of 0,10eur starting at buying 1 pcs, than I have a discount of 0,20 from base price for regular customer group when they buy 5+ pcs - the cart has it right, but the quantity discount table not. The table shows price 3,1eur instead of 3,3 (http://klbkoshopa.eu/katia-belice-1985.html). How can I change the code, so it shows it the right way? My current code is

{if !$content_only}
		{if (isset($quantity_discounts) && count($quantity_discounts) > 0)}
			<!-- quantity discount -->
			<section class="block section">
				<h3 class="title_block"><span>{l s='Volume discounts'}</span></h3>
				<div id="quantityDiscount">
					<table class="std table-product-discounts">
						<thead>
							<tr>
								<th>{l s='Quantity'}</th>
								<th>{if $display_discount_price}{l s='Price'}{else}{l s='Discount'}{/if}</th>
								<th>{l s='You Save'}</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}" data-discount-type="{$quantity_discount.reduction_type}" data-discount="{$quantity_discount.real_value|floatval}" data-discount-quantity="{$quantity_discount.quantity|intval}">
								<td>
									{$quantity_discount.quantity|intval}
								</td>
								<td>
									{if $quantity_discount.price >= 0 || $quantity_discount.reduction_type == 'amount'}
										{if $display_discount_price}
											{if $quantity_discount.reduction_tax == 0 && !$quantity_discount.price}
												{convertPrice price = $productPriceWithoutReduction|floatval-($productPriceWithoutReduction*$quantity_discount.reduction_with_tax)|floatval}
											{else}
												{convertPrice price=$productPriceWithoutReduction|floatval-$quantity_discount.real_value|floatval}
											{/if}
										{else}
											{convertPrice price=$quantity_discount.real_value|floatval}
										{/if}
									{else}
										{if $display_discount_price}
											{if $quantity_discount.reduction_tax == 0}
												{convertPrice price = $productPriceWithoutReduction|floatval-($productPriceWithoutReduction*$quantity_discount.reduction_with_tax)|floatval}
											{else}
												{convertPrice price = $productPriceWithoutReduction|floatval-($productPriceWithoutReduction*$quantity_discount.reduction)|floatval}
											{/if}
										{else}
											{$quantity_discount.real_value|floatval}%
										{/if}
									{/if}
								</td>
								<td>
									<span>{l s='Up to'}</span>
									{if $quantity_discount.price >= 0 || $quantity_discount.reduction_type == 'amount'}
										{$discountPrice=$productPriceWithoutReduction|floatval-$quantity_discount.real_value|floatval}
									{else}
										{$discountPrice=$productPriceWithoutReduction|floatval-($productPriceWithoutReduction*$quantity_discount.reduction)|floatval}
									{/if}
									{$discountPrice=$discountPrice * $quantity_discount.quantity}
									{$qtyProductPrice=$productPriceWithoutReduction|floatval * $quantity_discount.quantity}
									{convertPrice price=$qtyProductPrice - $discountPrice}
								</td>
							</tr>
							{/foreach}
						</tbody>
					</table>
				</div>
			</section>
		{/if}
		
		{if isset($packItems) && $packItems|@count > 0}
		<section id="blockpack" class="block section">
			<h4 class="title_block"><span>{l s='Pack content'}</span></h4>
			{include file="$tpl_dir./product-list.tpl" products=$packItems for_f='packitems'}
		</section>
		{/if}

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