wp-e-commerce bugs and improvements
This applies to version 3.7.5.3
If activating the plugin causes your browser to freeze, hang, and timeout -- Make sure you have created the wp-contents/uploads directory, and that Apache has write permissions to it (I recommend setting that directory to group ownership with 'apache' or whatever your server runs as, with g+ws permissions.)
Order of items in category is reversed. Code has ascending, descending backwards. Simple correction (patch file in wp-content/wp-e-commerce/wpsc-includes) follows. (reference on Wordpress.org forums)
*** wpsc_query.php~ 2009-12-21 20:25:02.000000000 -0700 --- wpsc_query.php 2010-03-11 12:30:55.000000000 -0700 *************** *** 1346,1352 **** // Invert this for alphabetical ordering. if (get_option('wpsc_sort_by')=='name') { ! if( $order == 'ASC'){ $order = 'DESC'; }else{ $order = 'ASC'; --- 1346,1352 ---- // Invert this for alphabetical ordering. if (get_option('wpsc_sort_by')=='name') { ! if( $order != 'ASC'){ $order = 'DESC'; }else{ $order = 'ASC';
This patch allows use of SKUs in the shortcode that inserts the product-buying form:
[wpsc_products product_id=MYSKU]
In theme.functions.php at about line 379, add the bold text:function wpsc_display_products_page($query) { global $wpdb, $wpsc_query, $wpsc_theme_path;
<strong> if (!is_numeric($query['product_id']) && (strlen($query['product_id']) != 0)) { $product = $wpdb->get_row("SELECT * FROM ".WPSC_TABLE_PRODUCTMETA." WHERE meta_key='sku' and meta_value='". $query['product_id']."' LIMIT 1", ARRAY_A); $query['product_id'] =$product['product_id']; }</strong> $temp_wpsc_query = new WPSC_query($query); list($wpsc_query, $temp_wpsc_query) = array($temp_wpsc_query, $wpsc_query); // swap the wpsc_query objects/// added by xiligroup.dev to be compatible with touchshop $cur_wpsc_theme_folder = apply_filters('wpsc_theme_folder',$wpsc_theme_path.WPSC_THEME_DIR); /// end of added by xiligroup.dev to be compatible with touchshop
This patch allows use of SKUs in the add_to_cart shortcode:
[add_to_cart=MYPRODUCT]
Find, in display.functions.php approx line 296
function wpsc_add_to_cart_button($product_id, $replaced_shortcode = false) { global $wpdb; if ($product_id > 0){ if(function_exists('wpsc_theme_html')) { $product = $wpdb->get_row("SELECT * FROM ".WPSC_TABLE_PRODUCT_LIST." WHERE id = ".$product_id." LIMIT 1", ARRAY_A);
Insert, between the 'global' and 'if' lines, this:
<strong> if (!is_numeric($product_id) && (strlen($product_id) != 0)) { $product = $wpdb->get_row("SELECT * FROM ".WPSC_TABLE_PRODUCTMETA. " WHERE meta_key='sku' and meta_value='$product_id' LIMIT 1", ARRAY_A); $product_id = $product['product_id']; }</strong>
in theme.functions.php at about line 662, change the regular expression in function:
function add_to_cart_shortcode($content = '') { //exit($content); if(preg_match_all("/[add_to_cart=([<strong>d</strong>]+)]/",$content, $matches)) {
to:
function add_to_cart_shortcode($content = '') { //exit($content); if(preg_match_all("/[add_to_cart=([<strong>w</strong>]+)]/",$content, $matches)) {