Skip to content

Returns Sale and/or New label on Magento product object.

Notifications You must be signed in to change notification settings

wirelab/Magento2-Product-Labels

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Magento2-Product-Labels

Prints a simple Sale label and New in Magento Category page

How to use

  1. Instanciate the helper within list.phtml (inside foreach)
$labels = $this->helper('Wirelab\ProductLabels\Helper\Labels');
  1. Add the HTML anywhere inside the foreach statement
<?php if($labels->isProductNew($_product)) : ?>
    <span class="label label-new">
        <?php echo __('New'); ?>
    </span>
<?php endif; ?>

<?php if($labels->isProductOnSale($_product)) : ?>
    <span class="label label-sale">
        <?php echo __('Sale'); ?>
    </span>
<?php endif; ?>

Releases

No releases published

Packages

No packages published

Languages