pause4paws Posted October 23, 2016 Share Posted October 23, 2016 PrestaShop 1.6.1.7 Refer to Tutorial on "spend X to get Free Shipping" http://nemops.com/prestashop-show-free-shipping/#.WA0EfZMrLF5 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 More sharing options...
NemoPS Posted October 24, 2016 Share Posted October 24, 2016 Hi there,What issue do you have exactly? Can you try printing out {$freeshipping_price} ? Link to comment Share on other sites More sharing options...
pause4paws Posted October 24, 2016 Author Share Posted October 24, 2016 (edited) 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! Edited October 24, 2016 by pause4paws (see edit history) Link to comment Share on other sites More sharing options...
pause4paws Posted October 25, 2016 Author Share Posted October 25, 2016 (edited) 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 October 25, 2016 by pause4paws (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted October 28, 2016 Share Posted October 28, 2016 No, just add it after that one you had put in already 1 Link to comment Share on other sites More sharing options...
pause4paws Posted October 29, 2016 Author Share Posted October 29, 2016 (edited) 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 October 29, 2016 by pause4paws (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted October 31, 2016 Share Posted October 31, 2016 Of course, just move everything above, all variables are assigned to the tpl already 1 Link to comment Share on other sites More sharing options...
pause4paws Posted October 31, 2016 Author Share Posted October 31, 2016 (edited) 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! Edited November 1, 2016 by pause4paws (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted November 2, 2016 Share Posted November 2, 2016 That is odd, it's not related to the module since it's just prestashop.Are you getting free shipping correctly if you continue with the checkout? Link to comment Share on other sites More sharing options...
pause4paws Posted November 2, 2016 Author Share Posted November 2, 2016 Yes, the cart shows total shipping of $33.96 but UPS & USPS show free shipping. I just realized something. That shipping amount is what I set for them to buy to get free shipping. Link to comment Share on other sites More sharing options...
NemoPS Posted November 4, 2016 Share Posted November 4, 2016 That's odd, I wonder if it's just because they get the price from an api, did you try with a normal, non-module-based carrier? Link to comment Share on other sites More sharing options...
pause4paws Posted November 4, 2016 Author Share Posted November 4, 2016 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! Link to comment Share on other sites More sharing options...
NemoPS Posted November 9, 2016 Share Posted November 9, 2016 That's odd, it also looks like the row is not properly formatted, since it has a wrong colspan. Can you disable javascript in your browser and see if it's still there? Some module might be adding it Link to comment Share on other sites More sharing options...
pause4paws Posted November 9, 2016 Author Share Posted November 9, 2016 (edited) 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 November 9, 2016 by pause4paws (see edit history) Link to comment Share on other sites More sharing options...
pause4paws Posted November 9, 2016 Author Share Posted November 9, 2016 (edited) 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 November 9, 2016 by pause4paws (see edit history) Link to comment Share on other sites More sharing options...
El Patron Posted November 9, 2016 Share Posted November 9, 2016 have you all tried this free module? https://www.prestashop.com/forums/topic/494147-free-module-spend-x-to-get-free-shipping/ 1 Link to comment Share on other sites More sharing options...
pause4paws Posted November 13, 2016 Author Share Posted November 13, 2016 (edited) have you all tried this free module? https://www.prestashop.com/forums/topic/494147-free-module-spend-x-to-get-free-shipping/ 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 November 13, 2016 by pause4paws (see edit history) Link to comment Share on other sites More sharing options...
pause4paws Posted November 13, 2016 Author Share Posted November 13, 2016 (edited) deleted. Not related to this post. Edited November 13, 2016 by pause4paws (see edit history) Link to comment Share on other sites More sharing options...
El Patron Posted November 13, 2016 Share Posted November 13, 2016 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 Link to comment Share on other sites More sharing options...
pause4paws Posted November 13, 2016 Author Share Posted November 13, 2016 (edited) 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. Edited November 13, 2016 by pause4paws (see edit history) Link to comment Share on other sites More sharing options...
El Patron Posted November 13, 2016 Share Posted November 13, 2016 yes, so close but so far away. Link to comment Share on other sites More sharing options...
pause4paws Posted November 13, 2016 Author Share Posted November 13, 2016 True, , but I think it's a template-related problem, not a module problem. Wow! A month ago I wouldn't have even known what that meant or how to say it! lol 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