Jump to content
ps2k11

Total in shopping cart summary

Recommended Posts

Using Prestashop 1.7.4.2

I found this information to add total in shopping cart summary

<span class="label">Total (tax + shipping incl.)</span>
      <span class="value">{$currency.iso_code}{$currency.sign}{$cart.totals.total.amount+$cart.subtotals.tax.amount}</span> 

I use different languages, want translate the label Total (tax + shipping incl.) but not sure how to

in previous versions of prestashop the l s would add labels in translations but not version 1.7

Not sure why no total in cart summary, I guess customer have to use a calculator now

 

Share this post


Link to post
Share on other sites

Hi,

Use the line mentioned below & then translate the same from the backend.

{l s='Total (tax + shipping incl.)' d='Shop.Forms.Labels'}

I hope it will help.

 

Share this post


Link to post
Share on other sites
13 hours ago, ps2k11 said:

Using Prestashop 1.7.4.2

I found this information to add total in shopping cart summary

<span class="label">Total (tax + shipping incl.)</span>
      <span class="value">{$currency.iso_code}{$currency.sign}{$cart.totals.total.amount+$cart.subtotals.tax.amount}</span> 

I use different languages, want translate the label Total (tax + shipping incl.) but not sure how to

in previous versions of prestashop the l s would add labels in translations but not version 1.7

Not sure why no total in cart summary, I guess customer have to use a calculator now

 

 

follow as per Knowband suggested you then go to Backoffice international/translation. Select your theme and language to modify it in your language.

Share this post


Link to post
Share on other sites

Hi,

Use in Prestashop 1.7.4.2 with two digits after the decimal point and the translations !!

- for cart-summary-totals.tpl

{block name='cart_summary_total'}
    <div class="cart-summary-line cart-total">
      <span class="label">{l s='Total (tax + shipping incl.)' d='Shop.Forms.Labels'}</span>
      <span class="value">{$cart.totals.total.amount + $cart.subtotals.tax.amount|string_format:"%.2f"} {$currency.sign}</span>
    </div>
 {/block}

-----------------------------------------------------

 - For order-confirmation-table.tpl

        <tr class="font-weight-bold">
          <td><span class="text-uppercase">{$totals.total.label}</span> {$labels.tax_short}</td>
          <td>{$totals.total.value}</td>
          </tr>
          <tr class="font-weight-bold">
          <td><span class="text-uppercase">{l s='Total' d='Shop.Forms.Labels'}</span></td>
          <td>{$totals.total.amount + $subtotals.tax.amount|string_format:"%.2f"} {$currency.sign}</td>
        </tr>
      </table>

----------------------------------------------------

- For cart_detailed_totals.tpl

{block name='cart_detailed_totals'}
<div class="cart-detailed-totals">

  <div class="card-block">
    {foreach from=$cart.subtotals item="subtotal"}
      {if $subtotal.value && $subtotal.type !== 'tax'}
        <div class="cart-summary-line" id="cart-subtotal-{$subtotal.type}">
          <span class="label{if 'products' === $subtotal.type} js-subtotal{/if}">
            {if 'products' == $subtotal.type}
              {$cart.summary_string}
            {else}
              {$subtotal.label}
            {/if}
          </span>
          <span class="value">{$subtotal.value}</span>
          {if $subtotal.type === 'shipping'}
              <div><small class="value">{hook h='displayCheckoutSubtotalDetails' subtotal=$subtotal}</small></div>
          {/if}
        </div>
      {/if}
    {/foreach}
  </div>

  {block name='cart_voucher'}
    {include file='checkout/_partials/cart-voucher.tpl'}
  {/block}

  <hr class="separator">

  <div class="card-block">
    <div class="cart-summary-line cart-total">
      <span class="label">{$cart.totals.total.label} {$cart.labels.tax_short}</span>
      <span class="value">{$cart.totals.total.value}</span>
    </div>

    <div class="cart-summary-line">
      <small class="label">{$cart.subtotals.tax.label}</small>
      <small class="value">{$cart.subtotals.tax.value}</small>
    </div>
    
    <div class="cart-summary-line cart-total">
      <span class="label">{l s='Total' d='Shop.Forms.Labels'}</span>
      <span class="value">{$cart.totals.total.amount + $cart.subtotals.tax.amount|string_format:"%.2f"} {$currency.sign}</span>
    </div>
  </div>

  <hr class="separator">
</div>
{/block}
 

Salut

 

Share this post


Link to post
Share on other sites

ok thank you very much but how do I put with the right decimals:
es. now the total is 2655.45 and I want you to see 2.655,45
how can I do
thank you

 

Share this post


Link to post
Share on other sites

thank you very much, but the rest of the site works correctly and only with the function used {$ cart.totals.total.amount + $ cart.subtotals.tax.amount | string_format: "%. 2f"} {$ currency.sign} that the price is not correctly formatted,

 

Share this post


Link to post
Share on other sites

To format the total correctly replace

|string_format:"%.2f" 

WITH

|number_format:2:".":","

OR

|number_format:2:",":"."

depending on which format you require.

Share this post


Link to post
Share on other sites

Thank you for this solution. I have a problem though.

When i change language to english the euro icon goes to the front of the price in the rest of the page.  The only currency for the shop is euros. Is there a way to change to placement for english to front of the price and for Greek language to the back?

currency.jpg

Share this post


Link to post
Share on other sites
Posted (edited)

Thank you for sharing it.
I have another concern, about the item price total is displayed in TTC in the cart, how to view HT

Panier-en.thumb.jpg.355e0e488a4d9a8012c2bc9e8854ec4a.jpg

Edited by sikajeans (see edit history)

Share this post


Link to post
Share on other sites

I have a Prestashop 1.7 multistore where I need to get the shipping cost from variable (instead of writing it in normal text) since the shipping cost varies a lot depending on chosen currency.

I want to be able to get this in the header, and on the index/homepage.


I currently use this in the header to get the shipping:
{$cart.subtotals.shipping.amount}
And that works fine, except for when the cart is empty or when the free shipping amount is triggered. :(

Is there a way to get the default shipping cost even when the cart is empty and such?

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

×

Important Information

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