Please don't tell me to go to Commerce.cgi, I have been there and got no help.
I am not even sure I have the right
I get this error in the checkout:
Software error:
Undefined subroutine &main::shipping_by_category called at
./library/shipping_lib.pl line 44.
Here is the script I rewrote and changed from the one in commerce.cgi This
script works anyway the first part does if I change the name of the script to
"shipping_by_subtotal.pl" and change the "sub shipping_by_category" to
shipping_by_subtotal"
But when I order by a different category it still uses the same shipping
price.
I guess I might be leaving something out. I am not too sure if the
category_count is the correct way of picking the category to be used. I hope
you can understand what I am writing. Or have any suggestion, maybe I am way
off base. I place this script in the add-on folder
sub shipping_by_category
{
local ($shipMethod, $subtotal, $weight, $total_shipping, $category_count) =
@_; local ($shipping_price);
if ($category_count{'Gifts_Novelty'} eq "") {
if ($subtotal <= 100.00) { $shipping_price = 5.95; }
elsif ($subtotal >= 101.00 && $subtotal <= 249.00) { $shipping_price =
7.95; }
elsif ($subtotal >= 250.00 && $subtotal <= 499.00) { $shipping_price =
9.95; }
# All orders over the previous value
else { $shipping_price = 0.00; }
} else {
if ($subtotal <= 20.00) { $shipping_price = 7.00; }
elsif ($subtotal >= 30.00 && $subtotal <= 39.00) { $shipping_price =
8.50; }
elsif ($subtotal >= 40.00 && $subtotal <= 49.00) { $shipping_price =
10.00; }
elsif ($subtotal >= 50.00 && $subtotal <= 59.00) { $shipping_price =
11.50; }
elsif ($subtotal >= 60.00 && $subtotal <= 69.00) { $shipping_price =
13.00; }
elsif ($subtotal >= 70.00 && $subtotal <= 79.00) { $shipping_price =
15.00; }
elsif ($subtotal >= 80.00 && $subtotal <= 89.00) { $shipping_price =
19.00; }
elsif ($subtotal >= 90.00 && $subtotal <= 99.00) { $shipping_price =
23.00; }
elsif ($subtotal >= 100.00 && $subtotal <= 119.00) { $shipping_price =
27.00; }
elsif ($subtotal >= 120.00 && $subtotal <= 129.00) { $shipping_price =
32.00; }
# All orders over the previous value
else { $shipping_price = 38.00; }
}
return ($shipping_price);
}
1;
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.