Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Shipping methods depening on order value, possible?


Guest

Recommended Posts

Hi,

 

I have been mulling this over for a few weeks now, but have not had time to look into it, so i thought i would ask here if anyone has implemented a similar system. . .

 

We offer serveral shipping methods, and all shipping is based on weight. The problem is that the cheapest method is only insured for ?27, i get countless orders that are way above this value and the customer selects the cheapest method (which of course is understandable). I have put it in writing that this shipping method is intended for lower value orders, and specified the level of cover it gives, but of course i cannot rely on all customers to read and adhere to this.

 

What I wish to do is disable the lowest price shipping method if a value is above a specified amount, something like:

 

Order value 0-50 : all shipping methods available

Order value 50+: all shipping methods except the lowest value method available.

 

the shipping method is UK Recorded Delivery, which is based the zones.php with just 1 country code.

 

Any pointers of help would be greatly appreciated, once i get it working it could be usefull as a contribution for others?

 

Hope that made sense :)

 

Cheers

 

Matt

Link to comment
Share on other sites

I have posted a few threads on how to toggle on and off shipping modules based on a function that returns true or false that tests for a conditions such as order $total or customers country or what have you.

 

You might try a search on shipping and my nick and see what comes up in regards to making your shipping module more intuative and turn on or off based on an order condition.

Link to comment
Share on other sites

I am not a very attentive shop owner and this is due to my capability to program this shop and the magnitude of my problem. So please assume I know very very little when responding to this. Thanks.

 

I drop ship with quite a few companies who label for me and then i am able to pass on the savings to the customer...well and be competitive. I have run into a problem with the shipping because i cannot se a way to allocate a shipping option to a particular product or to specify a location to a product to apply to a shipping format.

 

Make sense?? Any ideas??

 

 

Oh I could just include the shipping cost and average it out but i would prefer not to if possible.

 

My site is at www.domesticperformance.com

I am looking for a person to help modify my site for me as well and am willing to pay a reasonable cost.

 

Ty

Link to comment
Share on other sites

Search through the threads on Shipping for controlling the display of the shipping modules with an IF true/false function to enable/disable it based on the order details.

 

There are several examples I have made for this that should steer you in the right direction for how to manage the modules and make the zone one you want to turn off on orders over $XX

 

The function to disable/enable shipping modules can be designed to test for any number of conditions, flags in the various tables, order $XX, order weight, because it's your birthday, etc.

 

I also have posted an addition to the /includes/classes/shopping_cart.php to test the value of a specific field to help work with this IF verification for the modules, or anything else you might need to test for.

 

Seek and you will find these ... they should prove enlightening. :D

 

If you are still stuck in the next few days, let me know and I can work through the specifics with you.

Link to comment
Share on other sites

Hi Ajeh, thanks for your help so far, much appreciated.

 

I have been reading through the various threads (my eyes hurt) and am getting an idea of what i need, one (probably simple) thing has me stumped, how would i go about getting the value of the cart?

 

I have looked over shopping_cart.php to see how it gets the value, but i cannot get a grasp of it :( I also looked over the database and am unsure where this value is held, there is a field in customers_basket for final_price, but every entry in my DB is 0, so that cannot be it (or is it 0'd once and order is confirmed and the order placed into the DB?)

 

Thanks again.

 

Matt

Link to comment
Share on other sites

In a function, be sure to global $cart ...

 

Total $$ = $cart->show_total()

Weight = $cart->show_weight()

# of Items = $cart->count_contents()

 

Peek in the /includes/classes/shopping_cart.php for a number of other functions available.

Link to comment
Share on other sites

Yeeha :)

 

I did it, thanks for your help Ajeh.

 

For anyone that may need the same thing:

 

add the following to /includes/functions/shopping_cart.php, before the

 } 

?>

 

// BOF: WebMakers.com Added: Compute cart quantity based on field 

// $check_what is the fieldname 'products_is_free' 

// $check_value is the value being tested for - default is 1 

// Syntax: $cart->in_cart_check('product_is_free','1'); 

   function in_cart_check($check_what,$check_value='1') { 

     // if nothing is in cart return 0 

     if (!is_array($this->contents)) return 0; 



     // compute total quantity for field 

     $in_cart_check_qty=0; 



     reset($this->contents); 

     while (list($products_id, ) = each($this->contents)) { 

       $test_id=tep_get_prid($products_id); 

       // check if field it true 

       $product_check_query = tep_db_query("select " . $check_what . " as check_it from " . TABLE_PRODUCTS . " where products_id='" . tep_get_prid($products_id) . "' limit 1"); 

       $product_check = tep_db_fetch_array($product_check_query); 

       if ($product_check['check_it'] == $check_value) { 

         $in_cart_check_qty += $this->contents[$products_id]['qty']; 

       } 

     } 

     return $in_cart_check_qty; 

   } 

// EOF: WebMakers.com Added: Compute cart quantity based on field

 

In /catalog/includes/functions/general.php at the bottom before the ?> add:

 

// WebMakers.com Added: Test field for shipping 

 function show_shipper($check_what = '', $check_it = '0') { 

   global $cart; 

   return $cart->in_cart_check($check_what,$check_it); 

 }

 

In /admin/includes/function/general.php at the bottom before the ?> add:

 

// WebMakers.com Added: Allow shipping modules to work in Admin 

 function show_shipper($check_what = 'nothing', $check_it = '0') { 

   return true; 

 }

 

then finally in the shipping module you wish to be determined by the value of the cart (or anything else you wish to use), make a small change to the end of the 'class constructor' function

 

Change:

// class constructor

   function zones() {

     $this->code = 'zones';

     $this->title = MODULE_SHIPPING_ZONES_TEXT_TITLE;

     $this->description = MODULE_SHIPPING_ZONES_TEXT_DESCRIPTION;

     $this->icon = DIR_WS_ICONS . '';

     $this->enabled = MODULE_SHIPPING_ZONES_STATUS;

   }

 

to:

 

// class constructor

   function zones() {

     $this->code = 'zones';

     $this->title = MODULE_SHIPPING_ZONES_TEXT_TITLE;

     $this->description = MODULE_SHIPPING_ZONES_TEXT_DESCRIPTION;

     $this->icon = DIR_WS_ICONS . '';

     $this->enabled = MODULE_SHIPPING_ZONES_STATUS;

// WebMakers.com Added: In the shipping module and check field and value 

// will return the qty of the field based on the value that is currently in the cart. 

global $cart;

if ( $cart->show_total() >= 40) { 

     $this->enabled = ((MODULE_SHIPPING_ZONES2_STATUS == 'False') ? true : false); 

}

 

Now if the cart value is ?40 or less, the shipping option is available, if it is over ?40 then it does not show up.

 

All the above code is Ajeh's, i'm taking no credit, thanks once again.

 

Cheers

 

Matt

www.consoleplus.co.uk

Link to comment
Share on other sites

You should make this a function call:

if ( $cart->show_total() >= 40) { 

     $this->enabled = ((MODULE_SHIPPING_ZONES2_STATUS == 'False') ? true : false); 

}

 

if (show_shipper()) {

     $this->enabled = ((MODULE_SHIPPING_ZONES2_STATUS == 'False') ? true : false); 

}

 

The function show_shipper on the catalog side would then have your test for whether or not to show the module. You can add a paramater to that as well to indicate which module you are in etc.

 

This way, your modules will still work in the Admin ... note they are most likely broke right now. That is what the function in the Admin is for that returns true.

Link to comment
Share on other sites

Like I said before imagine i know very little. I am a bit confused by the answer and i am not sure (Linda) if you understood what I meant. I may be wrong but wanted to be sure I was 100% clear about my dilemma.

 

I have a supplier who ships to my customer for me in Canada and I am in California. If I have the product shipped to California it will be more expensive than a UPS system would calculate it as if it assumes I am already in California with the product. I was hoping for a solution for this problem. Although I may be able to change shipping types.. I was not sure I could have more than one address to reference to for each product in regards to its shipping cost. I was also thinking of using the shipping by cost as a tool for the drop shipped product but it only will let me add so many products to it before it ends. also do it is cumbersome to use. If I as wrong and you understood what I was meaning I apologize. Either way I will probably hire someone to finish the shop because I was lost while reading your information.

 

 

Thanks for all your assistance.

 

Ty

Link to comment
Share on other sites

Unfortunately, this code is based on shipping from one particular location to any location based on the results of the look-up on the ship to address.

 

I would have to get a little trickier to have it look at each product for the ship from address then check the ship to address to determin the price.

 

This can be done. It just takes a little more code and thought than this involved as the amount for shipping is a calculation based on a per product location/destination amount.

 

It's doable. Just not in a quick lesson. :shock:

Link to comment
Share on other sites

Well I am very interested and this option is what I am going to need before I spend anymore time on the store. Currently I will do what I can with including the shipping or something of that nature. Linda if you can help or can provide further assistance please contact me at [email protected].

 

Ty

Link to comment
Share on other sites

  • 3 months later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...