Zen Cart Logo
If this is your first visit, check our documentation. To post, register or login.
Forums / Community Contributed Add-Ons / Addon Shipping Modules / Make a shipping module to show a cost or not depending on the free shipping cart stat

Make a shipping module to show a cost or not depending on the free shipping cart stat

5 May 2013, 2:39 PM
#21
enzo_ita avatar

enzo_ita

Zen Follower

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

Post #21 by enzo_ita

Hi,
because I use freeoptions I used the field MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN
In this way it is not dependednt from ot_shipping.
Is this wrong?
ciao ciao

5 May 2013, 3:13 PM
#22
ajeh avatar

ajeh

Oba-san

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

Post #22 by ajeh

That works just as well as the other and as you use that, there is only one place to manage the minumum ... good choice!

Glad that everything is now working for you ...

Remember the Zen Cart Team when you are rich and famous! :cool:

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!

6 May 2013, 11:02 AM
#23
enzo_ita avatar

enzo_ita

Zen Follower

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

Post #23 by enzo_ita

Ajeh:

Remember the Zen Cart Team when you are rich and famous! :cool:

I will.
In the menatime I have mod again the conditions cluster and now it looks this way.

// bof: cost pick up depending on cart condition
      //cost if either 1 or more products is in the cart for Always Free Shipping or cart is Over Minimum
      if ($_SESSION['cart']->in_cart_check('product_is_always_free_shipping','1') == $_SESSION['cart']->count_contents() || $_SESSION['cart']->show_total() >= MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN) 
      {$cost = MODULE_SHIPPING_CELERE3_PICKUPPOINT_COST_1;
	  }
	  //cost if cart is Not Free Shipping
      if ($_SESSION['cart']->in_cart_check('product_is_always_free_shipping','0') == $_SESSION['cart']->count_contents() and $_SESSION['cart']->show_total() <= MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN) 
      {$cost = MODULE_SHIPPING_CELERE3_PICKUPPOINT_COST;
      }
	  //cost if cart is Free Shipping but is mixed and does not reach the minimum
	   if ($_SESSION['cart']->in_cart_check('product_is_always_free_shipping','1') and $_SESSION['cart']->show_total() <= MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN) 
      {$cost = MODULE_SHIPPING_CELERE3_PICKUPPOINT_COST_1;
      }
//eof: cost pick up depending on cart condition  

Now it is complete and working like a charme, however, I have two questions if you have time.

  1. I thin that the fisrt and the last condition could be put together in one condition only, but I can not imagine how to do it.
  2. I do not understand the meaning of this condition ```php
    $_SESSION['cart']->count_contents()

It is nothing urgent but because I learn a lot trough your examoples, I really would like to have you answer my questions.

ciao ciao
enzo
7 May 2013, 11:02 PM
#24
ajeh avatar

ajeh

Oba-san

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

Post #24 by ajeh

You could combine them using:

// bof: cost pick up depending on cart condition
      //cost if either 1 or more products is in the cart for Always Free Shipping or cart is Over Minimum
      if (($_SESSION['cart']->in_cart_check('product_is_always_free_shipping','1') and $_SESSION['cart']->show_total() <= MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN) || $_SESSION['cart']->in_cart_check('product_is_always_free_shipping','1') == $_SESSION['cart']->count_contents() || $_SESSION['cart']->show_total() >= MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN) {
        $cost = MODULE_SHIPPING_CELERE3_PICKUPPOINT_COST_1;
      }
      //cost if cart is Not Free Shipping
      if ($_SESSION['cart']->in_cart_check('product_is_always_free_shipping','0') == $_SESSION['cart']->count_contents() and $_SESSION['cart']->show_total() <= MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN) {
        $cost = MODULE_SHIPPING_CELERE3_PICKUPPOINT_COST;
      }
// eof: cost pick up depending on cart condition

On the reference to:
$_SESSION['cart']->count_contents()

that is a way to get the total number of items in the cart ...

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!