Jump to content

Need more help for NemoPS Tutorial - spend X to get Free Shipping


Recommended Posts

PrestaShop  1.6.1.7

 

Refer to Tutorial on "spend X to get Free Shipping"


 

I edited shopping-cart.tpl and I show free shipping in my test cart after I "spend" the amount I set for free shipping.

 

I want the customer to see how much more they have to spend to get free shipping. Right now, it removes the shipping after my set amount, but doesn't alert the customer how much to spend to get the free shipping.

 

I'm stuck in the tutorial from "Then, we need to check if it is actually holding a value" and on.

 

It's in NemoPS's code. Do I create a new file for the rest of the code? What do I name it?

 

Link to comment
Share on other sites

Do you mean the code of my shopping-cart.tpl ?

 

I attached screenshots of before and after carts with and without free shipping. Also where I entered my free shipping minimum price.

 

I don't know where to show the customer that if he or she spends a certain amount, they get free shipping.

 

This is the only code I've added so far:

 

{/if}
{assign var='freeshipping_price' value=Configuration::get('PS_SHIPPING_FREE_PRICE')}
    <div id="HOOK_SHOPPING_CART">{$HOOK_SHOPPING_CART}</div>
 
I don't know where to add the rest of the code for the message to the customer. Am I supposed to create a new override file?
 
Thank you!

post-1292894-0-06950200-1477306380_thumb.jpg

post-1292894-0-37241700-1477306604_thumb.jpg

post-1292894-0-81551000-1477306692_thumb.jpg

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

What I'm trying to explain  is I don't know where the rest of this goes. Do I create a new file? Thanks!

 

Then, we need to check if it is actually holding a value4

{assign var='freeshipping_price' value=Configuration::get('PS_SHIPPING_FREE_PRICE')}
{if $freeshipping_price}
    {assign var='freeshipping_price_converted' value={toolsConvertPrice price=$freeshipping_price[spam-filter]
{/if}

Explanation: if the value exists, we need to convert it to the current currency (which might be other than the default). Therefore, we use the very handy toolsConvertPrice method to make sure the value is correctly set to the actual customer currency.

What’s next? We need to compare the total cart value without shipping to the free shipping one, and display a message in case it’s positive:

{assign var='freeshipping_price' value=Configuration::get('PS_SHIPPING_FREE_PRICE')}
 
{if $freeshipping_price}
    {assign var='freeshipping_price_converted' value={toolsConvertPrice price=$freeshipping_price[spam-filter]
 
 
    {math equation='a-b' a=$total_price b=$total_shipping assign='total_without_shipping'}
    {math equation='a-b' a=$freeshipping_price_converted b=$total_without_shipping assign='remaining_to_spend'}
 
    {if $remaining_to_spend > 0}
        <p>{l s='Your total (without shipping) is'} {convertPrice price=$total_without_shipping}</p>
        <p><strong>{l s='You will be eligible for free shipping if you spend another'} {convertPrice price=$remaining_to_spend}</strong></p>
    {/if}
 
 
{/if}
Edited by pause4paws (see edit history)
Link to comment
Share on other sites

It works great, NemoPS! Thank you!  (after cleared cache, forced compile, etc).

Looks like this:

Your total (without shipping) is $22.15

You will be eligible for free shipping if you spend another $11.81

 

I have a couple of questions, please.

 

can some code be put in the section where they just added a product to the cart?

 

and

 

can the code be put right under  the SHOPPING-CART SUMMARY because it isn't noticeable on my site unless they scroll to the bottom if they aren't finished shopping?

 

Thank you!

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

I almost have success.  I put all the code just under the first line in shopping.tpl which is:

 

{capture name=path}{l s='Your shopping cart'}{/capture}

 

Then I forced compilation & cleared cache.

 

I proceed to check out and I have the text I want, exactly where I want it. Image is free-ship-step-1.jpg

 

Next when I add an item to the cart to reach the free shipping amount, it correctly, shows "free shipping". Perfect! Image is free-ship-step-2.jpg

 

Next is trouble! Shipping shows as $33.96 for products total of $41.90. Image is free-ship-step-3.jpg

 

What do you suggest, please?

 

Thank you!

post-1292894-0-91945300-1477935555_thumb.jpg

post-1292894-0-67148500-1477935566_thumb.jpg

post-1292894-0-47947300-1477935572_thumb.jpg

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

I only have UPS ground and USPS priority mail set according to weight and to North America only.

 

As a test, I just disabled USPS (because I added that myself from a tutorial, so presumably it's a non-module-based carrier) and I cleared the cache.

 

I then proceeded to add an item to the cart, got the message to spend "X" for free shipping and increased that item to two. It still displays Total Shipping: $33.96. At checkout, UPS ground shows "free shipping".

 

Here is the code I added in case I did something wrong:

 

{assign var='freeshipping_price' value=Configuration::get('PS_SHIPPING_FREE_PRICE')}
{assign var='freeshipping_price' value=Configuration::get('PS_SHIPPING_FREE_PRICE')}
{if $freeshipping_price}
    {assign var='freeshipping_price_converted' value={toolsConvertPrice price=$freeshipping_price[spam-filter] 
{/if}
 
{assign var='freeshipping_price' value=Configuration::get('PS_SHIPPING_FREE_PRICE')}
 
{if $freeshipping_price}
    {assign var='freeshipping_price_converted' value={toolsConvertPrice price=$freeshipping_price[spam-filter]
 
 
    {math equation='a-b' a=$total_price b=$total_shipping assign='total_without_shipping'}
    {math equation='a-b' a=$freeshipping_price_converted b=$total_without_shipping assign='remaining_to_spend'}
 
    {if $remaining_to_spend > 0}
        <p>{l s='Your total (without shipping) is'} {convertPrice price=$total_without_shipping}</p>
        <p><strong>{l s='You will be eligible for free shipping if you spend another'} {convertPrice price=$remaining_to_spend}</strong></p>
    {/if}
 
 
{/if}
    <div id="HOOK_SHOPPING_CART">{$HOOK_SHOPPING_CART}</div>
 
Thank you!
 

post-1292894-0-05650200-1478264631_thumb.jpg

post-1292894-0-75303800-1478264637_thumb.jpg

Link to comment
Share on other sites

I still have the same problem. It shows $39.00 shipping in the cart but if you scroll down, the carriers show free shipping.

 

I disabled Javascript: "Javascript Disabled Detected

You currently have javascript disabled. Several functions may not work. Please re-enable javascript to access full functionality."

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

I'm going to put the code here because it seems to have been updated again, probably by TemplateMonster, since I haven't done anything else to add your code.

 

This is at the top now and that is not where I added it:

 

{capture name=path}{l s='Your shopping cart'}{/capture}
 
{assign var='freeshipping_price' value=Configuration::get('PS_SHIPPING_FREE_PRICE')}
{assign var='freeshipping_price' value=Configuration::get('PS_SHIPPING_FREE_PRICE')}
{if $freeshipping_price}
    {assign var='freeshipping_price_converted' value={toolsConvertPrice price=$freeshipping_price[spam-filter] 
{/if}
 
{assign var='freeshipping_price' value=Configuration::get('PS_SHIPPING_FREE_PRICE')}
 
{if $freeshipping_price}
    {assign var='freeshipping_price_converted' value={toolsConvertPrice price=$freeshipping_price[spam-filter]
 
 
    {math equation='a-b' a=$total_price b=$total_shipping assign='total_without_shipping'}
    {math equation='a-b' a=$freeshipping_price_converted b=$total_without_shipping assign='remaining_to_spend'}
 
    {if $remaining_to_spend > 0}
        <p>{l s='Your total (without shipping) is'} {convertPrice price=$total_without_shipping}</p>
        <p><strong>{l s='You will be eligible for free shipping if you spend another'} {convertPrice price=$remaining_to_spend}</strong></p>
    {/if}
 
 
{/if}
 
and this begins on line 555 and goes to the end of the template:
 
 
    <div id="HOOK_SHOPPING_CART">{$HOOK_SHOPPING_CART}</div>
 
    <p class="cart_navigation clearfix">
{if !$opc}
<a
href="{if $back}{$link->getPageLink('order', true, NULL, 'step=1&back={$back}')|escape:'html':'UTF-8'}{else}{$link->getPageLink('order', true, NULL, 'step=1')|escape:'html':'UTF-8'}{/if}"
class="button btn btn-default standard-checkout button-medium"
title="{l s='Proceed to checkout'}">
<span>
                {l s='Proceed to checkout'}
                    <i class="icon-chevron-right right"></i>
                </span>
</a>
{/if}
<a
href="{if (isset($smarty.server.HTTP_REFERER) && strstr($smarty.server.HTTP_REFERER, 'order.php')) || isset($smarty.server.HTTP_REFERER) && strstr($smarty.server.HTTP_REFERER, 'order-opc') || !isset($smarty.server.HTTP_REFERER)}{$link->getPageLink('index')}{else}{$smarty.server.HTTP_REFERER|escape:'html':'UTF-8'|secureReferrer}{/if}"
class="button-exclusive btn btn-default"
title="{l s='Continue shopping'}">
<i class="icon-chevron-left"></i>
            {l s='Continue shopping'}
</a>
</p>
{if !empty($HOOK_SHOPPING_CART_EXTRA)}
<div class="clear"></div>
<div class="cart_navigation_extra">
<div id="HOOK_SHOPPING_CART_EXTRA">{$HOOK_SHOPPING_CART_EXTRA}</div>
</div>
{/if}
    
    {strip}
   {addJsDef currencySign=$currencySign|html_entity_decode:2:"UTF-8"}
    {addJsDef currencyRate=$currencyRate|floatval}
    {addJsDef currencyFormat=$currencyFormat|intval}
    {addJsDef currencyBlank=$currencyBlank|intval}
    {addJsDef deliveryAddress=$cart->id_address_delivery|intval}
    {addJsDefL name=txtProduct}{l s='product' js=1}{/addJsDefL}
    {addJsDefL name=txtProducts}{l s='products' js=1}{/addJsDefL}
    {/strip}
{/if}
 
Edited by pause4paws (see edit history)
Link to comment
Share on other sites

Per Daresh, the creator of that module: "This module just informs the user, it does not affect shipping costs. If you have a problem with setting up your shipping configuration, create a separate topic for it."

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

you should contact original poster of hack.

 

At the end of the day, it may be better to spend a little money and not spend so much time re-inventing the wheel.

http://addons.prestashop.com/en/20769-amount-left-for-free-delivery-free-shipping-count.html

The problem is not with free shipping working. Free shipping when spending "X" works fine from NemoPS's tutorial. It also correctly says free shipping in the cart before checkout and when checking out, it shows free shipping in the carrier sections.

 

The problem is that the cart shows a total shipping of $39.00 which is my free shipping setting.

 

post-1292894-0-32615400-1479048749_thumb.jpg

 

post-1292894-0-63676700-1479048763_thumb.jpg

 

post-1292894-0-66904800-1479048777_thumb.jpg

Edited by pause4paws (see edit history)
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...