WP-Ecommerce - processing.functions.php


/ Published in: PHP
Save to your folder(s)

Sale Price/Variation custom
this code just work if all variation price is a same as product price


Copy this code and paste it in your HTML
  1. find
  2.  
  3. $price = $wpdb->get_var("SELECT `price` FROM `".WPSC_TABLE_VARIATION_PROPERTIES."` WHERE `id` = '{$priceandstock_id}' LIMIT 1");
  4.  
  5. change to this
  6.  
  7. $variation_data = $wpdb->get_var("SELECT `price` FROM `".WPSC_TABLE_VARIATION_PROPERTIES."` WHERE `id` = '{$priceandstock_id}' LIMIT 1");
  8. $product_data = $wpdb->get_row("SELECT `price`,`special`,`special_price` FROM `".WPSC_TABLE_PRODUCT_LIST."` WHERE `id`='".$product_id."' LIMIT 1",ARRAY_A);
  9.  
  10. if(($product_data['special_price'] > 0) && (($product_data['price'] == $variation_data) >= 0) && (($variation_data - $product_data['special_price']) >= 0) && ($no_special == false)) {
  11. $price = $product_data['special_price'];
  12. } else {
  13. $price = $variation_data;
  14.  
  15. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.