Closed (fixed)
Project:
Commerce Coupon by product reference
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
8 Jan 2013 at 05:26 UTC
Updated:
2 Jun 2013 at 16:40 UTC
Jump to comment: Most recent file
Comments
Comment #1
lotyrin commentedHere's a slightly simpler version (replaces the action, keeps the loop).
Comment #2
andyf commentedI just wanted to say thanks so much for the code - things have been hectic recently, but I'll be able to take a look very soon.
Comment #3
star-szrPatch looks good and works as expected. Thanks @lotyrin!
Comment #4
andyf commentedLooks good, and I've just written some tests and it works with them. Thanks! My one worry is that it assumes the coupon_pct rule hasn't been modified (eg. it wouldn't work if the loop wasn't the first action).
Comment #5
andyf commentedIt's not beautiful, but I'd like to play as nicely with other modules as possible (ie if commerce_coupon_pct changes its rule, or if another module alters the rule before this one - dunno if I'm being (too) anal here!). I wasn't sure if it's safe to add an action to the loop while iterating it, so I used
$deleted. I never enjoy using Rules classes; I'd appreciate feedback if anyone has time.Thanks again @lotyrin, I've been meaning to get tests written for a while and this was always standing in the way.
Comment #6
bjlewis2 commentedIt appears that there are whitespace errors in #5. I'm not sure what the appropriate way is to get rid of those, or I'd have supplied another patch.
Comment #7
andyf commented@bjlewis2 Thanks, I'll kill those before committing!
Comment #8
andyf commentedThanks for everyone's help, finally committed: f6c55db.