Zen Cart Big Chooser Bug Detected
Saturday, September 13, 2008 – 5:57 amA bug has been detected in all versions of my Zen Cart Big Chooser extension.
The issue was as follows:
- For set_constraint() parameters with multiple required purchases, passing was based on whether the final required quantity passed. So if you used
$this->set_constraint(CAT, 3, 6, CAT, 2, 5);
and you had 5 category 2 items but less than 6 category 3 items, the constraint would be considered passed. (Note: If your set_constraint() parameters have only one required purchase, you are not affected by this bug.)
- For set_choice_constraint() parameters, if you had multiple instances of set_choice_constraint, passing was based on whether the last one passed. So if you had
$this->set_choice_constraint(6, CAT, 2); $this->set_choice_constraint(6, CAT, 3);
and you did not have 6 category 2 items but you did have 6 category 3 items, the constraint would be considered passed. (Note: If your choice constraints are consolidated into one single set_choice_constraint parameter, you are not affected by this bug.)
This is the resolution. Edit the file includes/modules/order_total/ot_big_chooser.php, and in the function calculate_deductions() find this block of code:
// If there's a constraint list, make sure the product is in it.
if (sizeof($rule->constraintlist) > 0) {
$pass = false;
foreach ($rule->constraintlist as $constraint) {
$pass = $this->check_cart_constraint($products, $constraint);
}
if (!$pass) continue;
}
// If there's a choice constraint list, make sure it's covered.
if (sizeof($rule->choice_constraintlist) > 0) {
$pass = false;
foreach ($rule->choice_constraintlist as $constraint) {
$pass = $this->check_cart_choice_constraint($products, $constraint);
}
if (!$pass) continue;
}
Replace it with this block of code:
// If there's a constraint list, make sure the product is in it.
if (sizeof($rule->constraintlist) > 0) {
$pass = false;
foreach ($rule->constraintlist as $constraint) {
$pass = $this->check_cart_constraint($products, $constraint);
if (!$pass) break;
}
if (!$pass) continue;
}
// If there's a choice constraint list, make sure it's covered.
if (sizeof($rule->choice_constraintlist) > 0) {
$pass = false;
foreach ($rule->choice_constraintlist as $constraint) {
$pass = $this->check_cart_choice_constraint($products, $constraint);
if (!$pass) break;
}
if (!$pass) continue;
}
This bug is fixed in Big Chooser version 1.2.0a. If you already have Big Chooser, I can send you a fresh copy with this fix (and selection by manufacturer) for just $10.






One Response to “Zen Cart Big Chooser Bug Detected”
Hi, I found your blog on this new directory of WordPress Blogs at blackhatbootcamp.com/listofwordpressblogs. I dont know how your blog came up, must have been a typo, i duno. Anyways, I just clicked it and here I am. Your blog looks good. Have a nice day. James.
By James on Sep 18, 2008