简体   繁体   中英

How to add “final sale” next to special price in cart page magento

I would like to add "final sale" for sale items next to special price in cart page. i added

<span class="price-label"><?php  echo $this->__('Final Sale')  ?></span>  

in template/checkout/cart/item/default.phtml but I am getting final sale for all the items in cart page. i want to add final sale for only sales items. How can i do that?

Use the Transate Inline.

Turn it on via System -> Configuration -> Developer -> Translate Inline.

You can change what it says by clicking it and changing the words to "Final Sale".

You can actually do this with an observer. The event to use is core_block_abstract_to_html_after and then you you can get that block's html with:

  $transport = $observer->getTransport();
  $html = $transport->getHtml();

  // do some stuff here to determine which items you need to edit the label for.
  // after editing the label, maybe with DomDocument and xpath, set the new html at the end 
  // of your observer like so:

  $transport->setHtml($html);

I use this method all the time because i hate modifying template files when the change is something small like you want to do.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM