Forums / Built-in Shipping and Payment Modules / Combining free and non free shipping

Combining free and non free shipping

Views: 3,975

Results 1 to 14 of 14
22 Apr 2007, 3:47 PM
#1
dmuk avatar

dmuk

New Zenner

Join Date:
Nov 2006
Posts:
46
Plugin Contributions:
0

Combining free and non free shipping

Free shipping is incorporated into the price of all the products (call them product A's) non our site. I have setup Free Shipping freeshipper to accomplish this and it works fine.

We want to add a load of other products (B's) which if bought on their own without any of the original free shipping products (A'), will incur a shipping cost. But if one of each products is purchased (A + B), shipping is free.

I did a search on the forums and came up with a thread where one person had the opposite problem, so I tried to follow the thread back from the end to the beginning to recreate this behavior but it has not worked out.

Adding flatrate shipping for product B's works as a standalone cart item but doesn't disappear when a product A is added. I think that perhaps freeoptions might be the way forward but I do not want it to work as intended, i.e. giving people an option for a slower but free option. It would be much better if I could get it to work without giving an option.

Does anyone have any thoughts or prior experiences to share?

Many thanks,

Dmuk

22 Apr 2007, 3:51 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Combining free and non free shipping

Currently, there isn't a setting for this ...

You could do some custom code and check if any products are marked as:
product_is_always_free_shipping

If so, and there is at least 1 product marked as product_is_always_free_shipping = 1 ... then have the custom code alter the settings on which shipping modules display and only show a Free Shipping module ...

NOTE: You may need to make a separate free shipping module to accomplish this ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

23 Apr 2007, 9:36 AM
#3
dmuk avatar

dmuk

New Zenner

Join Date:
Nov 2006
Posts:
46
Plugin Contributions:
0

Re: Combining free and non free shipping

Thanks Linda.

Time to perhaps dust off the old php skills! :)

Is there a specific file or file(s) I should head to which might speed up my progress? A relative Zen newbie so it may take me as much time as creating the code! :p

23 Apr 2007, 4:45 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Combining free and non free shipping

Look in the shopping_cart.php class and find the function in_cart_check ...

Learn how you can use this to determin if a product is in the shopping_cart based on a certain condition ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

12 Jun 2007, 3:56 PM
#5
rcrosier avatar

rcrosier

Zen Follower

Join Date:
Dec 2006
Location:
Vermont
Posts:
128
Plugin Contributions:
0

Re: Combining free and non free shipping

I have made some modifications to my system to allow a second "wholesale" price for customers who have been approved as "retail" and items which have a wholesale price.

I need to look at the customer record during checkout/shipping calculations in order to determine if free shipping should be DISabled.

I cannot figure out why, but I can't access the TABLE_CUSTOMER, because there appears to be no "$_SESSION('customer_id') during the FREEOPTIONS.PHP processing.

It errors out with a "PHP Fatal error: Call to a member function Execute() on a non-object in ...modules\shipping\freeoptions.php on line 80"

Can somebody tell me how to get the customer info, using customer_id, in the freeoptions module?

The code I'm TRYING to use unsuccessfully is here

// RCC 6/10/2007 Add wholesale pricing - SKIP FREE SHIPPING FOR WHOLESALE CUSTOMERS
// NOTE: removed next line for testing, to find why erroring out...
//    if (isset($_SESSION['customer_id']) and $_SESSION['customer_id'] != '') {
      $customer_is_wholesale = $db->Execute("select customers_whole from " . TABLE_CUSTOMERS . " where customers_id = '" . $_SESSION['customer_id'] . "'");
      if ($customer_is_wholesale->RecordCount() > 0) {
          if ($customer_is_wholesale->fields['customers_whole'] == '1') {
           $this->enabled = false;
           $this->ck_freeoptions_total = false;
           $this->ck_freeoptions_weight = false;
           $this->ck_freeoptions_items = false;
        }
      }
//    }
// EOM RCC
```Thanks!

VTstuff.com, Quality gifts and products from Vermont.

14 Feb 2010, 10:52 PM
#6
ianhg avatar

ianhg

Zen Follower

Join Date:
Jul 2007
Posts:
345
Plugin Contributions:
3

Re: Combining free and non free shipping

Ajeh:

Currently, there isn't a setting for this ...

You could do some custom code and check if any products are marked as:
product_is_always_free_shipping

If so, and there is at least 1 product marked as product_is_always_free_shipping = 1 ... then have the custom code alter the settings on which shipping modules display and only show a Free Shipping module ...

NOTE: You may need to make a separate free shipping module to accomplish this ...

Has anybody done this?

29 Apr 2010, 2:26 AM
#7
donnyb avatar

donnyb

New Zenner

Join Date:
Apr 2010
Posts:
32
Plugin Contributions:
0

Re: Combining free and non free shipping

ianhg:

Has anybody done this?

I'd like to know also. My cart is 1.3.8.a and I would like to not charge people shipping if they have bought an item that is "free shipping"

29 Apr 2010, 3:36 PM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Combining free and non free shipping

You can test for that with:
$_SESSION['cart']->in_cart_check('product_is_always_free_shipping','1')

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

12 Sep 2011, 3:06 PM
#9
enzo_ita avatar

enzo_ita

Zen Follower

Join Date:
Jul 2009
Posts:
402
Plugin Contributions:
0

Re: Combining free and non free shipping

Ajeh:

You can test for that with:
$_SESSION['cart']->in_cart_check('product_is_always_free_shipping','1')
Hi Linda,
I am very interested in thsi mod.
Can you please expalin in details where I should add the code you wrote in order to not charge shipping if in the cart there are
one product free shipping
one product non free shipping
The total of the two products is below the minimum order value set to have the free shipping.
Thanks
enzo

18 Sep 2011, 8:50 AM
#10
enzo_ita avatar

enzo_ita

Zen Follower

Join Date:
Jul 2009
Posts:
402
Plugin Contributions:
0

Re: Combining free and non free shipping

I have tryed to hack on my own the file tpl_shopping_cart, but there is something wrong in what I do. If I save the hacked file and reload the page, the entire column were the shopping cart is disappears.
I think that the problem I am having is in the syntax, but I do not know nothing about and I am trying to understand.
Thanks for your help
enzo

This is the original code
//Begin free shipping qualifier
$free_ship_on = MODULE_SHIPPING_FREEOPTIONS_STATUS;

if ($free_ship_on == 'True') {
$free_limit = MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN;
if ($_SESSION['cart']->count_contents() > 0) {
$_SESSION['cart']->get_products();
$basket_total = $_SESSION['cart']->show_total();
if ($basket_total < $free_limit) {
$diff_to_free = ($free_limit - $basket_total);
$content .= '<span class="freeoptions">' . '<style="text-align: center; "><span style="font-size: small; "><span style="color: rgb(255, 0, 0); "><b>Aggiungendo prodotti per '. $currencies->format($diff_to_free) .' <style="text-align: center; "><span style="font-size: small; "><span style="color: rgb(255, 0, 0); "><b>avrai diritto alla spedizione gratuita!</b></span></span>' . '</span>';
} else {
$content .= '<span class="freeoptions">' . '<p style="text-align: center; "><span style="font-size: small; "><span style="color: rgb(255, 0, 0); "><b>Complimenti! Hai diritto alla spedizione gratuita!</b></span></span>' . '</span>';
}
} else {
$content .= '<span class="freeshipping">' . 'Spedizione gratuita per ordini di ' . $currencies->format($free_limit) . ' or more.' . '</span>';
}
}
//End of free shipping qualifier

This is the hacked code
//Begin free shipping qualifier
$free_ship_on = MODULE_SHIPPING_FREEOPTIONS_STATUS;

if ($free_ship_on == 'True') {
$free_limit = MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN;
if ($_SESSION['cart']->count_contents() > 0) {
$_SESSION['cart']->get_products();
$basket_total = $_SESSION['cart']->show_total();
if $_SESSION['cart']->in_cart_check('product_is_always_free_shipping','1') {
$content .= '<span class="freeoptions">' . '<p style="text-align: center; "><span style="font-size: small; "><span style="color: rgb(255, 0, 0); "><b>Complimenti! Hai diritto alla spedizione gratuita!</b></span></span>' . '</span>';
{

if ($basket_total < $free_limit) {
$diff_to_free = ($free_limit - $basket_total);
$content .= '<span class="freeoptions">' . '<style="text-align: center; "><span style="font-size: small; "><span style="color: rgb(255, 0, 0); "><b>Aggiungendo prodotti per '. $currencies->format($diff_to_free) .' <style="text-align: center; "><span style="font-size: small; "><span style="color: rgb(255, 0, 0); "><b>avrai diritto alla spedizione gratuita!</b></span></span>' . '</span>';
} else {
$content .= '<span class="freeoptions">' . '<p style="text-align: center; "><span style="font-size: small; "><span style="color: rgb(255, 0, 0); "><b>Complimenti! Hai diritto alla spedizione gratuita!</b></span></span>' . '</span>';
}
} else {
$content .= '<span class="freeshipping">' . 'Spedizione gratuita per ordini di ' . $currencies->format($free_limit) . ' or more.' . '</span>';
}
}
}
//End of free shipping qualifier

18 Sep 2011, 1:33 PM
#11
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Combining free and non free shipping

Just a quick glance ...

Looks like you are missing a paren on the IF:

if [B]([/B]$_SESSION['cart']->in_cart_check('product_is_always_free_shipping','1') {
$content .= '<span class="freeoptions">' . '<p style="text-align: center; "><span style="font-size: small; "><span style="color: rgb(255, 0, 0); "><b>Complimenti! Hai diritto alla spedizione gratuita!</b></span></span>' . '</span>';
} 

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

18 Sep 2011, 4:14 PM
#12
enzo_ita avatar

enzo_ita

Zen Follower

Join Date:
Jul 2009
Posts:
402
Plugin Contributions:
0

Re: Combining free and non free shipping

Thanks Linda!!!!!
Unfortunately the problem must be also somewere else.
This is the new hacking attempt and it does not work even with the ( added.
If you could give it a look....thanks!!!

if (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'false') {
  $free_limit = MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN;
  if ($_SESSION['cart']->count_contents() > 0) { 
     $_SESSION['cart']->get_products(); 
     $basket_total = $_SESSION['cart']->show_total(); 
     if ($basket_total < $free_limit) { 
        $diff_to_free = ($free_limit - $basket_total); 
        $content .= '<span class="cartAlert">' . TEXT_ALERT_IN_CART . $currencies->format($diff_to_free) . TEXT_ALERT_QUALIFY . '</span>'; 
     } 
       if ($_SESSION['cart']->in_cart_check('product_is_always_free_shipping','1') {
$content .= '<span class="freeoptions">' . '<p style="text-align: center; "><span style="font-size: small; "><span style="color: rgb(255, 0, 0); "><b>Complimenti! Hai diritto alla spedizione gratuita!</b></span></span>' . '</span>';
}
	  else { 
        $content .= '<span class="cartAlert">' . TEXT_ALERT_NOW_QUALIFIED . '</span>'; 
     }  
  } 
      else { 
        $content .= '<span class="cartAlert">' . TEXT_ALERT_FREE_SHIPPING . $currencies->format($free_limit) . TEXT_ALERT_OR_MORE . '</span>'; 
    }
}
8 Aug 2012, 11:14 PM
#13
sam_m avatar

sam_m

New Zenner

Join Date:
Nov 2007
Posts:
71
Plugin Contributions:
0

Re: Combining free and non free shipping

just wondering if this was ever figured out?

8 Aug 2012, 11:18 PM
#14
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Combining free and non free shipping

Looks like I missed this too, there are two missing parens:

       if ($_SESSION['cart']->in_cart_check('product_is_always_free_shipping','1')) {
$content .= '<span class="freeoptions">' . '<p style="text-align: center; "><span style="font-size: small; "><span style="color: rgb(255, 0, 0); "><b>Complimenti! Hai diritto alla spedizione gratuita!</b></span></span>' . '</span>';
}

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!