Thank you for the clarification.
Anyway, I seem to remember that I tried setting 21 as $config[‘defaults’][‘shipping’][‘tax_rate’] and it did not work as expected.
I’m setting it to false now, so it should use the cart tax value, plus I’m manually setting ‘tax_rate’ when calling set_shipping, too.
Here goes about orders:
Note that discount_methods, types and tax_methods are default.
I added a new 10% code:
INSERT INTO `flexi_discounts`(`disc_id`,`disc_type_fk`,`disc_method_fk`,`disc_tax_method_fk`,`disc_user_acc_fk`,`disc_item_fk`,`disc_group_fk`,`disc_location_fk`,`disc_zone_fk`,`disc_code`,
VALUES (1,2,7,1,0,0,0,0,0,‘TEST’,‘Test description’,0,0,0.00,10.00,0,0,0,0,‘0’,‘0’,‘0’,5,‘2012-11-12 14:50:20’,‘2012-11-22 14:51:55’,1,100);
disc_type_fk = 2, Summary Discount
disc_method_fk = 7, Summary Item Total - Percentage Based
disc_tax_method_fk = 1, Apply Tax Before Discount
'row_id' => string 'c4ca4238a0b923820dcc509a6f75849b' (length=32)
'id' => string '1' (length=1)
'name' => string 'Pochette' (length=8)
'price' => string '€ 82.64' (length=9)
'quantity' => string '1' (length=1)
'stock_quantity' => string '3' (length=1)
'internal_price' => float 82.64
'weight' => string '0g' (length=2)
'tax_rate' => string '21%' (length=3)
'shipping_rate' => boolean false
'separate_shipping' => boolean false
'reward_points' => string '826' (length=3)
'tax' => string '€ 17.35' (length=9)
'non_discount_quantity' => string '1' (length=1)
'discount_quantity' => string '0' (length=1)
'price_total' => string '€ 82.64' (length=9)
'discount_price' => string '€ 82.64' (length=9)
'discount_price_total' => string '€ 82.64' (length=9)
'discount_description' => boolean false
'tax_total' => string '€ 17.35' (length=9)
'weight_total' => string '0g' (length=2)
'reward_points_total' => string '826' (length=3)
'item_summary_total' => string '€ 82.64' (length=9)
'item_summary_savings_total' => string '€ 0.00' (length=8)
'shipping_total' => string '€ 14.74' (length=9)
'item_shipping_total' => string '€ 97.38' (length=9)
'summary_savings_total' => string '€ 25.61' (length=9)
'savings_total' => string '€ 25.61' (length=9)
'reward_voucher_total' => string '€ 0.00' (length=8)
'surcharge_total' => string '€ 0.00' (length=8)
'tax_total' => string '€ 20.45' (length=9)
'total' => string '€ 117.83' (length=10)
'total_rows' => string '1' (length=1)
'total_items' => string '1' (length=1)
'total_weight' => string '0g' (length=2)
'total_reward_points' => string '826' (length=3)
echo $this->flexi_cart->total(); //107.83
The order total (last line) is correct, as it is (99.99 + 17.83 - (99.99*0.10)).
I don’t understand where that €25.61 in savings is coming from.
About custom statuses: I understood how they work, but they directly relate to the current user session and not to the cart contents.
For example, I’d like to be able to set a discount for a specific brand, for a specific category of products, for a group of users based on some filters (i.e. users that didn’t buy anything in the last 30 days), etc.
I think the best way to achieve this would be to add custom fields to the ‘discounts’ table (or a new table with a fk), then manually check cart contents and querying the db for a discount that matches these filters.
Do you think it would be a viable solution?
About enabling joins: let’s say I want to offer free shipping to users in the UK. I see you do that in the examples.
I disabled the ‘flexi_locations’ table since I’m using one of my own (not used by flexi anyway, as I use my own calculate_shipping() method).
How do I setup a join for my own locations table?
Sorry about the length of this post (and this discussion), I hope it will be useful for everyone