Jump to content

[FREE TUTORIAL] Display unit price/base price in the product list


Recommended Posts

Hey thanks a lot Nemo been looking for this...

 

* Tested it on 1.4.9 but it only adds the "per unit" tag and displays the same product price shown in the list and not the actual unit price

as $product.unit_price_ratio value is set to 1

Edited by xaviour (see edit history)

Share this post


Link to post
Share on other sites

Ok! what i think is:

 

since my product unit rate and my full price are the same hence the ratio is 1 and in the product-list I display the default combination price who's price bets divided by 1 so the same price. But not what i want (see img)

 

Nonetheless, I can still make good use of your tutorial.

 

PS: you mention about printing out variables can you guide me on how to do that... :rolleyes:

 

if you print out the product variable in the product list, you’ll notice an interesting property:$product.unit_price_ratio

post-435064-0-88175800-1355455837_thumb.png

Share this post


Link to post
Share on other sites
  • 1 month later...

I have a small problem. I made a copy of a product and edited it with different price, images etc. and saved it under a new name. Now in the product list it is displaying old price and new price (both the same) while I haven't made a special price rule.

 

How to get red of this?

 

Same is happening when i raise or lower the price of one the products in my catalog. It shows again old price and new price (wich are the same again).

 

Deleted the product and made a new one, but same is happening. On the product page itself it is displaying correct. Force compile is on, rebuilded the index, version presta 1.5.2, custom template.

 

Thanks in advance!

Edited by robbie007 (see edit history)

Share this post


Link to post
Share on other sites
  • 2 weeks later...
  • 2 weeks later...

Thanks,

 

I think its not really possible in 1.5x. The only way I can think is to use the other fields like UPC, and insert "Doz"

And then somehow recode the cart, and the product tpl file to show the UPC code next to the price???

Share this post


Link to post
Share on other sites
  • 1 year later...
  • 3 months later...

How do I do this for 1.6? I tried to all what is written here, even copied code from the product.tpl which displays the per unit price, and it doesn't work :X

 

{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:'html':'UTF-8'}</p>

 I inserted that code in <div class="right-block">, right under this line:  {if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}  

 

 

Please help :<

Share this post


Link to post
Share on other sites

Greetings Nemo1!

 

Nothing shows up, no error or anything. It looks like as if I did not change anything in the code of product-list.tpl at all. 

 

I cleared cache, force compiled... 

I have tried adding this code into different parts of product-list.tpl, but nothing either shows up or the site crashes. 

I'm using default theme, exactly the one you used in your latest tutorials.

 

Any ideas how to get this fixed? :rolleyes:  

 

PS: btw, i found a guy on the forum who asked a developer to solve the problem for him. He told me that after a developer modified his product-list.tpl, the same code was added by him:

{if !empty($product.unity) && $product.unit_price_ratio > 0.000000} {math equation="pprice / punit_price" pprice=$product.price punit_price=$product.unit_price_ratio assign=unit_price} {convertPrice price=$unit_price} {l s='par'} {$product.unity|escape:'html':'UTF-8'} 

But I have no clue where he added it, and the guy does not respond anymore :X 

Edited by Alugart (see edit history)

Share this post


Link to post
Share on other sites

Hello Alugart,

 

 

You may try to add it in the block where you want the price to be displayed, I add it in the product-list.tpl in the <div class="content_price">

 

The whole is like this:

div class="content_price">
 
{if !empty($product.unity) && $product.unit_price_ratio > 0.000000} {math equation="pprice / punit_price" pprice=$product.price punit_price=$product.unit_price_ratio assign=unit_price} {convertPrice price=$unit_price} {l s='per'} {$product.unity|escape:'html':'UTF-8'} 
 
{/if}
<p class="product_desc"><a href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.description_short|strip_tags:'UTF-8'|truncate:59:'...'}" >{$product.description_short|strip_tags:'UTF-8'|truncate:59:'...'}</a></p>
   <div>
{if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}<span class="price" style="display: inline;">{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</span><br />{/if}
{if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}<span class="availability">{if ($product.allow_oosp || $product.quantity > 0)}{l s='Available'}{/if}</span>{/if}
{if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}<span class="outofstock">{if (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}{l s=''}{else}{l s='Out of stock'}{/if}</span>{/if}
</div>
 
 
Hope you get it through somehow:P
 
Regards!
  • Like 1

Share this post


Link to post
Share on other sites

Owww yeaH!! It works! Damn me, it really does ! ! ! 

Thank you sooooo much Docki, you are the man! :D

 

For everyone out there, who is using prestashop 1.6, the CODE IN PREVIOUS POST DISPLAYS PRICE PER UNIT IN CATALOGUE/PRODUCT LIST. 

Share this post


Link to post
Share on other sites
  • 2 months later...

any suggestion for 1.6?

 Inserted the below code in product-list.tpl under

{if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}

this code:

	{if $product.unit_price_ratio}
		{math equation="b/a" a=$product.unit_price_ratio b=$product.price assign=realunit}
		{convertPrice price=$realunit} {l s="per"} {$product.unity}
	{/if}

Explanation: if we use 1.6 version, in the math equation the b=$product.price and not b=$product.price_without_reduction...

  • Like 1

Share this post


Link to post
Share on other sites
  • 3 weeks later...

 Inserted the below code in product-list.tpl under

{if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}

this code:

	{if $product.unit_price_ratio}
		{math equation="b/a" a=$product.unit_price_ratio b=$product.price assign=realunit}
		{convertPrice price=$realunit} {l s="per"} {$product.unity}
	{/if}

Explanation: if we use 1.6 version, in the math equation the b=$product.price and not b=$product.price_without_reduction...

I added the code, but now I have on each product, also the one WITHOUT base price 0.00 per 0.00000

 

Is there any solution for if product has base price to show, and if not to don't show ?

Share this post


Link to post
Share on other sites

Try with this instead, so both elements in the equation must be valid numbers

 

    {if $product.unit_price_ratio && $product.price}
        {math equation="b/a" a=$product.unit_price_ratio b=$product.price assign=realunit}
        {convertPrice price=$realunit} {l s="per"} {$product.unity}
    {/if}

Share this post


Link to post
Share on other sites
  • 2 months later...

hm, this might be possible in a template, try it

 

{Context::getContext()->customer->isLogged())

 

if not, assign it to a variable from the product controller, category controller, or wherever you see a price (it might be better to do it in a module hooking to the header)

Share this post


Link to post
Share on other sites

Hi all.

 

I have tried the code above for v1.6 (post #22) and it works, but the unit price is only shown when hovering with the pointer on the product, in products list. I want it to be shown also directly in the list, not just when hovering.

 

I suppose it should be the same code added somewhere in product-list.tpl, but I cannot find where to insert it! Any help? Thank you!

 

(Attached images showing where appears the unit price, and where I want it to appear)

9253823price2.jpg

 

9253821price1.jpg

Share this post


Link to post
Share on other sites

I think you only need to locate the second price, since there are 2 in the template. SHould be this one 

<span itemprop="price" class="price product-price">
								{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}
							</span>

Share this post


Link to post
Share on other sites

Yes, thank you. I found it yesterday but I forgot to comment it here. The code should be moved to the "right_block" section intead of the "left_block" (or viceversa, I can not remember right now), and then it is displayed the way I want.

 

Tahnks  ;)

Edited by JotaCe (see edit history)

Share this post


Link to post
Share on other sites
  • 11 months later...

Solved my problem.

 

But the unit price is displayed different from my CSV File.

Ok, it is my scenario: PS 1.6.1.3, no tax system used in my shop, using CSV product import, i wrote all unit price for every product, imported, and the result ist the unit price is being altered, it become less than unit price in my CSV file.

 

How to display unit price just as unit price from my CSV file?

Share this post


Link to post
Share on other sites
  • 1 year later...

Hi,

 

I just need a hint. I try to show the groundprice in the discount list in the product. And I´m on 1.7.1.0 :-(

So far it´s working with

<tr>
  <td>1</td>
  <td>{$product.price}</td>
</tr>

BUT if the customer wants two pieces, the price in the discount list is changing like the big price at the top.

Any idea what code instead of {$product.price} is only the price for one piece?

Share this post


Link to post
Share on other sites
  • 10 months later...
  • 2 weeks later...
On 2/16/2018 at 11:02 PM, NemoPS said:

it's shopping-cart-product-line.tpl, where you can edit each single product details to be displayed in the cart page (even if it's opc)

thanks for the answer

I thought I will never find it

if you can save  me some time what is the code to be enabled to show price in checkout per unit

just to be there in column shown -

no calculation, no nothing

Edited by datasphere
adding the code (see edit history)

Share this post


Link to post
Share on other sites
<tr id="product_{$product.id_product}_{$product.id_product_attribute}_{if $quantityDisplayed > 0}nocustom{else}0{/if}_{$product.id_address_delivery|intval}{if !empty($product.gift)}_gift{/if}" class="cart_item{if isset($productLast) && $productLast && (!isset($ignoreProductLast) || !$ignoreProductLast)} last_item{/if}{if isset($productFirst) && $productFirst} first_item{/if}{if isset($customizedDatas.$productId.$productAttributeId) AND $quantityDisplayed == 0} alternate_item{/if} address_{$product.id_address_delivery|intval} {if $odd}odd{else}even{/if}">
	<td class="cart_product" data-title="{l s='Product'}">
		<div class="mobile_table_content">
		<a href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category, null, null, $product.id_shop, $product.id_product_attribute, false, false, true)|escape:'html':'UTF-8'}"><img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'small_default')|escape:'html':'UTF-8'}" alt="{$product.name|escape:'html':'UTF-8'}" {if isset($smallSize)}width="{$smallSize.width}" height="{$smallSize.height}" {/if} class="replace-2x" /></a>
		</div>
	</td>
	<td class="cart_description" data-title="{l s='Description'}">
		{capture name=sep} : {/capture}
		{capture}{l s=' : '}{/capture}
		<div class="mobile_table_content">
		<p class="product-name s_title_block"><a href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category, null, null, $product.id_shop, $product.id_product_attribute, false, false, true)|escape:'html':'UTF-8'}">{$product.name|escape:'html':'UTF-8'}</a></p>
		{if $product.reference}<div class="cart_ref">{l s='SKU'}{$smarty.capture.default}{$product.reference|escape:'html':'UTF-8'}</div>{/if}
		{if isset($product.attributes) && $product.attributes}<div><a href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category, null, null, $product.id_shop, $product.id_product_attribute, false, false, true)|escape:'html':'UTF-8'}">{$product.attributes|@replace: $smarty.capture.sep:$smarty.capture.default|escape:'html':'UTF-8'}</a></div>{/if}
		</div>
	</td>
	{if $PS_STOCK_MANAGEMENT}
		<td class="cart_avail" data-title="{l s='Availability'}">
			<div class="mobile_table_content">
			<span class="{if $product.quantity_available <= 0 && isset($product.allow_oosp) && !$product.allow_oosp}label label-warning{else}{/if}">{if $product.quantity_available <= 0}{if $product.allow_oosp}{if isset($product.available_later) && $product.available_later}{$product.available_later}{else}{l s='In Stock'}{/if}{else}{l s='Out of stock'}{/if}{else}{if isset($product.available_now) && $product.available_now}{$product.available_now}{else}{l s='In Stock'}{/if}{/if}</span>{if !$product.is_virtual}{hook h="displayProductDeliveryTime" product=$product}{/if}
			</div>
		</td>
	{/if}
	<td class="cart_unit" data-title="{l s='Unit price'}">
		<div class="mobile_table_content">
		<ul class="price text-center" id="product_price_{$product.id_product}_{$product.id_product_attribute}{if $quantityDisplayed > 0}_nocustom{/if}_{$product.id_address_delivery|intval}{if !empty($product.gift)}_gift{/if}">
			{if !empty($product.gift)}
				<li class="gift-icon">{l s='Gift!'}</li>
			{else}
            	{if !$priceDisplay}
					<li class="price{if isset($product.is_discounted) && $product.is_discounted && isset($product.reduction_applies) && $product.reduction_applies} special-price{/if}">{convertPrice price=$product.price_wt}</li>
				{else}
               	 	<li class="price{if isset($product.is_discounted) && $product.is_discounted && isset($product.reduction_applies) && $product.reduction_applies} special-price{/if}">{convertPrice price=$product.price}</li>
				{/if}
				{if isset($product.is_discounted) && $product.is_discounted}
                	<li class="price-percent-reduction small">
                    	{if !$priceDisplay}
            				{if isset($product.reduction_type) && $product.reduction_type == 'amount'}
                    			{assign var='priceReduction' value=($product.price_wt - $product.price_without_specific_price)}
                    			{assign var='symbol' value=$currency->sign}
                    		{else}
                    			{assign var='priceReduction' value=(($product.price_without_specific_price - $product.price_wt)/$product.price_without_specific_price) * 100 * -1}
                    			{assign var='symbol' value='%'}
                    		{/if}
						{else}
							{if isset($product.reduction_type) && $product.reduction_type == 'amount'}
								{assign var='priceReduction' value=($product.price - $product.price_without_specific_price)}
								{assign var='symbol' value=$currency->sign}
                    		{else}
                    			{assign var='priceReduction' value=(($product.price_without_specific_price - $product.price)/$product.price_without_specific_price) * -100}
                    			{assign var='symbol' value='%'}
                    		{/if}
						{/if}
						{if $symbol == '%'}
							&nbsp;{$priceReduction|string_format:"%.2f"|regex_replace:"/[^\d]0+$/":""}{$symbol}&nbsp;
						{else}
							&nbsp;{convertPrice price=$priceReduction}&nbsp;
						{/if}
                    </li>
					<li class="old-price">{convertPrice price=$product.price_without_specific_price}</li>
				{/if}
			{/if}
		</ul>
		</div>
	</td>

	<td class="cart_quantity text-center" data-title="{l s='Qty'}">
		<div class="mobile_table_content">
		{if (isset($cannotModify) && $cannotModify == 1)}
			<span>
				{if $quantityDisplayed == 0 AND isset($customizedDatas.$productId.$productAttributeId)}
					{$product.customizationQuantityTotal}
				{else}
					{$product.cart_quantity-$quantityDisplayed}
				{/if}
			</span>
		{else}
			{if isset($customizedDatas.$productId.$productAttributeId) AND $quantityDisplayed == 0}
				<span id="cart_quantity_custom_{$product.id_product}_{$product.id_product_attribute}_{$product.id_address_delivery|intval}" >{$product.customizationQuantityTotal}</span>
			{/if}
			{if !isset($customizedDatas.$productId.$productAttributeId) OR $quantityDisplayed > 0}
				<input type="hidden" value="{if $quantityDisplayed == 0 AND isset($customizedDatas.$productId.$productAttributeId)}{$customizedDatas.$productId.$productAttributeId|@count}{else}{$product.cart_quantity-$quantityDisplayed}{/if}" name="quantity_{$product.id_product}_{$product.id_product_attribute}_{if $quantityDisplayed > 0}nocustom{else}0{/if}_{$product.id_address_delivery|intval}_hidden" />
				<div class="cart_quantity_button clearfix">
					{if $product.minimal_quantity < ($product.cart_quantity-$quantityDisplayed) OR $product.minimal_quantity <= 1}
						<a rel="nofollow" class="cart_quantity_down" id="cart_quantity_down_{$product.id_product}_{$product.id_product_attribute}_{if $quantityDisplayed > 0}nocustom{else}0{/if}_{$product.id_address_delivery|intval}" href="{$link->getPageLink('cart', true, NULL, "add=1&amp;id_product={$product.id_product|intval}&amp;ipa={$product.id_product_attribute|intval}&amp;id_address_delivery={$product.id_address_delivery|intval}&amp;op=down&amp;token={$token_cart}")|escape:'html':'UTF-8'}" title="{l s='Subtract'}">-</a>
					{else}
						<a class="cart_quantity_down disabled" href="#" id="cart_quantity_down_{$product.id_product}_{$product.id_product_attribute}_{if $quantityDisplayed > 0}nocustom{else}0{/if}_{$product.id_address_delivery|intval}" title="{l s='You must purchase a minimum of %d of this product.' sprintf=$product.minimal_quantity}">-</a>
					{/if}
					<input size="2" type="text" autocomplete="off" class="cart_quantity_input form-control grey" value="{if $quantityDisplayed == 0 AND isset($customizedDatas.$productId.$productAttributeId)}{$customizedDatas.$productId.$productAttributeId|@count}{else}{$product.cart_quantity-$quantityDisplayed}{/if}"  name="quantity_{$product.id_product}_{$product.id_product_attribute}_{if $quantityDisplayed > 0}nocustom{else}0{/if}_{$product.id_address_delivery|intval}" />
					<a rel="nofollow" class="cart_quantity_up" id="cart_quantity_up_{$product.id_product}_{$product.id_product_attribute}_{if $quantityDisplayed > 0}nocustom{else}0{/if}_{$product.id_address_delivery|intval}" href="{$link->getPageLink('cart', true, NULL, "add=1&amp;id_product={$product.id_product|intval}&amp;ipa={$product.id_product_attribute|intval}&amp;id_address_delivery={$product.id_address_delivery|intval}&amp;token={$token_cart}")|escape:'html':'UTF-8'}" title="{l s='Add'}">+</a>
				</div>
			{/if}
		{/if}
		</div>
	</td>
	{if !isset($noDeleteButton) || !$noDeleteButton}
		<td class="cart_delete text-center" data-title="{l s='Delete'}">
		<div class="mobile_table_content">
		{if (!isset($customizedDatas.$productId.$productAttributeId) OR $quantityDisplayed > 0) && empty($product.gift)}
			<div>
				<a rel="nofollow" title="{l s='Delete'}" class="cart_quantity_delete" id="{$product.id_product}_{$product.id_product_attribute}_{if $quantityDisplayed > 0}nocustom{else}0{/if}_{$product.id_address_delivery|intval}" href="{$link->getPageLink('cart', true, NULL, "delete=1&amp;id_product={$product.id_product|intval}&amp;ipa={$product.id_product_attribute|intval}&amp;id_address_delivery={$product.id_address_delivery|intval}&amp;token={$token_cart}")|escape:'html':'UTF-8'}"><i class="icon-cancel icon-small"></i></a>
			</div>
		{else}

		{/if}
		</div>
		</td>
	{/if}
	<td class="cart_total" data-title="{l s='Total'}">
		<div class="mobile_table_content">
		<span class="price" id="total_product_price_{$product.id_product}_{$product.id_product_attribute}{if $quantityDisplayed > 0}_nocustom{/if}_{$product.id_address_delivery|intval}{if !empty($product.gift)}_gift{/if}">
			{if !empty($product.gift)}
				<span class="gift-icon">{l s='Gift!'}</span>
			{else}
				{if $quantityDisplayed == 0 AND isset($customizedDatas.$productId.$productAttributeId)}
					{if !$priceDisplay}{displayPrice price=$product.total_customization_wt}{else}{displayPrice price=$product.total_customization}{/if}
				{else}
					{if !$priceDisplay}{displayPrice price=$product.total_wt}{else}{displayPrice price=$product.total}{/if}
				{/if}
			{/if}
		</span>
		</div>
	</td>
</tr>

 

Edited by datasphere (see edit history)

Share this post


Link to post
Share on other sites

didn't see it really, maybe it is a price per 1 unit like normal product price called differently

but let's first check the CSS to be 100% sure

 

------

can't really find nothing related to unit_price with display: none or similar function

is this the one 

tbody td.cart_unit .price 

Edited by datasphere
checked CSS (see edit history)

Share this post


Link to post
Share on other sites
7 hours ago, NemoPS said:

That would not help, we need to see the actual site

ah boomer it is still on local computer

....I will share it when it is up, 

so we can all learn this where that CSS or code hides

thanks for your time Nemo  !

Share this post


Link to post
Share on other sites

if you mind was on this

<td class="cart_unit" data-title="{l s='Unit price'}">
		<ul class="price text-right" id="product_price_{$product.id_product}_{$product.id_product_attribute}{if $quantityDisplayed > 0}_nocustom{/if}_{$product.id_address_delivery|intval}{if !empty($product.gift)}_gift{/if}">

 

I must say, this seems to me it is a price per product, like price per product in prestashop - if I am not mistaken

I was thinking on displaying price per unit - like price per 1 milk from a cardboard of 12 milk bottles

this one

{math equation="pprice / punit_price" pprice=$productPrice  punit_price=$product->unit_price_ratio assign=unit_price}
								<div class="unit-price mar_t4"><span id="unit_price_display">{convertPrice price=$unit_price}</span> {l s='per'} {$product->unity|escape:'html':'UTF-8'}</div>
								{hook h="displayProductPriceBlock" product=$product type="unit_price"}

 

Edited by datasphere
typo (see edit history)

Share this post


Link to post
Share on other sites

OK I MANAGED TO MANUALLY CREATE IT

code to

 

shopping-cart.tpl

shopping-cart-advanced.tpl

shopping-cart-product-line.tpl

looks like this , good enough, very good in factresult.thumb.JPG.4be07d652018ec61a2b4a796544698ea.JPG

 

now my code to display price.per.unit does not show

is it wrong? can you help me format it properly?

not a good code but I am borrowing it from "Carton Price"  [in fact PRODUCT PRICE] - not working

		<td class="cart_unit_unit" data-title="{l s='Per unit price'}>
		<div class="mobile_table_content">
		<ul class="price text-center" id="product_price_{$product.id_product}_
		{$product.id_product_attribute}_{$product.id_address_delivery|intval}_{if $product.unit_price_ratio > 0}_
		{math equation="pprice / punit_price" pprice=$product.price_tax_exc punit_price=$product.unit_price_ratio assign=unit_price}
   <span class="unit_price">
       {convertPrice price=$unit_price} / {$product.unity|escape:'html':'UTF-8'}
       </span>
		</ul>
		</div>

 

Edited by datasphere (see edit history)

Share this post


Link to post
Share on other sites

Hmm I am not sure all those variables are assigned to the cart products, try to put a {$product|@debug_print_var} there, and see if it actually has those variables

Share this post


Link to post
Share on other sites

ah, this debug printed:

 

Array (67)
id_product_attribute => "1518"
id_product => "929"
cart_quantity => "1"
id_shop => "1"
name => "Cushion Cover Twinkle 17 X 17" (Black)"
is_virtual => "0"
description_short => "<p>Plain finish on reverse</p><br /><..."
available_now => ""
available_later => ""
id_category_default => "2"
id_supplier => "0"
id_manufacturer => "0"
on_sale => "0"
ecotax => "0.000000"
additional_shipping_cost => "0.00"
available_for_order => "1"
price => 18
active => "1"
unity => "Cover"
unit_price_ratio => "12.000000"
quantity_available => "10"
width => "0.000000"
height => "0.000000"
depth => "0.000000"
out_of_stock => "2"
weight => 0
date_add => "2016-12-12 09:15:18"
date_upd => "2018-02-18 19:44:27"
quantity => "1"
link_rewrite => "cushion-cover-twinkle-17-x-17-black"
category => "home"
unique_id => "00000009290000001518960"
id_address_delivery => "960"
advanced_stock_management => "0"
supplier_reference => null
customization_quantity => null
id_customization => null
price_attribute => "0.000000"
ecotax_attr => "0.000000"
reference => "ref :"
weight_attribute => "0.000000"
ean13 => ""
upc => ""
minimal_quantity => "1"
wholesale_price => "1.500000"
id_image => "929-612"
legend => ""
reduction_type => 0
stock_quantity => 10
price_without_reduction => 21.6
price_with_reduction => 21.6
price_with_reduction_without_tax => 18
total => 18
total_wt => 21.6
price_wt => 21.6
reduction_applies => false
quantity_discount_applies => false
allow_oosp => 0
features => Array (0)
attributes => "Carton amount : 12, Colour : Red"
attributes_small => "12, Red"
rate => 20
tax_name => "VAT UK 20%"
price_without_quantity_discount => 18
reduction_formatted => "£ 0.00"
price_without_specific_price => 18
is_discounted => false

 

And this is displayed exactly where the per unit price should be :

twinkle-cover.thumb.JPG.604edaf3c3359fbb80279e07fecfe9fd.JPG

Edited by datasphere
additional explanation (see edit history)

Share this post


Link to post
Share on other sites

after I re examined the debug printout Nemo kindly provided

I now see I can just show 

wholesale_price

in that place during checkout

does anybody know how ? what code to place to display it ?

Thanks a lot !

Share this post


Link to post
Share on other sites
18 hours ago, NemoPS said:

In the same spot you can write {displayPrice price=$product.wholesale_price}

thanks man, it works

funny thing is I tried this before

but it did not work because  I've been using align text center ID from price.unit_price

stupid huh?

so instead of that I just used align="center"

and it works finally

like a charm!

BIG THANK YOU TO NEMOPS

here is the code for any future implementation

 

	<td class="cart_unity" data-title="{l s='Per unit price'}">
		<div class="mobile_table_content" align="center">{displayPrice price=$product.wholesale_price}
</div>	</td>
		

to make new column

 

you need  to add some code to the following TPL files

 

shopping-cart.tpl

<th class="cart_unit_unit item text-center">{l s='Per unit price'}</th>
					<th class="cart_unit item text-right">{l s='Unit price'}</th>
					<th class="cart_quantity item text-center">{l s='Qty'}</th>
					<th class="cart_delete last_item">&nbsp;</th>
					<th class="cart_total item text-right">{l s='Total'}</th>

shopping-cart-advanced.tpl

            <th class="cart_unit_unit item text-left">{l s='Per unit price'}</th>
            <th class="cart_unit item text-right">{l s='Unit price'}</th>
            <th class="cart_quantity item text-center">{l s='Qty'}</th>
            <th class="cart_total item text-right">{l s='Total'}</th>

This is to achieve what i needed for this shop you could name it differently or put something else there

for example price without VAT  and price with VAT,

THANK YOU all for reading

NEMO thanks again for lending a hand and helping me trough!

 

Share this post


Link to post
Share on other sites
  • 4 weeks later...

Hello,

i have the question  how to change font size of the "basic price" when  advancedeucompliance -module is installed? 

There is the following code which i have found by the developers tools in browser, but i can´t find this in an CSS ??  Any help please !??  :)

<p class="unit-price" style="display: block;"><span id="unit_price_display">31,99&nbsp;€</span> per 1 l</p> 

Share this post


Link to post
Share on other sites

Hi,  thank you :)

Should this be created in the  product.css  or in the  aeuc_front.css  ? 

 

In the aeuc_front.css  is already the following :

span.aeuc_from_label,
span.aeuc_before_label,
span.aeuc_tax_label,
div.aeuc_shipping_label,
div.aeuc_weight_label,
div.aeuc_delivery_label{
    color: #554f58;
    font-size: 8px;
}

and it seems that this is the correct place for a new class.  Or should this be done with an override in the themes/css/autoload/custom.css ?

I am not very firm with CSS so maybe you can give me some more hint, thank you.

Edited by DRMasterChief (see edit history)

Share this post


Link to post
Share on other sites

You know, we've discussed this in detail here: https://www.prestashop.com/forums/topic/520495-grundpreisangabe-auf-der-produktübersichtseite-oder-startseite/#comment-2303766 You got involved too. I really don't understand why you're sticking to an outdated topic three quarters of a year later. 

Du, wir haben das doch ausführlich hier diskutiert. Du hast dich auch beteiligt. Ich verstehe wirklich nicht, wieso du dich ein dreiviertel Jahr später an einen veralteten Topic anhängst. 

Share this post


Link to post
Share on other sites

Hi eleazar,

thank you for your message and the hint to  the other thread.  I thought this here was more matching my problem/question and yes, sometimes i use an old one for my questions when they match my problems  (maybe i am too old and storage saving :)  - when i was young 1MB storage was about 1,25 EUR) 

My question is how to change the size of the "unit price" and i cant find an answer in the thread you name, so maybe i can get an answer here ?! 

Share this post


Link to post
Share on other sites
  • 4 weeks later...

Hi,
unfortunately I was not able to enter the unit price in the product list shown in the category. I tried to follow the post, enter the code but obviously it did not work. 
If someone is kind to explain how to do all the steps
I am using a ps 1.6.1.18 locally with default theme.

Thanks a lot

unitprice.thumb.jpg.5324e0d382ef2b181bae87fcd786156b.jpg

Share this post


Link to post
Share on other sites
  • 3 weeks later...
On 3/31/2018 at 7:10 PM, DRMasterChief said:

Hello,

i have the question  how to change font size of the "basic price" when  advancedeucompliance -module is installed? 

There is the following code which i have found by the developers tools in browser, but i can´t find this in an CSS ??  Any help please !??  :)

<p class="unit-price" style="display: block;"><span id="unit_price_display">31,99&nbsp;€</span> per 1 l</p> 

 

you can do something like this 

<p class="unit-price" style="display: block; font-size:medium; font-color: red;"><span id="unit_price_display">31,99&nbsp;€</span> per 1 l</p> 

it is not recommended but it can pass ...

Share this post


Link to post
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...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More