Remaining amount to be added to your cart in order to obtain free shipping - Ecommerce x PrestaShop [ARCHIVE BOARD] - PrestaShop

Jump to content

Photo

Remaining amount to be added to your cart in order to obtain free shipping

#1

Posted 19 December 2012 - 06:58 PM

antonio.soleres

    PrestaShop Apprentice

  • Members
  • PipPip
  • 44 Active Posts
In Prestashop 1.5.2, is there any way that in the shopping cart appears the following information: “Remaining amount to be added to your cart in order to obtain free shipping”, as appeared in version 1.4.8.2?
Thanks.

#2

Posted 21 January 2013 - 07:46 AM

jd440

    PrestaShop Addict

  • Members
  • PipPipPip
  • 621 Active Posts
I'm looking for the same answer.
Did you find the solution?

serveur de dev ps: 1.6.1.4 | PHP: 7.0.3-10+deb.sury.org~trusty+1 | mysql :  10.1.12-MariaDB-1~trusty 

serveur de prod ps: .6.1.4 | PHP: 7.0.5 | mysql : 5.6.3

 

#3

Posted 21 January 2013 - 09:04 AM

antonio.soleres

    PrestaShop Apprentice

  • Members
  • PipPip
  • 44 Active Posts
No. No answers and I have not find the solution.

#4

Posted 21 January 2013 - 10:47 AM

jd440

    PrestaShop Addict

  • Members
  • PipPipPip
  • 621 Active Posts
Thanks for your answer.
So There is 2way.
  • Find a module which offer this function
  • Developa module which offer this function
But I'm surprise a so useful function, disapear ?!

serveur de dev ps: 1.6.1.4 | PHP: 7.0.3-10+deb.sury.org~trusty+1 | mysql :  10.1.12-MariaDB-1~trusty 

serveur de prod ps: .6.1.4 | PHP: 7.0.5 | mysql : 5.6.3

 

#5

Posted 06 June 2013 - 04:11 PM

Ranno Presta

    PrestaShop Newbie

  • Members
  • Pip
  • 22 Active Posts
i have the same problem ,can any one help me !

#6

Posted 31 January 2014 - 05:58 PM

ilovekutchi.com

    PrestaShop Enthusiast

  • Members
  • PipPip
  • 120 Active Posts

This post might help: http://www.prestasho...fic-categories/


www.ilovekutchi.com

#7

Posted 17 February 2014 - 09:35 AM

Alex Simonchik BelVG

    Ambassador, Belarus

  • Ambassadors
  • 813 Active Posts

Hi,

 

I hope this will help: http://blog.belvg.co...e-shipping.html

 

Regards


Image IPB
Prestashop developer. Working in BelVG - E-Commerce development and Prestashop modules.

#8

Posted 30 May 2014 - 02:14 PM

mefistor

    PrestaShop Apprentice

  • Members
  • PipPip
  • 56 Active Posts

Thanks Alex but i don't find where to put the code i don't see the function :( ps 1.5.5.0

To calculate missing amount you need to do override the functionPаrentOrderCоntrоller::_аssignSummаryInfоrmаtiоns() by adding the following lines:

 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
...
if ($free_ship = Tools::convertPrice((float)(Configuration::get('PS_SHIPPING_FREE_PRICE')), new Currency((int)($this->context->cart->id_currency))))
{
    $discounts = $this->context->cart->getCartRules();
    $total_free_ship =  $free_ship - ($summary['total_products_wt'] + $summary['total_discounts']);
    foreach ($discounts as $discount)
        If ( $discount[ 'id_disсоunt_type') == 3)
        {
            $total_free_ship = 0;
            break;
        }
   $summary['free_ship'] = $total_free_ship;
}
...

In the code above, we have identified the variable free_ship, which we will use in the templateshopping-cart.tpl .  The code below we have added at the end of the block <tfооt>

 
1
2
3
4
5
6
...
<tr class="remaining_cart_free_shipping" {if $free_ship <= 0 || $isVirtualCart} style="display: none;" {/if}>
    <td colspan="6" style="white-space: normal;">{l s='Remaining amount to be added to your cart in order to obtain free shipping:'}</td>
    <td id="free_shipping" class="price">{displayPrice price=$free_ship}</td>
</tr>
...

Here is the result:

 

21.png

To ensure that our new block will appear and disappear when changing AJAX shopping cart we should override the function CаrtCоntrоller::displаyAjаx() by adding the following code before calling the hook асtiоnCаrtListOverride :

 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
if ($free_ship = Tools::convertPrice((float)(Configuration::get('PS_SHIPPING_FREE_PRICE')), new Currency((int)($this->context->cart->id_currency))))
{
    $discounts = $this->context->cart->getCartRules();
    $total_free_ship =  $free_ship - ($result['summary']['total_products_wt'] + $result['summary']['total_discounts']);
    foreach ($discounts as $discount)
        If ( $discount[ 'id_disсоunt_type') == 3)
        {
            $total_free_ship = 0;
            break;
        }
 
    $result['summary']['free_ship'] = $total_free_ship;
}
...

This code will allow using data about the short fall of the amount required for free delivery in the theme file cart-summary.js. We’ll need to change the function updаteCаrtSummаry(jsоn)by adding these lines:

 
1
2
3
4
5
if (json.free_ship >= 0) {
    $(".remaining_cart_free_shipping").show();
} else {
    $(".remaining_cart_free_shipping").hide();
}

Thanks for your help



#9

Posted 30 May 2014 - 04:22 PM

mefistor

    PrestaShop Apprentice

  • Members
  • PipPip
  • 56 Active Posts

sry i found it just a strange problem form copying and pasting on notepad++, but when I type it it found :S




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cookies help us deliver our services. By using our services, you agree to use our cookies.     Learn more