Jump to content

Remove "New" label by products


De Verzamelman

Recommended Posts

I found the following code in the file theme.css in my assets folder of my theme. When I change block to none, the label "new" is gone but unfortunately also all other labels (sale, online only)

Does anyone have a solution?

#products .product-miniature .discount-percentage,
#products .product-miniature .on-sale,
#products .product-miniature .online-only,
#products .product-miniature .pack,
#products .product-miniature .product-flags .new,
#product .discount-percentage,
#product .on-sale,
#product .online-only,
#product .pack,
#product .product-flags .new,
.featured-products .product-miniature .discount-percentage,
.featured-products .product-miniature .on-sale,
.featured-products .product-miniature .online-only,
.featured-products .product-miniature .pack,
.featured-products .product-miniature .product-flags .new,
.product-accessories .product-miniature .discount-percentage,
.product-accessories .product-miniature .on-sale,
.product-accessories .product-miniature .online-only,
.product-accessories .product-miniature .pack,
.product-accessories .product-miniature .product-flags .new,
.product-miniature .product-miniature .discount-percentage,
.product-miniature .product-miniature .on-sale,
.product-miniature .product-miniature .online-only,
.product-miniature .product-miniature .pack,
.product-miniature .product-miniature .product-flags .new {
    display: block;
    /*position: relative;*/

    position: relative;
    /*added*/
    
    /*left: -.4375rem;*/
    /*top: .4375rem;*/
    padding: .3125rem .4375rem;
    color: #fff;
    background: #2fb5d2;
    text-transform: uppercase;
    min-width: 2.125rem;
    min-height: 1.875rem;
    font-size: 1rem;
    font-weight: 600;
    text-align:center;
    /*added*/
    
    clear:both;
    /*added*/
    
    float:left;
    /*added*/
    
    margin-top: .625rem;
    /*added*/
    
    margin-left: -.3125rem;
    /*added*/
    
    /*box-shadow: 2px 2px 4px 0 rgba(0, 0, 0, .2)*/
}
Edited by De Verzamelman (see edit history)
Link to comment
Share on other sites

You want to remove it only for certain products, or for all products?

If you want to remove it completely, then you can either edit the ProductPresenter, which has the the following code, and either remove it or comment it out.

        if ($product['new']) {
            $flags['new'] = array(
                'type' => 'new',
                'label' => $this->translator->trans('New', array(), 'Shop.Theme.Catalog'),
            );
        }

 

Or you might look into customizing the themes template files. For example, the following code is in the following file, which iterates through different product flags.  You could check the product flag value is "new", and then choose to display it or not based on the product

\themes\classic\templates\catalog\_partials\miniatures

      {block name='product_flags'}
        <ul class="product-flags">
          {foreach from=$product.flags item=flag}
            <li class="product-flag {$flag.type}">{$flag.label}</li>
          {/foreach}
        </ul>
      {/block}

 

Link to comment
Share on other sites

  • 1 year later...
On 10/29/2017 at 7:54 AM, bellini13 said:

You want to remove it only for certain products, or for all products?

If you want to remove it completely, then you can either edit the ProductPresenter, which has the the following code, and either remove it or comment it out.


        if ($product['new']) {
            $flags['new'] = array(
                'type' => 'new',
                'label' => $this->translator->trans('New', array(), 'Shop.Theme.Catalog'),
            );
        }

 

Or you might look into customizing the themes template files. For example, the following code is in the following file, which iterates through different product flags.  You could check the product flag value is "new", and then choose to display it or not based on the product

\themes\classic\templates\catalog\_partials\miniatures


      {block name='product_flags'}
        <ul class="product-flags">
          {foreach from=$product.flags item=flag}
            <li class="product-flag {$flag.type}">{$flag.label}</li>
          {/foreach}
        </ul>
      {/block}

 

Hello,

Please for version 1.7.4.4?
Yes, I'd like to hide the "new" flag, on products with the "sale" flag. In ProductPresenter.php :

All this:
if ($product['new']) and
$product['on_sale']) and
$product['reduction'])

I'd like the assignment to be:
$flags['new'] must be hidden.

Or hide it in template file using classes? Up till now everything I did failed :(

Any help is much appreciated. Thank you!

Link to comment
Share on other sites

  • 4 months later...

You need to edit the tables ps_product and ps_product_shop. Set the 'date_add' and 'date_upd' fields to more than 30 days in the past (or different period if not using the default setting). Then clear your cache.

(these instructions apply to ver 1.6 but I expect it's the same in 1.7)

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...