• Priority: 0
  • Status: Closed
  • Theme: Alysum
  • Assigned To: Fred
  • Private: No
  • Open Date: 21.06.21, 13:15
  • Opened by: Mazuelas Martin
  • Closed by: Anonymous Submitter
  • Closed on:
  • Reason: Not a bug

Ticket #21779 - Show original price if the discounted price is higher than the original price

We need to adapt the following code in amp template so that when the discount is greater than or equal to the sale price, I only show the sale price and hide the price with the discount that appears crossed out (attached capture)

The path to the file is:

/themes/alysum/templates/mobile/checkout/cart.tpl

The code that corresponds to the functionality that we want to adapt is:

{if !$configuration.is_catalog}

              <strong class="db m15 product-price price">
                {literal}{{#reduction}}{/literal}<del>{literal}{{price}}{/literal}</del>&nbsp;{literal}{{/reduction}}{/literal}{literal}{{price}}{/literal}<span>&nbsp;(✕{literal}{{cart_quantity}}{/literal})</span>
              </strong>

Attachments:

captura.pdf (85.1 KiB)

Comments

Fred 22 Jun 2021, 19:48

Is that correct now? https://take.ms/boJ6S

Mazuelas Martin 23 Jun 2021, 10:22

Is not correct for amp. I give you an example product code so that you can put it in the search engine and add it to the cart. Once this is done, when you go to the cart you will see what I describe in the screenshot that I have attached to the incident.

The product code for testing is 1500320100010

Thanks!!

Fred 23 Jun 2021, 11:36

you have complicated discount system.
Could you please explain a bit how it works? Do you use some module to manage product discounts?

Mazuelas Martin 24 Jun 2021, 11:03

For what we want to do we have modified the code with which I add you below:
{if $product.has_discount && $product.regular_price_amount >= $product.price}

      <div class="product-discount">
        <span class="regular-price">{$product.regular_price}</span>
        {if $product.discount_type === 'percentage'}
          <span class="discount discount-percentage">
              -{$product.discount_percentage_absolute}
            </span>
        {else}
          <span class="discount discount-amount">
              -{$product.discount_to_display}
            </span>
        {/if}
      </div>
    {/if}

With this code if the $product.regular_price_amount is greater than or equal to the price of the product $product.price, the tpl shows us only the price of the product. On the contrary, it would show us the price of the crossed-out product and the discount in bold

We want to do the same in the amp file /themes/alysum/templates/mobile/checkout/cart.tpl that we see that it has a different code and we do not know how to adapt it to the one I expose you. The current code of this file is as follows and we want it to perform the functionality that I have mentioned above:

<strong class=”db m15 product-price price”>

              {literal}{{#reduction}}{/literal}<del>{literal}{{price}}{/literal}</del>&nbsp;{literal}{{/reduction}}{/literal}{literal}{{price}}{/literal}<span>&nbsp;(✕{literal}{{cart_quantity}}{/literal})</span>
            </strong>

It’s possible?

Thanks!!

Fred 24 Jun 2021, 11:22

I think it’s possible. But we currently don’t have time to provide customization service. Too much tickets these days

Mazuelas Martin 25 Jun 2021, 10:16

You can tackle the task when you see fit. If these days you have too many tickets, it can be postponed to following weeks

Thanks!!

Fred 25 Jun 2021, 10:17

Ok, I’ll let you know if we will have free time