NemoPS Posted December 13, 2012 Share Posted December 13, 2012 Hey everybody! i just recorded a tutorial after giving the solution to this in a topic (can't find it anymore, geez). It's both video and written here it is: http://nemops.com/unit-price-in-prestashop-product-list/ I hope somebody can find it useful! Fabio 3 1 Link to comment Share on other sites More sharing options...
xaviour Posted December 13, 2012 Share Posted December 13, 2012 (edited) 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 December 13, 2012 by xaviour (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted December 13, 2012 Author Share Posted December 13, 2012 Hi, I don't know about prestashop 1.4, since that's for 1.5.2. Maybe it's just bugged. What are you unit price and full price? Link to comment Share on other sites More sharing options...
xaviour Posted December 14, 2012 Share Posted December 14, 2012 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... if you print out the product variable in the product list, you’ll notice an interesting property:$product.unit_price_ratio Link to comment Share on other sites More sharing options...
NemoPS Posted December 14, 2012 Author Share Posted December 14, 2012 Oh yep, I linked smarty documentation for that. In any case, it's {$product|@debug_print_var} The modifier is |@debug_print_var Link to comment Share on other sites More sharing options...
robbie007 Posted January 30, 2013 Share Posted January 30, 2013 (edited) 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 January 30, 2013 by robbie007 (see edit history) Link to comment Share on other sites More sharing options...
dazaau Posted February 8, 2013 Share Posted February 8, 2013 You are a legend! Thanks!! Link to comment Share on other sites More sharing options...
ricky11 Posted February 21, 2013 Share Posted February 21, 2013 Anyway to do show the unit in combinations? Link to comment Share on other sites More sharing options...
NemoPS Posted February 21, 2013 Author Share Posted February 21, 2013 Uhm, what do you mean? Link to comment Share on other sites More sharing options...
ricky11 Posted February 21, 2013 Share Posted February 21, 2013 I mean, if one product has 10 combinations, and each combination has its own unit, i.e. pcs, doz, lbs, etc. how do i show that unit next to the combination price? thanks. Link to comment Share on other sites More sharing options...
NemoPS Posted February 21, 2013 Author Share Posted February 21, 2013 Interesting question. i don't know. I'l investigate it when I have some time Link to comment Share on other sites More sharing options...
ricky11 Posted February 21, 2013 Share Posted February 21, 2013 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??? Link to comment Share on other sites More sharing options...
marketinghergo Posted February 26, 2013 Share Posted February 26, 2013 Hi nemo, what can I do if I don´t want to show the unit price if you are not logged in? I´m using hidepricecart module, but if you know the way to hide the unit price, please let me know. Link to comment Share on other sites More sharing options...
NemoPS Posted February 26, 2013 Author Share Posted February 26, 2013 Hi, If you're on 1.5, use {if $logged} Link to comment Share on other sites More sharing options...
ricky11 Posted February 26, 2013 Share Posted February 26, 2013 i hear islogged is going to be removed in future versions,, can't remember where i read it. Link to comment Share on other sites More sharing options...
NemoPS Posted February 26, 2013 Author Share Posted February 26, 2013 you're talking about $customer->isLogged(), not $logged, this is new Link to comment Share on other sites More sharing options...
marketinghergo Posted February 26, 2013 Share Posted February 26, 2013 Perfect!! Link to comment Share on other sites More sharing options...
sooroos Posted April 9, 2014 Share Posted April 9, 2014 any suggestion for 1.6? Link to comment Share on other sites More sharing options...
Alugart Posted August 7, 2014 Share Posted August 7, 2014 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 :< Link to comment Share on other sites More sharing options...
NemoPS Posted August 9, 2014 Author Share Posted August 9, 2014 Does it spawn any error? Or just nothing? Link to comment Share on other sites More sharing options...
Alugart Posted August 11, 2014 Share Posted August 11, 2014 (edited) 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? 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 August 11, 2014 by Alugart (see edit history) Link to comment Share on other sites More sharing options...
Docki Posted August 12, 2014 Share Posted August 12, 2014 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! 1 Link to comment Share on other sites More sharing options...
Alugart Posted August 13, 2014 Share Posted August 13, 2014 Owww yeaH!! It works! Damn me, it really does ! ! ! Thank you sooooo much Docki, you are the man! For everyone out there, who is using prestashop 1.6, the CODE IN PREVIOUS POST DISPLAYS PRICE PER UNIT IN CATALOGUE/PRODUCT LIST. Link to comment Share on other sites More sharing options...
simonfi Posted October 25, 2014 Share Posted October 25, 2014 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... 1 Link to comment Share on other sites More sharing options...
selectshop.at Posted November 15, 2014 Share Posted November 15, 2014 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 ? Link to comment Share on other sites More sharing options...
NemoPS Posted November 17, 2014 Author Share Posted November 17, 2014 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} Link to comment Share on other sites More sharing options...
Ibelin90 Posted January 19, 2015 Share Posted January 19, 2015 (edited) Guys,just one question.....if i need to set the unit price without tax and hide the price to visitors,how can i do? Edited January 19, 2015 by Ibelin90 (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted January 21, 2015 Author Share Posted January 21, 2015 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) Link to comment Share on other sites More sharing options...
JotaCe Posted January 24, 2015 Share Posted January 24, 2015 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) Link to comment Share on other sites More sharing options...
NemoPS Posted January 26, 2015 Author Share Posted January 26, 2015 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> Link to comment Share on other sites More sharing options...
JotaCe Posted January 26, 2015 Share Posted January 26, 2015 (edited) 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 January 26, 2015 by JotaCe (see edit history) Link to comment Share on other sites More sharing options...
emhava Posted January 11, 2016 Share Posted January 11, 2016 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? Link to comment Share on other sites More sharing options...
Shad86 Posted April 11, 2017 Share Posted April 11, 2017 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? Link to comment Share on other sites More sharing options...
datasphere Posted February 16, 2018 Share Posted February 16, 2018 how to display unit price and product price into add to cart=checkout page? I think it's order opc file ... thanks a lot Link to comment Share on other sites More sharing options...
NemoPS Posted February 16, 2018 Author Share Posted February 16, 2018 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) 1 Link to comment Share on other sites More sharing options...
datasphere Posted February 25, 2018 Share Posted February 25, 2018 (edited) 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 February 25, 2018 by datasphere adding the code (see edit history) Link to comment Share on other sites More sharing options...
datasphere Posted February 25, 2018 Share Posted February 25, 2018 (edited) <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 == '%'} {$priceReduction|string_format:"%.2f"|regex_replace:"/[^\d]0+$/":""}{$symbol} {else} {convertPrice price=$priceReduction} {/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&id_product={$product.id_product|intval}&ipa={$product.id_product_attribute|intval}&id_address_delivery={$product.id_address_delivery|intval}&op=down&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&id_product={$product.id_product|intval}&ipa={$product.id_product_attribute|intval}&id_address_delivery={$product.id_address_delivery|intval}&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&id_product={$product.id_product|intval}&ipa={$product.id_product_attribute|intval}&id_address_delivery={$product.id_address_delivery|intval}&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 February 25, 2018 by datasphere (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted February 25, 2018 Author Share Posted February 25, 2018 Strange, you already have a unit_price column there. Check to see if it's just hidden with css Link to comment Share on other sites More sharing options...
datasphere Posted February 26, 2018 Share Posted February 26, 2018 (edited) 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 February 26, 2018 by datasphere checked CSS (see edit history) Link to comment Share on other sites More sharing options...
datasphere Posted February 27, 2018 Share Posted February 27, 2018 On 2/25/2018 at 6:10 PM, NemoPS said: Strange, you already have a unit_price column there. Check to see if it's just hidden with css Nemo can you help me find which is it and where pretty please? Link to comment Share on other sites More sharing options...
NemoPS Posted February 27, 2018 Author Share Posted February 27, 2018 It's in the code you posted, inside the cart_unit block 1 Link to comment Share on other sites More sharing options...
datasphere Posted February 27, 2018 Share Posted February 27, 2018 11 minutes ago, NemoPS said: It's in the code you posted, inside the cart_unit block tnx but how to make it to show it? should I share global.css ? Link to comment Share on other sites More sharing options...
NemoPS Posted February 27, 2018 Author Share Posted February 27, 2018 That would not help, we need to see the actual site Link to comment Share on other sites More sharing options...
datasphere Posted February 28, 2018 Share Posted February 28, 2018 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 ! Link to comment Share on other sites More sharing options...
datasphere Posted February 28, 2018 Share Posted February 28, 2018 (edited) 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 February 28, 2018 by datasphere typo (see edit history) Link to comment Share on other sites More sharing options...
datasphere Posted February 28, 2018 Share Posted February 28, 2018 (edited) 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 fact 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 March 1, 2018 by datasphere (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted March 1, 2018 Author Share Posted March 1, 2018 price=$product.price Should work I think 1 Link to comment Share on other sites More sharing options...
NemoPS Posted March 2, 2018 Author Share Posted March 2, 2018 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 Link to comment Share on other sites More sharing options...
datasphere Posted March 2, 2018 Share Posted March 2, 2018 (edited) 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 : Edited March 2, 2018 by datasphere additional explanation (see edit history) Link to comment Share on other sites More sharing options...
datasphere Posted March 3, 2018 Share Posted March 3, 2018 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 ! Link to comment Share on other sites More sharing options...
NemoPS Posted March 4, 2018 Author Share Posted March 4, 2018 In the same spot you can write {displayPrice price=$product.wholesale_price} 1 Link to comment Share on other sites More sharing options...
datasphere Posted March 4, 2018 Share Posted March 4, 2018 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"> </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! Link to comment Share on other sites More sharing options...
DRMasterChief Posted March 31, 2018 Share Posted March 31, 2018 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 €</span> per 1 l</p> Link to comment Share on other sites More sharing options...
eleazar Posted March 31, 2018 Share Posted March 31, 2018 You need to create a special css class "unit-price" to change this behavior. There is no such class in the original file. 1 Link to comment Share on other sites More sharing options...
DRMasterChief Posted March 31, 2018 Share Posted March 31, 2018 (edited) 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 March 31, 2018 by DRMasterChief (see edit history) Link to comment Share on other sites More sharing options...
eleazar Posted April 1, 2018 Share Posted April 1, 2018 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. Link to comment Share on other sites More sharing options...
DRMasterChief Posted April 1, 2018 Share Posted April 1, 2018 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 ?! Link to comment Share on other sites More sharing options...
ballashop Posted April 28, 2018 Share Posted April 28, 2018 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 Link to comment Share on other sites More sharing options...
NemoPS Posted April 29, 2018 Author Share Posted April 29, 2018 Did you clear cache after editing the files? Link to comment Share on other sites More sharing options...
datasphere Posted May 19, 2018 Share Posted May 19, 2018 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 €</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 €</span> per 1 l</p> it is not recommended but it can pass ... Link to comment Share on other sites More sharing options...
DRMasterChief Posted May 20, 2018 Share Posted May 20, 2018 Thank you @datasphere but i use a new Theme and it is not necessary anymore to do this for me, so i can´t test it. Hopefully it is useful for someone. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now