amedeolandi Posted January 10, 2018 Share Posted January 10, 2018 Hello, i would like to show in my cart the availability date of the product if they are not in stock but they will be soon. How i can do? Link to comment Share on other sites More sharing options...
hakeryk2 Posted January 30, 2018 Share Posted January 30, 2018 (edited) If there is available_date set for product You can edit shopping-cart-product-line.tpl file from Your default bootstrap folder and add AFTER something like this <p class="product-name"><a href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category, null, null, $product.id_shop, $product.id_product_attribute, false, false, true)|escape:'html':'UTF-8'}">{$product.name|escape:'html':'UTF-8'}</a></p> this code: {assign "product_available_date" Product::getAvailableDate($product.id_product, $product.id_product_attribute)} {if $product_available_date && $smarty.now < $product_available_date|strtotime && $product.quantity_available <= 0}<small>{l s='Available date:'} {$product_available_date}</small>{/if} Save, upload, clear the cache. This is in my opinion the best way to display available date for product or product attribute/combination in shopping cart summary. It has to be that to way to do not override classes because in this tpl file $product variable does not contains date_available field. This code also does not show available date if date is in the past and if there is some products on Your stock (why You should discourage customers from buying something that You have on Your own stock). Hope that will help. THIS Solution was tested on prestashop 1.6.1.4 and 1.6.1.17 and it is working. Didn't tested on 1.7. I saw a lot of request like this on forum so I will jump to different topics and link to this post. Edited January 30, 2018 by hakeryk2 (see edit history) 2 Link to comment Share on other sites More sharing options...
hardstonepaul Posted October 19, 2018 Share Posted October 19, 2018 On 1/30/2018 at 8:37 AM, hakeryk2 said: If there is available_date set for product You can edit shopping-cart-product-line.tpl file from Your default bootstrap folder and add AFTER something like this <p class="product-name"><a href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category, null, null, $product.id_shop, $product.id_product_attribute, false, false, true)|escape:'html':'UTF-8'}">{$product.name|escape:'html':'UTF-8'}</a></p> this code: {assign "product_available_date" Product::getAvailableDate($product.id_product, $product.id_product_attribute)} {if $product_available_date && $smarty.now < $product_available_date|strtotime && $product.quantity_available <= 0}<small>{l s='Available date:'} {$product_available_date}</small>{/if} Save, upload, clear the cache. This is in my opinion the best way to display available date for product or product attribute/combination in shopping cart summary. It has to be that to way to do not override classes because in this tpl file $product variable does not contains date_available field. This code also does not show available date if date is in the past and if there is some products on Your stock (why You should discourage customers from buying something that You have on Your own stock). Hope that will help. THIS Solution was tested on prestashop 1.6.1.4 and 1.6.1.17 and it is working. Didn't tested on 1.7. I saw a lot of request like this on forum so I will jump to different topics and link to this post. Work for me in product page when the product have "availability date" and quantity in zero. 1 Link to comment Share on other sites More sharing options...
YllarL Posted March 9, 2019 Share Posted March 9, 2019 (edited) Where is located this file shopping-cart-product-line.tpl? PRESTASHOP 1.7.5 I find this one in themes/classic/modules, where I must copy this code? My file looks this way inside: {** * 2007-2018 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License 3.0 (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: * https://opensource.org/licenses/AFL-3.0 * 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-2018 PrestaShop SA * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) * International Registered Trademark & Property of PrestaShop SA *} <span class="product-quantity">{$product.quantity}</span> <span class="product-name">{$product.name}</span> <span class="product-price">{$product.price}</span> <a class="remove-from-cart" rel="nofollow" href="{$product.remove_from_cart_url}" data-link-action="remove-from-cart" title="{l s='remove from cart' d='Shop.Theme.Actions'}" > {l s='Remove' d='Shop.Theme.Actions'} </a> {if $product.customizations|count} <div class="customizations"> <ul> {foreach from=$product.customizations item='customization'} <li> <span class="product-quantity">{$customization.quantity}</span> <a href="{$customization.remove_from_cart_url}" title="{l s='remove from cart' d='Shop.Theme.Actions'}" class="remove-from-cart" rel="nofollow">{l s='Remove' d='Shop.Theme.Actions'}</a> <ul> {foreach from=$customization.fields item='field'} <li> <span>{$field.label}</span> {if $field.type == 'text'} <span>{$field.text nofilter}</span> {else if $field.type == 'image'} <img src="{$field.image.small.url}"> {/if} </li> {/foreach} </ul> </li> {/foreach} </ul> </div> {/if} Edited March 9, 2019 by YllarL (see edit history) Link to comment Share on other sites More sharing options...
hakeryk2 Posted August 27, 2019 Share Posted August 27, 2019 I am not working on 1.7.x so I can't help You. Link to comment Share on other sites More sharing options...
csid Posted October 16, 2020 Share Posted October 16, 2020 On 1/30/2018 at 2:37 PM, hakeryk2 said: If there is available_date set for product You can edit shopping-cart-product-line.tpl file from Your default bootstrap folder and add AFTER something like this <p class="product-name"><a href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category, null, null, $product.id_shop, $product.id_product_attribute, false, false, true)|escape:'html':'UTF-8'}">{$product.name|escape:'html':'UTF-8'}</a></p> this code: {assign "product_available_date" Product::getAvailableDate($product.id_product, $product.id_product_attribute)} {if $product_available_date && $smarty.now < $product_available_date|strtotime && $product.quantity_available <= 0}<small>{l s='Available date:'} {$product_available_date}</small>{/if} Save, upload, clear the cache. This is in my opinion the best way to display available date for product or product attribute/combination in shopping cart summary. It has to be that to way to do not override classes because in this tpl file $product variable does not contains date_available field. This code also does not show available date if date is in the past and if there is some products on Your stock (why You should discourage customers from buying something that You have on Your own stock). Hope that will help. THIS Solution was tested on prestashop 1.6.1.4 and 1.6.1.17 and it is working. Didn't tested on 1.7. I saw a lot of request like this on forum so I will jump to different topics and link to this post. Fonctionne parfaitement en prestashop 1.7.4.2 et suivants je présume ! Grand merci ! Pour ceux qui posent la question la modification pour mettre la date dans le panier c'est dans le template /checkout/partials/cart-detailed-product-line.tpl Encore merci! Link to comment Share on other sites More sharing options...
Lionel_JDN Posted May 3, 2023 Share Posted May 3, 2023 Dear hakeryk2, Thank you very much for your tips! But not working on my 1.6.0.10 version. Thank you. Have a nice day! Lionel 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