Hi,
I have solved the problem ?? In fact, I made a code that saves cart on server. Thus user can access his cart from anywhere.
But you
1) must be able to access your WP database,
2) you should not to be afraid of looking at php ??
Make table “custom_wp_wpsc_cart” (in your WP database) containing fields “user_ID” (bigint) and “wpsc_cart” (varchar as long as possible, for example 100000).
Then copy this code at the begining of file plugins/wp-e-commerce/wpsc-theme/wpsc-cart_widget.php
(If you don’t use cart widget you could try to copy this at the begining of a file you use. I just haven’t tried this code anywhere else, sorry).
At the end of code you will find commented lines that refers to Save button – if you like to introduce one.
Sorry if there’s something strange or needless. But it works for me ??
<?php // FUNCTIONS FOR SAVING CART WITHOUT CHECKOUT ?>
<?php
function find_cart() {
global $user_ID, $wpdb;
$get_cart = $wpdb->get_row("SELECT * FROM custom_wp_wpsc_cart WHERE user_ID = " . $user_ID);
$found_cart = unserialize($get_cart->wpsc_cart);
return $found_cart;
}
function save_cart() {
global $wpsc_cart, $user_ID, $wpdb;
$saved_cart=serialize($wpsc_cart);
$is_cart=find_cart();
if ($is_cart) {
$wpdb->update('custom_wp_wpsc_cart',
array('wpsc_cart' => $saved_cart),
array( 'user_ID' => $user_ID ),
array('%s'),
array( '%d' )
);
}
else {
$wpdb->insert('custom_wp_wpsc_cart',
array('user_ID' => $user_ID,'wpsc_cart' => $saved_cart),
array('%d','%s')
);
}
$is_cart=find_cart();
return $is_cart;
}
global $wpsc_cart, $current_cart;
if ($wpsc_cart && strpos(serialize($wpsc_cart),'sku') == false && (!isset($_POST['wpsc_ajax_action']) || isset($_POST['wpsc_ajax_action']) && $_POST['wpsc_ajax_action']!='empty_cart'))
{
$wpsc_cart=find_cart();
$_SESSION['current_cart)']=$wpsc_cart;
}
if ($_SESSION['current_cart)'] && $_SESSION['current_cart)']!=$wpsc_cart)
{
$_SESSION['current_cart)']=save_cart();
}
//if(isset($_POST['save_cart']))
// { save_cart(); }
?>
<?php // END FUNCTIONS FOR SAVING CART WITHOUT CHECKOUT ?>
Put this code (to empty cart after checkout) in file plugins/wp-e-commerce/wpsc-includes/cart.class.php
after line
do_action('wpsc_save_cart_item', $cart_id, $this->product_id);
// delete cart information from custom introduced db table
global $user_ID;
$wpdb->delete( 'custom_wp_wpsc_cart', array( 'user_ID' => $user_ID ), array( '%d' ) );