[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] Custom shipping
Hello,
I've been trying to come up with a solution for a custom shipping routine,
and would appreciate any comments or help implementing this. I'm not sure
whether this can be done using IC tags in 'shipping.asc', or if I will need
to define a user tag, in which case, I am most comfortable with C-style Perl.
OK, here's the deal:
Shipping cost will be calculated by weight and zone (there are 4 zones), but
items will have different packaging types. For example, posters will use
poster tubes, and books will use boxes. Also, there are limits to how many
items will fit into any given packaging type. For example, up to 5 posters
can fit into a tube. An item can also have more than one packaging type. For
example, on their own, a set of postcards would probably go in a padded
envelope, but if they were ordered with a book, everything would go into a
single box.
A rough idea of the steps required (I'm using MySQL):
- Loop through each item in cart,
- Add weight of all items together,
- Count the quantities of each packing type required from a 'packaging_type'
field in the 'products' table,
- Index into a 'shipping' table to find a price for the 'weight/zone' pair,
- Index into a 'packaging' table to find a price for the
'quantity/packaging_type' pair, for each required packaging type,
- Add the looked up shipping cost and packaging cost(s) together
This method is not perfect, but it's the best I have come up with so far. For
example, if more than two packaging types are required (say, a poster tube
and a box), it does not account for the fact that it is more expensive to
send split orders than just one of the same weight. Then there is the
situation where someone orders items from various categories, that together
use a different packaging type than they would individually, and the customer
could be charged for packaging they don't need. Again, taking the above
example; on their own, a set of postcards would probably go in a padded
envelope, but if they were ordered with a book, everything would go into a
single box.
However, I think it will be better to lose some here and gain some there,
than to have a horribly complicated and cycle-hogging routine that takes into
consideration every possible combination of items ordered.
Thank you in advance!