close
Fail

Shopp Plug-in Cart Updated Method

6

In one of the random projects we undertook, we implemented the Shoppplugin for WordPress, which by all accounts is a pretty decent shopping cart. Like most things WordPress, you can stretch it’s functionality only so far before you reach the end of the sidewalk. Then, if you’re really brave (read: stupid) you can then start altering core code.

In one of the 11 Bridges Success blog posts we wrote about methods for accessing WordPress session variables and even core objects: “hack-the-cms-with-ajax-and-sessions” The bad news is that in the particular example given in that post there was in fact a failure that we haven’t yet overcome.

The problem is specifically related to:

1
2
3
4
5
6
7
<?php
require_once(‘../../../../wp-load.php’);
global $Shopp;
$Shopp->Cart->updated();
$_SESSION[‘poboxcheck’] = $_POST[‘poboxcheck’];
//echo print_r($Shopp);
?>

The goal we had with this code was to hack into the shipping calculator for this WordPress Plug-in and have it be a little smarter about shipping to PO Boxes. So, when a user selects a checkbox that they are shipping to a PO the UPS shipping options get removed (they don’t ship to PO Boxes).

The following line of code is supposed to flag the shipping calculator that the shipping costs need to be updated appropriately:

1
$Shopp->Cart->updated();

The failure is that it doesn’t. We realized that this causes odd behavior in certain test cases. However, the Shopp plug-in is reportedly going to be upgraded fairly soon with PO Box recognition built in, and we will wait for that upgrade rather than looking for another solution.

admin

The author admin