Sébastien L Posted March 28, 2014 Share Posted March 28, 2014 Bonjour, Je souhaiterais ajouter les quantités, la disponibilité et la phrase "dernières pièces disponibles" sur la liste des produits (product-list.tpl) comme cela est possible sur product.tpl Pour ce faire, j'ai trouvé ce code, {*Added quantity in stock*} <!-- availability --> <p id="availability_statut"{if ($product.quantity <= 0 && !$product.available_later && $allow_oosp) OR ($product.quantity > 0 && !$product.available_now) OR !$product.available_for_order OR $PS_CATALOG_MODE} style="display: none;"{/if}> <span id="availability_label">{l s='Availability:'}</span> <span id="availability_value"{if $product.quantity <= 0} class="warning_inline"{/if}> {if $product.quantity <= 0}{if $allow_oosp}{$product.available_later}{else}{l s='This product is no longer in stock'}{/if}{else}{$product.available_now}{/if} </span> </p> <!-- number of item in stock --> {*if ($display_qties == 1 && !$PS_CATALOG_MODE && $product.available_for_order) *} <p id="pQuantityAvailable"{if $product.quantity <= 0} style="display: none;"{/if}> <span id="quantityAvailable">{$product.quantity|intval}</span> <span {if $product.quantity > 1} style="display: none;"{/if} id="quantityAvailableTxt">{l s='item in stock'}</span> <span {if $product.quantity == 1} style="display: none;"{/if} id="quantityAvailableTxtMultiple">{l s='items in stock'}</span> </p> {*/if*} <!-- Out of stock hook --> <p id="oosHook"{if $product.quantity > 0} style="display: none;"{/if}> {$HOOK_PRODUCT_OOS} </p> <p class="warning_inline" id="last_quantities"{if ($product.quantity > $last_qties OR $product.quantity <= 0) OR $allow_oosp OR !$product.available_for_order OR $PS_CATALOG_MODE} style="display: none"{/if} >{l s='Warning: Last items in stock!'}</p> {*End Added quantity in stock*} cependant la dernière partie du code concernant l'affiche des dernière pièces ne fonctionne pas. Quelqu'un a t-il une idée du problème ? D'avance merci Link to comment Share on other sites More sharing options...
Sébastien L Posted April 25, 2014 Author Share Posted April 25, 2014 Bonjour, Je souhaiterais ajouter les quantités, la disponibilité et la phrase "dernières pièces disponibles" sur la liste des produits (product-list.tpl) comme cela est possible sur product.tpl Pour ce faire, j'ai trouvé ce code, {*Added quantity in stock*} <!-- availability --> <p id="availability_statut"{if ($product.quantity <= 0 && !$product.available_later && $allow_oosp) OR ($product.quantity > 0 && !$product.available_now) OR !$product.available_for_order OR $PS_CATALOG_MODE} style="display: none;"{/if}> <span id="availability_label">{l s='Availability:'}</span> <span id="availability_value"{if $product.quantity <= 0} class="warning_inline"{/if}> {if $product.quantity <= 0}{if $allow_oosp}{$product.available_later}{else}{l s='This product is no longer in stock'}{/if}{else}{$product.available_now}{/if} </span> </p> <!-- number of item in stock --> {*if ($display_qties == 1 && !$PS_CATALOG_MODE && $product.available_for_order) *} <p id="pQuantityAvailable"{if $product.quantity <= 0} style="display: none;"{/if}> <span id="quantityAvailable">{$product.quantity|intval}</span> <span {if $product.quantity > 1} style="display: none;"{/if} id="quantityAvailableTxt">{l s='item in stock'}</span> <span {if $product.quantity == 1} style="display: none;"{/if} id="quantityAvailableTxtMultiple">{l s='items in stock'}</span> </p> {*/if*} <!-- Out of stock hook --> <p id="oosHook"{if $product.quantity > 0} style="display: none;"{/if}> {$HOOK_PRODUCT_OOS} </p> <p class="warning_inline" id="last_quantities"{if ($product.quantity > $last_qties OR $product.quantity <= 0) OR $allow_oosp OR !$product.available_for_order OR $PS_CATALOG_MODE} style="display: none"{/if} >{l s='Warning: Last items in stock!'}</p> {*End Added quantity in stock*} cependant la dernière partie du code concernant l'affiche des dernière pièces ne fonctionne pas. Quelqu'un a t-il une idée du problème ? D'avance merci Bonjour, J'ai trouvé l'explication, la variable $last_qties n'est pas appelée depuis la page product-list.tpl. Une idée pour l'appeler depuis cette page ? Merci Link to comment Share on other sites More sharing options...
loulou66 Posted April 26, 2014 Share Posted April 26, 2014 Coucou dans le controllersProduct.php $last_qties est assigné dans un array() je te le met en simple ici $this->context->smarty->assign('last_qties' , (int)Configuration::get('PS_LAST_QTIES'); pour l'avoir dans la product_list il faut faire un override de la fonction initContent du CategoryController.php @++ Loulou66 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