WPSC WP E-Commerce Shopping Cart 3.6.12 Google Checkout Shipping

It turns out that, among other things, WPSC can’t calculate shipping properly when linked to Google Checkout when using a flat-rate shipping method.

Surprise, Surprise.

We found a fix:

shopping_cart_functions.php around line 295 had the following as a method for calculating shipping:

$pnp += $wpdb->get_var(“SELECT SUM(pnp) FROM “.$wpdb- >prefix.”product_list WHERE id IN (“.$google_product_id.”)”);

That’s great – except that it doesn’t take into account the possibility that someone could order MORE THAN ONE ITEM. Like that ever happens in the e-commerce world. Maybe it just doesn’t happen in New Zealand. But here in the great U S of A, people often times buy more than one item.

So we changed the above line to:

foreach((array)$_SESSION['nzshpcrt_cart'] as $cart_item) { $product_id = $cart_item->product_id; $quantity = $cart_item->quantity; $pnp += nzshpcrt_determine_item_shipping($product_id, $quantity, $_SESSION['delivery_country']); }

Which was conveniently stolen from some other file.

The logic here is bad, too – only because I have a feeling nzshpcrt_determine_item_shipping looks up in the database for each item its price. Ideally the price should be stored locally as part of the nzshpcrt_cart array of cart objects, as quantity and description already are. Of course we were going to do that much, we might as well just re-write the entire plugin – properly, of course – and send the original developers packing.

Hope that helps.

Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • LinkedIn
  • Twitter

About admin

Comments

2 Responses to “WPSC WP E-Commerce Shopping Cart 3.6.12 Google Checkout Shipping”
  1. Shane Strong says:

    I love the post. I have been using WP E-Commerce for about 3 months now and have not had anything go right. We have 2 clients that are asking us to fix some problems with the system and we are constantly trying to change things with the plugin. It really need to be taken down and not put back up until someone fixes it properly. I have asked the developers if I could join the team to help with the development but they got back to me as fast as their customer service (never). I love it that they can make a lot of money when their product is nothing but crap.

  2. webadmin@brainspiral.com says:

    I agree completely, Shane. We’ve tried out Shopp (http://shopplugin.net/) but haven’t activated it on a live site yet. It seems like it has some nice features, but we have found some glitches there, too (fortunately they still consider it in development & it’s only three or four months old at this point). We’ll see. Thanks again.

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!