Jump to content

Prestashop 1.7 change discount price color


asperon

Recommended Posts

41 minutes ago, labib92 said:

Send me a screenshot please 

here you are but you dont need screenshot i need a new class for discount prices look at the screenshot i need red color for new price only with discount

screencapture-localhost-1-7-2019-03-29-15_53_21.png

Link to comment
Share on other sites

7 minutes ago, Rodrigo B Laurindo said:

Your solution is in the first answer, in my opinion.

Assuming that you are using v1.7, go to /themes/yourmodule/assets/css and edit the file custom.css.

Add the following code:


.product-flags .discount, .product-flags .on-sale {
    color: red;
}

 

I will check this out but this cannot by a solution on my opinion i think this css code only change badge colors i think

Link to comment
Share on other sites

6 minutes ago, Rodrigo B Laurindo said:

Ok, I think I misunderstood.

You mean.. .red color for product price, not discount, but only when it has a discout?

When it doesn't have a discount the color should remain the same?

Yes i mean just that i need color for products on sale only for new price on default prestashop dont have this feature. 

Link to comment
Share on other sites

2 minutes ago, Rodrigo B Laurindo said:

Did you try this?


		{if $product.has_discount}
			<div class="current-price" >
		{else}
			<div class="current-price current-price-with-discount" >
		{/if}

 

Not the same but i will test this one thanks for the help :)

Link to comment
Share on other sites

On 3/30/2019 at 8:37 PM, Rodrigo B Laurindo said:

Of course, you would have to add the proper css 😊
Let me know if it works

Unfortunately is not working i add proper css styles and add this code to product-prices.tpl

Link to comment
Share on other sites

12 minutes ago, Rodrigo B Laurindo said:

Sorry, I have posted my answer in the wrong language before. I have edited it now.

What CSS code did you use? Is the modification shown in your html page?

i use current-price for css. But modification is not shown in html page

Link to comment
Share on other sites

this is the schema in product-prices.tpl file without modification

{if $product.show_price}
  <div class="product-prices">
    {block name='product_discount'}
      {if $product.has_discount}
        <div class="product-discount">
          {hook h='displayProductPriceBlock' product=$product type="old_price"}
          <span class="new-price">{$product.regular_price}</span>
        </div>
      {/if}
    {/block}

    {block name='product_price'}
      <div
        class="product-price h5 {if $product.has_discount}has-discount{/if}"
        itemprop="offers"
        itemscope
        itemtype="https://schema.org/Offer"
      >
        <link itemprop="availability" href="https://schema.org/InStock"/>
        <meta itemprop="priceCurrency" content="{$currency.iso_code}">

        <div class="current-price">
          <span itemprop="price-new" content="{$product.price_amount}">{$product.price}</span>
          {if $product.has_discount}
            {if $product.discount_type === 'percentage'}
              <span class="discount discount-percentage">{l s='Save %percentage%' d='Shop.Theme.Catalog' sprintf=['%percentage%' => $product.discount_percentage_absolute]}</span>
            {else}
              <span class="discount discount-amount">
                  {l s='Save %amount%' d='Shop.Theme.Catalog' sprintf=['%amount%' => $product.discount_to_display]}
              </span>
            {/if}
          {/if}
        </div>

        {block name='product_unit_price'}
          {if $displayUnitPrice}
            <p class="product-unit-price sub">{l s='(%unit_price%)' d='Shop.Theme.Catalog' sprintf=['%unit_price%' => $product.unit_price_full]}</p>
          {/if}
        {/block}
      </div>
    {/block}

    {block name='product_without_taxes'}
      {if $priceDisplay == 2}
        <p class="product-without-taxes">{l s='%price% tax excl.' d='Shop.Theme.Catalog' sprintf=['%price%' => $product.price_tax_exc]}</p>
      {/if}
    {/block}

    {block name='product_pack_price'}
      {if $displayPackPrice}
        <p class="product-pack-price"><span>{l s='Instead of %price%' d='Shop.Theme.Catalog' sprintf=['%price%' => $noPackPrice]}</span></p>
      {/if}
    {/block}

    {block name='product_ecotax'}
      {if $product.ecotax.amount > 0}
        <p class="price-ecotax">{l s='Including %amount% for ecotax' d='Shop.Theme.Catalog' sprintf=['%amount%' => $product.ecotax.value]}
          {if $product.has_discount}
            {l s='(not impacted by the discount)' d='Shop.Theme.Catalog'}
          {/if}
        </p>
      {/if}
    {/block}

    {hook h='displayProductPriceBlock' product=$product type="weight" hook_origin='product_sheet'}

    <div class="tax-shipping-delivery-label">
      {if $configuration.display_taxes_label}
        {$product.labels.tax_long}
      {/if}
      {hook h='displayProductPriceBlock' product=$product type="price"}
      {hook h='displayProductPriceBlock' product=$product type="after_price"}
    </div>
  </div>
{/if}
 

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