Jump to content

How to Availability date in cart prestashop


amedeolandi

Recommended Posts

  • 3 weeks later...

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.

available_date_in_shopping_cart.thumb.png.4182e867b8bee81ac29f7ce87ff5f51e.png

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 by hakeryk2 (see edit history)
  • Thanks 2
Link to comment
Share on other sites

  • 8 months later...
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.

available_date_in_shopping_cart.thumb.png.4182e867b8bee81ac29f7ce87ff5f51e.png

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.

  • Like 1
Link to comment
Share on other sites

  • 4 months later...

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 by YllarL (see edit history)
Link to comment
Share on other sites

  • 5 months later...
  • 1 year later...
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.

available_date_in_shopping_cart.thumb.png.4182e867b8bee81ac29f7ce87ff5f51e.png

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

  • 2 years later...

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