Download & Extend

Duplicate codeless discounts by term on product node

Project:Ubercart Discounts (Alternative)
Version:6.x-2.4
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

If the product:
has more than 1 taxonomy term associated with it
AND
the codeless discount is 'Filter by Terms' where more than 1 term are matched in the associated terms

Then the discounts will be duplicated for as many matched terms.
For example:
discount 1 = 'Filter by Terms' for X, Y
product has 2 terms - X, Y
codeless discount view:

discount 1
discount 1

Even though it shows this way, the discounts are still applied to the order correctly - in the example discount 1 is applied only once to the order

I have provided a hack until the bug is fixed. I changed the output of this field in my template using the following function:

function unique_codeless_discounts_view(&$field_codeless_discount) {
  $discounts_delim = '<br/>';
  if (!$field_codeless_discount['view']) {return '';}
  return implode($discounts_delim, array_unique(explode($discounts_delim, $field_codeless_discount['view'])));
}

This function is only valid to use if your discount:

  • are filter by terms
  • descriptions are unique
  • should only be applied once per product

Comments

#1

Version:6.x-1.0-beta33» 6.x-2.4

I have this same type error. (see attached photo). Altho it seems to apply correctly on the checkout page. But my product only has 1 term. (see photo) Also the discount is being applied by specific product SKU. Why is this?

AttachmentSize
double discount code.jpg 92.57 KB
one term.jpg 44.48 KB
by SKU.jpg 69.44 KB

#2

thanks. I see this is in fact what is happening. I may try the code on my test site. thanks for the explanation

nobody click here