Show Price with and without taxes into Product Page - prestashop

I have a problem into a Prestashop 1.7 solution.
Into a Product page, i want to show 2 prices (include and exclude VAT)
<span itemprop="price" content="{$product.price_amount}">{$product.price}</span>
This example show price with VAT. I don't find how show price without VAT too.
Thanks

You can use {debug} in your .tpl and you will see all available variables that you can use.
Our you can use {$product|#var_dump} which will show you what sub-variables the $product variable contains

You can use {$product.price_tax_exc} variable to display price with tax excluded.

There is the displayPrice() method that you can use to format the price displayed.
But since version 1.7.6 you should use the formatPrice() method, since displayPrice is deprecated.
You can use it like this:
{block name='product_without_taxes'}
{if $priceDisplay != 1}
<p class="product-without-taxes">{l s='%price% tax excl.' d='Shop.Theme.Catalog' sprintf=['%price%' => Context::getContext()->currentLocale->formatPrice($product.price_tax_exc, $currency.iso_code)]}</p>
{/if}
{/block}
This way you'll have the price formatted with the current currency and the tax excl. text. For example in French it will display 10,00 € HT, 'HT' meaning 'tax excluded'

Related

How to changes the currency of fixed price in Shopify?

I want to change the currency of fixed price for currency change I've using shopify market for change the currency which is working fine but for fixed price(in green circle) to change I've using following code, its working but conversion is not accurate(you can check price for middle section), any help would be appreciated.
{% assign val = 81 %}
<span class="money">{{ val | money }}</span>

(Prestashop 1.7) Show shipping costs only after country address is added

Do you know how to add and show shipping costs in checkout summary, ONLY after an address (with county) is added/selected, on Prestashop 1.7.6?
Is it possible?
You make your country have county as requirement.
You edit the corresponding .tpl (which serves the shipping cost)
{if !isset($address)}
<span class="alert alert-warning">
{l s='Choose address to see the shipping cost'}
</span>
{else}
{* Here the actual content *}
{/if}
Regards,
Konstantinos A. Kogkalidis

Metafields in Shopify: Trying to display Final Sale message for products that are 60% off

In my customized Shopify theme, a "Final Sale" message displays for any product that is 70% off using the following code:
{% assign finalSale = product.metafields.details.final_sale | upcase %}
{% if finalSale == 'TRUE' %}
<p style="color: #B21F1F;">
This item is final sale -- no returns or exchanges are accepted.
</p>
{% endif %}
I am trying to change this so it displays the Final Sale message when the product is 60% off. My theme is using the Metafields 2 app and I do see the active metafield called "final_sale" under the "Configure Product Metafields" page but I don't see where I can adjust the percentage that is assigned to this custom metafield...Does anyone know where I can find this?
The 60% figure isn't anywhere in this code, and isn't part of the theme at all. The percentage comparison is being done when the metafield gets assigned to TRUE. It's only possible to read metafields in liquid, though—you can't write to them there. You'd definitely need to look for code that sets the metafield elsewhere; perhaps as part of a custom app.
I don't think you need the metafield for this case at all, though. You could set up the logic right in liquid using product.price attributes and the math filters.
It would look something like this in liquid:
if compare_at_price | minus price | divided_by compare_at_price >= 0.6
One thing to pay attention to with this approach is Shopify's math filters rounding to the nearest integer at times, but you can fix that by multiplying by 100 before you start.
assign sale_amount = compare_at_price | minus price | times 100
assign adjusted_compare_price = compare_at_price | times 100
if sale_amount | divided_by adjusted_compare_price >= 60
The actual implementation might need to be a little more complex than this depending on how you use variants and variant pricing, plus this example can't handle the case where "price" is the original and "compare at" is the sale amount. Those can also be handled with liquid's logic. Here are the relevant liquid references to help you build this out further if needed:
https://help.shopify.com/themes/liquid/objects/product
https://help.shopify.com/themes/liquid/filters/math-filters

Prestashop - out of stock list

I have a prestashop shop, when I sell t-shirts. Every t-shirt have several sizes (combinations), i.e. M, L, XL etc.
In blocklayered filter there are two filters: "Available" and "Out of stock" products, but they behave weirdly: "out of stock" filter shows products, that have 0 quantity in one/several sizes.
How can I modify this to show on "out of stock" list only products, that have no items available in ALL available sizes.
What I mean is when a t-shirt have 3 items in size M, but 0 in size L, I do not want it to show on "Out of stock" list.
The second thing is - how can I hide products, that are truly "out of stock" (no items in all combinations) from default category list page? What I want to achieve is that on category pages we have "Archive" tab, which should show products that used to be available in shop, but they are not anymore.
I use PS 1.6.1.9
Open www/themes/yourtheme/product-list (Dont forget to backup)
Search for
{assign var='nbLi' value=$products|#count}
Right below add
{foreach from=$products item=product name=products}
{if ($product.quantity <= 0)}
{$nbLi=$nbLi-1}
{/if}
{/foreach}
Search for
{foreach from=$products item=product name=products}
Right below add
{if ($product.quantity > 0)}
Search for
{/foreach}
Right above add
{/if}
Replace all instances of
$smarty.foreach.products.total
and
$smarty.foreach.products.iteration
with
$nbLi
This question was anwsered by MEG Venture in the prestashop forum.
https://www.prestashop.com/forums/topic/537182-disable-out-of-stock-product-from-listing-only/
There is a function in StockAvailable.php core class of PrestaShop that can be used to find the actual quantity of any option of a product.
StockAvailable::getQuantityAvailableByProduct()
You can simply run through a loop for every option of a product and find the quantity for all options and mark the product out of stock only if any option is not available.

prestashop free shipping issue

I just upgraded firstly manually but later on by 1-click Upgradev1.0.13 to 1.5.4 version. I got a big problem on shopping cart with the shipping fees.
The cart located on homepage top left was solve not to show "FREE SHIPPING" from the previous code in this forum.
But once I checked on the shopping cart inside after I select and press "Update Carrier List" button and
press "Update Cart" button, the shipping fees is not updated but show as "FREE SHIPPING".
Could anyone suggest me solution about this? Thank you very much. I very much appreciate it.
My demo website is http://store.relishthai.com/.
You can try to add item by selecting the "TEA" tag and add one item to the cart and see the "FREE SHIPPING" problem.
I have had a very similar issue. The problem is that there is a Javascript file that updates the value to "FREE SHIPPING" if the value(shipping price) is equal to 0.00. I am using a different version, so I can't exactly point you to the file, but you can definitely solve this in three minutes. (Check order-opc.js in your theme/js folder)
View source of the web page and see what .js files are included. Search "FREE SHIPPING" in Javascript files (such as cart.js) and see which one is the culprit. Then go on FTP and change it to 0.00. I prefer "Free!" by the way ;)
EDIT: It seems like I misread your Q.
I tried pressing "Update carrier list" and then "Update cart", but I do not see the shipping fees as "Free shipping." Instead, I see 8 dollars.
Thanks again. Previously before your answer the $0.00 appeared in the top left cart on the page but later on after your comments I double checked things and deleted unused zone (no fees in there). And I tried to put the real shipping fees for all weight ranges. Now, the old problems has been solved but the shipping fees with weight ranges (in small ranges) still exits. I'll try to figure things out.
Many Thanks!!
Open the file /themes/xxx/modules/blockcart/blockcart.tpl
and remove this block of code (or comment):
<div class="layer_cart_row">
<strong class="dark">
{l s='Total shipping' mod='blockcart'} {if $display_tax_label}{if $priceDisplay == 1}{l s='(tax excl.)' mod='blockcart'}{else}{l s='(tax incl.)' mod='blockcart'}{/if}{/if}
</strong>
<span class="ajax_cart_shipping_cost">
{if $shipping_cost_float == 0}
{l s='Free shipping!' mod='blockcart'}
{else}
{$shipping_cost}
{/if}
</span>
</div>