Jump to content

how we can hide unavailable products in home page by edit ps_featuredproducts module


rezvan

Recommended Posts

I use prestashop 1.7.6.4

in home page module "ps_featuredproducts" can not stop display unavailable products.

..../modules/ps_featuredproducts  

i think by a code must do that

such as 

display    $product.quantity > 0

please answer this question

Link to comment
Share on other sites

./themes/your theme/modules/ps_featuredproducts/views/templates/hook/ps_featuredproducts.tpl

Old:

<section class="featured-products clearfix">
  <h2 class="h2 products-section-title text-uppercase">
    {l s='Popular Products' d='Shop.Theme.Catalog'}
  </h2>
  <div class="products">
    {foreach from=$products item="product"}
      {include file="catalog/_partials/miniatures/product.tpl" product=$product}
    {/foreach}
  </div>
  <a class="all-product-link float-xs-left float-md-right h4" href="{$allProductsLink}">
    {l s='All products' d='Shop.Theme.Catalog'}<i class="material-icons">&#xE315;</i>
  </a>
</section>

New:

<section class="featured-products clearfix">
  <h2 class="h2 products-section-title text-uppercase">
    {l s='Popular Products' d='Shop.Theme.Catalog'}
  </h2>
  <div class="products">
    {foreach from=$products item="product"}
      {if $product.quantity_all_versions > 0} 
        {include file="catalog/_partials/miniatures/product.tpl" product=$product}
      {/if}
    {/foreach}
  </div>
  <a class="all-product-link float-xs-left float-md-right h4" href="{$allProductsLink}">
    {l s='All products' d='Shop.Theme.Catalog'}<i class="material-icons">&#xE315;</i>
  </a>
</section>

 

Edited by Guest (see edit history)
Link to comment
Share on other sites

thanks for your answer

I do that

<section>
  <h1>{l s='Our Products' d='Modules.Featuredproducts.Shop'}</h1>
  <div class="products">
    {foreach from=$products item="product"}
    {if $product.quantity_all_versions > 0}
      {include file="catalog/_partials/miniatures/product.tpl" product=$product}
      {/if}
    {/foreach}
  </div>
  <a href="{$allProductsLink}">{l s='All products' d='Modules.Featuredproducts.Shop'}</a>
</section>

 

 

but it doesn't work

Link to comment
Share on other sites

./themes/your theme/modules/ps_featuredproducts/views/templates/hook/ps_featuredproducts.tpl

 

{*
* 2007-2016 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <[email protected]>
*  @copyright  2007-2016 PrestaShop SA
*  @license   http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*}

<section>
  <h1>{l s='Our Products' d='Modules.Featuredproducts.Shop'}</h1>
  <div class="products">
    {foreach from=$products item="product"}
    {if $product.quantity > 0}
      {include file="catalog/_partials/miniatures/product.tpl" product=$product}
      {/if}
    {/foreach}
  </div>
  <a href="{$allProductsLink}">{l s='All products' d='Modules.Featuredproducts.Shop'}</a>
</section>
 

Link to comment
Share on other sites

<section class="featured-products clearfix">
  <h2 class="h2 products-section-title text-uppercase">
    {l s='Popular Products' d='Shop.Theme.Catalog'}
  </h2>
  <div class="products">
    {foreach from=$products item="product"}
      {if $product.quantity_all_versions > 0} 
        {include file="catalog/_partials/miniatures/product.tpl" product=$product}
      {/if}
    {/foreach}
  </div>
  <a class="all-product-link float-xs-left float-md-right h4" href="{$allProductsLink}">
    {l s='All products' d='Shop.Theme.Catalog'}<i class="material-icons">&#xE315;</i>
  </a>
</section>

 

Link to comment
Share on other sites

thanks 

I make a mistake about follow module address

i edit this file: root/modules/ps_featuredproducts/views/templates/hook/ps_featuredproducts.tpl

that it is not work

but

your first post was correct and it's work

thank you

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