/ Published in: PHP
Sale Price/Variation custom
this code just work if all variation price is a same as product price
this code just work if all variation price is a same as product price
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
find $price = $wpdb->get_var("SELECT `price` FROM `".WPSC_TABLE_VARIATION_PROPERTIES."` WHERE `id` = '{$priceandstock_id}' LIMIT 1"); change to this $variation_data = $wpdb->get_var("SELECT `price` FROM `".WPSC_TABLE_VARIATION_PROPERTIES."` WHERE `id` = '{$priceandstock_id}' LIMIT 1"); $product_data = $wpdb->get_row("SELECT `price`,`special`,`special_price` FROM `".WPSC_TABLE_PRODUCT_LIST."` WHERE `id`='".$product_id."' LIMIT 1",ARRAY_A); if(($product_data['special_price'] > 0) && (($product_data['price'] == $variation_data) >= 0) && (($variation_data - $product_data['special_price']) >= 0) && ($no_special == false)) { $price = $product_data['special_price']; } else { $price = $variation_data; }