[eluser]koichirose[/eluser]
Ok, thank you.
Can I help you with anything to speed this up?
I'm sorry but I'm still confused about foreign keys.
For 'disc_location_fk' and 'disc_zone_fk', I'm not sure which part of the config affects these.
I tried enabling $config['database']['locations']['table'] with one of my tables at random, but it is not used, so I'm guessing it's session based and I'd have to call '$this->flexi_cart->update_location($location_data);'.
'disc_user_acc_fk' is just for rewards? What does it do exactly?
For item_fk / group_item: the field matched is the session's item id? Some code to explain that:
Code:
var_dump($this->flexi_cart->cart_contents());
//output:
array
'items' =>
array
'c4ca4238a0b923820dcc509a6f75849b' =>
array
'row_id' => string 'c4ca4238a0b923820dcc509a6f75849b' (length=32)
'id' => string '122' (length=1) // <------- is this the id that will be checked and that I have to add to the 'discount_group_item' table?
'name' => string 'Pochette' (length=8)
'price' => string '€ 82.64' (length=9)
Lastly, please don't hate me but I guess I found another issue: I added two discounts which are exactly the same except the value discounted. So they have the same code 'TEST'.
discount code id 1 - 10%
discount code id 3 - 40%
Entering 'TEST' when applying the code produces this:
Code:
var_dump($this->flexi_cart->discount_codes());
//output:
array
'TEST' =>
array
'id' => string '3' (length=1)
'code' => string 'TEST' (length=4)
'description' => string 'ddd' (length=3)
Savings calculations aside, as I explained in a previous message, I can use '$this->flexi_cart->total()' to check the discount code applied.
I get 10% instead of 40%. So discount_codes() reports discount #3 being applied, while the value discounted is from #1.
This won't happen in our case (and in most cases), since there can't be discounts with the same code and the same filters, but I thought it would be good to let you know.
Thanks again, have a great weekend