Michi001 Posted December 22, 2020 Share Posted December 22, 2020 Hi guys, i´m a little bit confused 🤪 I want to show the stock qty in the list view. I try to place the following code in different lines in the product-listgrid.tpl but i get no result. What is wrong? Code from product-details.tpl: {block name='product_quantities'} {if $product.show_quantities} <div class="product-quantities"> <label class="label">{l s='In stock' d='Shop.Theme.Catalog'}</label> <span>{$product.quantity} {$product.quantity_label}</span> </div> {/if} {/block} My product-listgrid.tpl: {** * 2007-2017 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 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/osl-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 <contact@prestashop.com> * @copyright 2007-2017 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA *} {block name='product_miniature_item'} <div class="product-miniature js-product-miniature" data-id-product="{$product.id_product}" data-id-product-attribute="{$product.id_product_attribute}" itemscope itemtype="http://schema.org/Product"> <div class="thumbnail-container"> {block name='product_thumbnail'} <a href="{$product.url}" class="thumbnail product-thumbnail"> <img src = "{$product.cover.bySize.home_default.url}" alt = "{if !empty($product.cover.legend)}{$product.cover.legend}{else}{$product.name|truncate:30:'...'}{/if}" data-full-size-image-url = "{$product.cover.large.url}" > {hook h="displayCzHoverImage" id_product=$product.id_product home='home_default' large='large_default'} </a> {/block} {block name='product_flags'} <ul class="product-flags"> {foreach from=$product.flags item=flag} <li class="{$flag.type}">{$flag.label}</li> {/foreach} </ul> {/block} <div class="outer-functional"> <div class="functional-buttons"> {hook h='displayProductListFunctionalButtons' product=$product} {* {block name='quick_view'} <a href="#" class="quick-view" data-link-action="quickview"> <i class="material-icons search"></i> {l s='Quick view' d='Shop.Theme.Actions'} </a> {/block} *} <div class="product-actions"> <form action="{$urls.pages.cart}" method="post" class="add-to-cart-or-refresh"> <input type="hidden" name="token" id="tokenId" value="{$static_token}"> <input type="hidden" name="id_product" value="{$product.id}" class="product_page_product_id"> <input type="hidden" name="id_customization" value="0" class="product_customization_id"> <input type="hidden" name="qty" value="1"> <button class="btn btn-primary add-to-cart" data-button-action="add-to-cart" type="submit" {if $product.availability == 'unavailable'}disabled{/if}> <span>{l s='Add to cart' d='Shop.Theme.Actions'}</span> </button> </form> </div> </div> </div> </div> <div class="product-description"> {block name='product_name'} <h3 class="h3 product-title" itemprop="name"><a href="{$product.url}">{$product.name|truncate:30:'...'}</a></h3 > {/block} {block name='product_price_and_shipping'} {if $product.show_price} <div class="product-price-and-shipping"> {if $product.has_discount} {hook h='displayProductPriceBlock' product=$product type="old_price"} <span class="regular-price">{$product.regular_price}</span> {if $product.discount_type === 'percentage'} <span class="discount-percentage discount-product">{$product.discount_percentage}</span> {elseif $product.discount_type === 'amount'} <span class="discount-amount discount-product">{$product.discount_amount_to_display}</span> {/if} {/if} {hook h='displayProductPriceBlock' product=$product type="before_price"} <span itemprop="price" class="price">{$product.price}</span> {hook h='displayProductPriceBlock' product=$product type='unit_price'} {hook h='displayProductPriceBlock' product=$product type='weight'} </div> {/if} {/block} {block name='product_reviews'} {hook h='displayProductListReviews' product=$product} {/block} {block name='product_description_short'} <div class="product-detail" itemprop="description">{$product.description_short nofilter}</div> {/block} <div class="highlighted-informations{if !$product.main_variants} no-variants{/if} hidden-sm-down"> {block name='product_variants'} {if $product.main_variants} {include file='catalog/_partials/variant-links.tpl' variants=$product.main_variants} {/if} {/block} {*Show product stock qty*} {block name='product_quantities'} {if $product.show_quantities} <div class="product-quantities"> <label class="label">{l s='In stock' d='Shop.Theme.Catalog'}</label> <span>{$product.quantity} {$product.quantity_label}</span> </div> {/if} {/block} {block name='product_availability'} <span class="product-availability"> {if $product.show_availability && $product.availability_message} {if $product.availability == 'available'} <span class="product-available"> <i class="material-icons"></i> {elseif $product.availability == 'last_remaining_items'} <span class="product-last-items"> <i class="material-icons"></i> {else} <span class="product-unavailable"> <i class="material-icons"></i> {/if} {$product.availability_message} </span> {/if} </span> {/block} </div> </div> </div> {/block} thanks for your help. regards Michael Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now