Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Need help w/ shipping logic


mindcube

Recommended Posts

I am setting up a new onlien store for a client, and love the osCommerce package. I'm at the point where I need to define some custom shipping logic. Should I attempt to write a shipping module from scratch or is there one that is like/similar to what I'm trying to do/. This is how the logic needs to work:

 

Shipping is per item, based on how much that item costs and where it is being shipped to.

 

:

 

Items > $10

US: $.50 per item

Canada: $.75 per item

International: $1.00 per item

 

Items < $10

US: $1.50 per item

Canada: $2.50 per item

International: $4.00 per item

 

Do I use the 'Zones' feature to define the different shipping areas? Additionally, where do I specify tax when the order is made in the state of CA? The logic was pretty simple with the older store software that we used, here is the perl code I used to define the logic there:

 

sub define_shipping_logic

{

local ($shipping_price) = @_;
local($upgradeShipLevel, $shipMethod) = split (/\|/,$form_data{upgradeShipping});

open (CART, "$sc_cart_path") || &file_open_error("$sc_cart_path", "display_cart_contents", __FILE__, __LINE__);
while (<CART>)
{
@cart_fields = split (/\|/, $_);
# qty = $cart_fields[0];
# price = $cart_fields[8];

@upgradeShipPrice = (1, 2, 3, 4);

if ($upgradeShipPrice[$upgradeShipLevel] == 1) {
  if ($cart_fields[8] < 10.00) {
     $shipping_price += $cart_fields[0]*.5;
     } else {
     $shipping_price += $cart_fields[0]*1.50;
  }
} elsif ($upgradeShipPrice[$upgradeShipLevel] == 2) {
  if ($cart_fields[8] < 10.00) {
     $shipping_price += $cart_fields[0]*.5;
     } else {
     $shipping_price += $cart_fields[0]*1.50;
  }
} elsif ($upgradeShipPrice[$upgradeShipLevel] == 3) {
  if ($cart_fields[8] < 10.00) {
     $shipping_price += $cart_fields[0]*.75;
     } else {
     $shipping_price += $cart_fields[0]*2.50;
  }
} else {
  if ($cart_fields[8] < 10.00) {
     $shipping_price += $cart_fields[0]*1.00;
     } else {
     $shipping_price += $cart_fields[0]*4.00;
  }
}

}
close(CART);
return $shipping_price;

}
1;

 

Of course, with the great features that osCommerce has the older store in comparison is laughable, but still, where can I define this logic to make it all work?

 

Thanks SOO much.

Link to comment
Share on other sites

Take a look in Contributions - I'm sure you will find something  :D

 

Matti

 

 

Yup, have been at it for the last four hours or so.. Actually, if I could modify the "per item" module to support different pricing schemes for 3 different zones (international, canada, and US) AND get it to modify the pricing scheme yet again based on the price of the individual product (less or more than $10 in this case), it would be a good start. :) Though right now I'm having trouble finding where the actual shipping logic is computated within the myriad of php files in oscommerce.. And if I can't figure it out without the help from any previous modules I will attempt to code my own, but like I said it's hard to start doing anything because I am not sure how everything works.. Thanks for the advice though. ;)

 

-Scott

Link to comment
Share on other sites

  • 2 weeks later...
Well, I started coding my own custom shipping module for this particular set of criteria..  I'll post it up when I'm finished.  This software rocks :)

After searching the contrib. for hours, I was glad to find your post. I'm looking for exactly that same option! Being a total nitwit with php, I appreciate it that you will post your solution :thumbsup:

 

Denice

Edited by jewelrytrends
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...