The looping and general PHP coding is not a problem for me. It's just the logic for setting up the rules in eCart that I always get lost with.
I'm not really sure how the end user could typo anything...they're just selecting which products belong to a discount code as they create it. Nothing really to mis-type.
So then in my "apply discount" script I've already got the exploded value for product_ids in an array and I can loop through those no problem. What I don't really get is how to apply that to the shopping cart items.
Right now my discounts just work on the entire order. Even after looping through each of the valid product IDs for a given code I don't see how to get it to apply to only that single line item on the cart. The best I can seem to get to is to either apply the discount or not based on whether an item is in the cart, but then it still applies to the entire order instead of just that one line item.