Okay
  Public Ticket #1383956
Sale label not working
Closed

Comments

  •  1
    ilirfekaj started the conversation

    The “Sale” block doesn’t seem to work. i followed the instructions: setup the special price and from and to, but nothing seems to work. Same products don’t have a “Sale” label in the catalog and don’t show original price crossed. “New” products works fine. All my products are configurable and I’m using Magento 2.2.1. Any idea what could cause this issue?

  • [deleted] replied

    Hi

    Thanks for your feedback but with Configurable Product on the magento2, you will can't see original price and sale label, you can see original price when you select option. This is not theme error, it is a default magento2 feature.

  •  1
    ilirfekaj replied

    This makes this feature pretty much useless for most apparel/footwear stores as most items have configurations. May I ask why is it not possible to apply sale label to configurable products?

    Is there any other way to apply a sale label to certain products?

  • [deleted] replied

    Hi

    I think that I can help to show the sale label, can you please provide your site info ( admin account and ftp access detail ) I will check for you

  •  1
    ilirfekaj replied

    Thanks for your offer. Unfortunately I'm not allowed to do this. Are you, by any chance, able to assist me this way? Magento version is 2.2.1

  • [deleted] replied

    Hi

    So please try to edit Data.php in app/code/MGS/Mpanel/Helper/ folder

    (Around line 500) :

    // Sale label

    Replace

     $price = $product->getPrice(); 

     $finalPrice = $product->getFinalPrice();

    with

    $price = $product->getFinalPrice();

    $finalPrice = $product->getPriceInfo()->getPrice('final_price')->getValue();

    Then refesh cache and try again

    Also note to back the file up before change

  •  1
    ilirfekaj replied

    Unfortunately this didn't work. Any other suggestions?

  • [deleted] replied

    Hi,

    I tried on my local and this works good. Please try again

    Open: app/code/MGS/Mpanel/Helper/Data.php

    Replace

     $price = $product->getPrice(); 

     $finalPrice = $product->getFinalPrice();

    with

    $price = $product->getFinalPrice();

    $finalPrice = $product->getPriceInfo()->getPrice('final_price')->getValue();


    Please clean cache and check by private browser

    Best regards!

  •  1
    ilirfekaj replied

    Thank you for your support, but this didn't work for me. Can I confirm I'm doing this correctly? Is it enough to just set the special price and from and to dates? Am I required to perform some additional steps?

  • [deleted] replied

    Hi,

    I tried to test on my local and it is working exactly.

    Can you install the theme on the demo sever, so i will easily check for you.

    Best regards!

  •  1
    ilirfekaj replied

    It still doesn't work. For configurable products that have a special price $price = $product->getFinalPrice(); always returns 0.0000. However, I tried using $price = $product->getPriceInfo()->getPrice('regular_price')->getValue(); which returns the correct price. After adding this code sale label appears even on configurable products.


    In order to display the original price crossed I just added this CSS:

    .old-price {
    display: inline !important;
    }


  • rebegia replied

    Hello, same problem, you solve it ?

  • rebegia replied

    Can you give me more details how you solve your problem , please ?

  • [deleted] replied

    Hi,

    Thanks for feedback, I will reinstall the theme and send the video of the issue to you, please wait

    Best regards!

  • [deleted] replied

    Hi, 

    Please update the patch to your site

    Best regards!