wp e-commerce php modification
- by user1015687
Here are a few lines of code from a wordpress plugin (WP E-commerce) that calculate the price. Now what i want is that if 'cart_item' are more than 3 in quantity then the price should be (number of items * 4) else the function should work as it is listed below. Thnks for help.
function calculate_subtotal($for_shipping = false) {
1047 global $wpdb;
1048 if($for_shipping == true ) {
1049 $total = 0;
1050 foreach($this->cart_items as $key => $cart_item) {
1051 if($cart_item->uses_shipping == 1) {
1052 $total += $cart_item->total_price;
1053 }
1054 }
1055 } else {
1056 $total = 0;
1057 if($this->subtotal == null) {
1058 foreach($this->cart_items as $key => $cart_item) {
1059 $total += $cart_item->total_price;
1060 }
1061 $this->subtotal = $total;
1062 } else {
1063 $total = $this->subtotal;
1064 }
1065 }
1066 return $total;
1067 }