alexislevrai Posted April 18, 2011 Share Posted April 18, 2011 I am trying to indicate the amount needed for free shipping in the blockcart.I have been successful to the point of having it work on the cart summary page (which is redundant) but shows $0.00 on other pages.I tried to add: {if $free_ship > 0} {l s='Remaining amount to be added to your cart in order to obtain free shipping:'} {convertPrice price=$free_ship} {/if} I found a post for an old version of prestashop, but that don't work for the 1.4 Thanks for any help. Link to comment Share on other sites More sharing options...
alexislevrai Posted April 27, 2011 Author Share Posted April 27, 2011 No one ? please help ! Link to comment Share on other sites More sharing options...
ChrisLNZ Posted April 28, 2011 Share Posted April 28, 2011 Just checking - you have set free shipping starts to 0 in BO? Link to comment Share on other sites More sharing options...
alexislevrai Posted April 28, 2011 Author Share Posted April 28, 2011 No, the free shipping start to 150€ but that not the porblem ... 0 or 150€ he need to display "Remaining amount to be added to your cart in order to obtain free shipping:" No ?You don't have any idea ? Link to comment Share on other sites More sharing options...
subey Posted June 28, 2012 Share Posted June 28, 2012 (edited) file: modules/blockcart/blockcart.php info: addin function smartyAssigns() this code: $total_free_ship = 0; if ($free_ship = Tools::convertPrice((float)(Configuration::get('PS_SHIPPING_FREE_PRICE')), new Currency((int)($params['cart']->id_currency)))) { $discounts = $params['cart']->getDiscounts(); $total_free_ship = $free_ship - ($params['cart']->getOrderTotal(true, Cart::ONLY_PRODUCTS) + $params['cart']->getOrderTotal(true, Cart::ONLY_DISCOUNTS)); foreach ($discounts as $discount) if ($discount['id_discount_type'] == 3) { $total_free_ship = 0; break; } } $smarty->assign(array( 'free_ship' =>Tools::displayPrice($total_free_ship, $currency), ..... rest code... -------------------------- file: themes/YOUR_THEME/modules/blockcart/blockcart.tpl info: add before line <p id="cart-buttons" class="clearfix"> this code: {if $free_ship > 0} <p id="cart_block_free_ship"> {l s='Dla darmowej wysyłki dodaj produkty na kwotę:' mod='blockcart'} <span class="price ajax_block_cart_free_ship">{$free_ship}</span> <br/> </p> {/if} -------------------------- file: modules/blockcart/blockcart-json.tpl info: add before line "shippingCost": this code: "free_ship": "{$free_ship|html_entity_decode:2:'UTF-8'}", -------------------------- file: modules/blockcart/ajax-cart.js info: add after line $('.ajax_block_cart_total').text(jsonData.total); this code: $('.ajax_block_cart_free_ship').text(jsonData.free_ship); if(parseInt(jsonData.free_ship) > 0) { $('#cart_block_free_ship').fadeIn('slow'); }else{ $('#cart_block_free_ship').hide(); } Edited June 28, 2012 by subey (see edit history) 1 Link to comment Share on other sites More sharing options...
lain Posted September 1, 2012 Share Posted September 1, 2012 (edited) THANKS for the code subey, so useful it worked for me on PS 1.4.5.1 just 2 advices: the code: $total_free_ship = 0; if ($free_ship = Tools::convertPrice((float)(Configuration::get('PS_SHIPPING_FREE_PRICE')), new Currency((int)($params['cart']->id_currency)))) { $discounts = $params['cart']->getDiscounts(); $total_free_ship = $free_ship - ($params['cart']->getOrderTotal(true, Cart::ONLY_PRODUCTS) + $params['cart']->getOrderTotal(true, Cart::ONLY_DISCOUNTS)); foreach ($discounts as $discount) if ($discount['id_discount_type'] == 3) { $total_free_ship = 0; break; } } $smarty->assign(array( 'free_ship' =>Tools::displayPrice($total_free_ship, $currency), ..... rest code... must be placed correctly to get it working, put this: $total_free_ship = 0; if ($free_ship = Tools::convertPrice((float)(Configuration::get('PS_SHIPPING_FREE_PRICE')), new Currency((int)($params['cart']->id_currency)))) { $discounts = $params['cart']->getDiscounts(); $total_free_ship = $free_ship - ($params['cart']->getOrderTotal(true, Cart::ONLY_PRODUCTS) + $params['cart']->getOrderTotal(true, Cart::ONLY_DISCOUNTS)); foreach ($discounts as $discount) if ($discount['id_discount_type'] == 3) { $total_free_ship = 0; break; } } just after: public function smartyAssigns(&$smarty, &$params) { global $errors, $cookie; (line 46~) and put this: 'free_ship' =>Tools::displayPrice($total_free_ship, $currency), just after: $smarty->assign(array( (line 98~ after pasting previous code) 2nd advice: to view correct translation just change {l s='Dla darmowej wysyłki dodaj produkty na kwotę:' mod='blockcart'} to {l s='Remaining amount to be added to your cart in order to obtain free shipping:' mod='blockcart'} and change file _your_language.php (fr.php, es.php, de.php...) from modules/blockcart adding: $_MODULE['<{blockcart}prestashop>blockcart_67db993438213ca5b77a394bce7d7b41'] = 'your own traduction'; Edited September 1, 2012 by lain (see edit history) 1 Link to comment Share on other sites More sharing options...
PEPPE83 Posted November 2, 2012 Share Posted November 2, 2012 (edited) Hi, i tried this mod and everything works except that the carriage does not automatically update the value remaining for free shipping, but only when i run the page refresh. Any suggestions? EDIT: I needed to empty smarty cache now work! Edited November 2, 2012 by PEPPE83 (see edit history) Link to comment Share on other sites More sharing options...
Podpora Posted May 4, 2015 Share Posted May 4, 2015 Does it work on 1.6.0.14? ty Link to comment Share on other sites More sharing options...
Recommended Posts