Change a Wordpress Ecommerce plugin to store each cart in a DATABASE rather than SESSIONS
$30-100 USD
已取消
已发布超过 12 年前
$30-100 USD
货到付款
I'm very busy, and need help on a few tasks.
The most important task I need help with is regarding this LGPL licensed Wordpress ecommerce plugin:
<[login to view URL]>
It uses SESSIONS to store information in the shopping cart. For example, if a person Adds To Cart a shoe, the data for the items that are in the cart is stored using SESSIONS.
I need the new code to be 100% backwards compatible, as in, the only thing I want to change is the dependancy on SESSIONS. I want to eliminate this dependance and simply store the cart data in a database entry, and use a COOKIE to store the key to that database entry.
Here's the PHP source code that comprises the cart:
<[login to view URL]>
You can alter this file, or any other wpStoreCart file as much as needed in order to transition to a COOKIE/DATABASE version of the cart, in place of the old SESSIONS method.
## Deliverables
Line 62 of [login to view URL] is:
$wpsc_cart_type = 'session';
You can change this to something new like:
$wpsc_cart_type = 'database';
Then, anywhere you see the cart initialized using sessions, like this:
if($wpsc_cart_type == 'session') {
if(!isset($_SESSION)) {
@session_start();
}
if(@!is_object($cart)) {
$cart =& $_SESSION['wpsc'];
if(@!is_object($cart)) {
$cart = new wpsc();
}
}
}
You can add code below it such as:
if($wpsc_cart_type == 'database') {
// Your code goes here
}
You can also use $wpsc_cart_type inside the cart itself.
Remember, we need the cart to work exactly the way it does already, except we need it to not use SESSIONS at all, and instead, save the state of the cart to the database, and then restore that state on every page load. That's it. That's all this project requires. But the important thing is that everything remains functional after the switch. You may be able to utilize PHP serialize() and unserialize() function, in combination with a COOKIE which will store the primary key of the current users cart database entry. You may need to use the magic methods __sleep() and __wakeup() to properly store the cart.
If you're trying out the cart and cannot get it to store items in the cart after you switch to another page, then you're probably effected by this bug:
<[login to view URL]>
^ That is the reason why we need to move to a database/cookie solution!
wpStoreCart's shopping cart was built from a fork of jCart. These jCart forum threads may help you in this matter:
<[login to view URL]>
<[login to view URL]>
Thanks for looking. If you feel you can do this, please bid! Please, if you're serious about bidding, prove to me you read this by copying and pasting the following into your bid:
"I read the entire job description"