Reputation: 7391
PrestaShop v. 1.7.6 shows new products on homepage which are added to shop in last X days. But usually, this doesn't work for my clients, because they want to select them by hand. There are a lot of new products and only a few have to be promoted.
How it is possible to let the client Select which products will be in section "New" on the homepage and these products also should have LABEL "NEW" in categories listing everywhere in the shop, as it is by default for new products in PrestaShop.
Upvotes: 0
Views: 2073
Reputation: 7391
I created a new category "News" to select products by hand. So now I need to add label in listing and product page:
/catalog/_partials/miniatiures/product.tpl:
{block name='product_flags'}
<ul class="product-flags">
<!-- CUSTOM CODE -->
{foreach from=Product::getProductCategoriesFull($product.id_product) item=cat}
{if $cat.name== 'News' }
<li class="product-flag new">New</li>
{/if}
{/foreach}
<!-- / CUSTOM CODE -->
{foreach from=$product.flags item=flag}
<li class="product-flag {$flag.type}">{$flag.label}</li>
{/foreach}
</ul>
{/block}
/catalog/product.tpl:
{block name='product_flags'}
<ul class="product-flags">
<!-- CUSTOM CODE -->
{foreach from=Product::getProductCategoriesFull(Tools::getValue('id_product')) item=cat}
{if $cat.name== 'News' }
<li class="product-flag new">New</li>
{/if}
{/foreach}
<!-- / CUSTOM CODE -->
{foreach from=$product.flags item=flag}
<li class="product-flag {$flag.type}">{$flag.label}</li>
{/foreach}
</ul>
{/block}
To show these products in homepage I have used this FREE MODULE: https://mypresta.eu/modules/front-office-features/featured-products.html
Upvotes: 0
Reputation: 1447
The simple way is to use the ps_featuredproducts module and change translations.
This module works by position and you can change position manually.
Upvotes: 1
Reputation: 176
You can override module ps_newproducts to change the expected behavior. I did that on one of my project. I have override the module for a manual selection of products to display, it's more simple
Upvotes: 1
Reputation: 1022
New
products are selected automatically by PrestaShop.
By default, all products you add are considered to be New. You may change number of days during which your products is considered as New
at
Shop Parameters -> Product Settings -> Number of days for which the product is considered 'new'
Then the only way to select the products considered as new is modifying the field date_add
at table ps_product
.
Upvotes: 2