Akopia Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

Re: [mv] Please answer, Shiping prices per item



******    message to minivend-users from Chris Rapier <rapier@psc.edu>     ******



Ben-Nes Michael wrote:
> 
> ******    message to minivend-users from Ben-Nes Michael <miki@canaan.co.il>     ******
> 
> Hi
> 
> I want a diffrent shipping price for each item like:
> 
> 3 lamps = 10 $
> 5 lamps = 10 $
> 2 printers = 40 $
> 5 printers = 40 $
> 6 printers = 80 $
> 
> Can it be done ?

I'm thinking that it should be possible but it will be rather
complicated. However, that shouldn't stop you. What you basically want
is something that

1) goes through the cart line by line
2) takes the product type and looks up the quantity shipping price in a
table
3) totals all of these into one grand shipping total.

However, there won't just be one grand quantity shipping table but one
table for each product type.

Is this a good summation of the problem?

If it was me I'd probably just do this in perl as its a straight
forward, if slightly cumbersome, task. It would just be a loop which
uses the quantity as an array element number. In really bad,
syntactically outrageous pseduo perl code...

@ship_foo_array (1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7,8,8,8);
@ship_bar_array (6,6,6,6,6,6,9,9,9,9,9,9,9,12,12,12,12,12,12,12,12);
foreach (#$cart) {
 if ($cart{type} eq "foo") {
   $shiptotal = $shiptotal + $ship_foo_arrary[$cart{type}{quantity}]
 }
 if ($cart{type} eq "bar") {
   $shiptotal = $shiptotal + $ship_bar_arrary[$cart{type}{quantity}]
 }
}

So say you had 6 foos and 2 bars in your cart. The above would end up
with a shipping price of 2 for the foos (6th element in the
ship_foo_array) and 6 for the bars (2nd element in the  ship bar_array).
This gives you a total shipping price of 8.

Now, the question, of course, is how to turn that into valid minivend
markup or how to properly embed the perl in a page. That I can't help
you with as I'm pretty new to this as well.

Chris
-
To unsubscribe from the list, DO NOT REPLY to this message.  Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list


Search for: Match: Format: Sort by: