This module needs a little direction to make it more powerful and stable, I'm dropping here a quick roadmap to put commerce coupons in shape, feel free to comment other areas of action that you think are required.

Basically I consider we need three areas of action:
- "Standarize" our code, as I've seen commerce coupons is using is own way to do things, one big example is the entity management, I've made a little step in this issue #1408800: Abstract and standardize commerce coupon to fix general coupon problems, but we need to base our entities in Commerce core ones asap.
- Move not 'Coupons core' stuff out of the module, say it drop ballast if you want, I've proposed to move feeds integration into commerce feeds here #1411406: Move Feeds integration to Commerce Feeds but I think it would be clever to move the batch and basic modules out of here, to its own projects. I'd take batch one i.e., and probably alex would like to get basic himself #1372434: refactor "basic coupon" to "fixed coupon" and "variable coupon". New modules would have its own space. This would force us to make coupon API stronger and more stable and we'll make this more neat and sustainable.
- Squash major & critical, we have as now 10+ issues just marked in status that consider the module "unusable" but the total count of issues is 62 for a 441 uses module. That's bad.

I think it could be also a good thing to review googletorp's version of the module, see #1334558: Sandbox

Let me know what you think, I'll start addressing these as soon as my co-maintainership is accepted #1372282: apply for comaintainership

I don't feel we need to make a 2.x branch as the 1.x branch is not operative enough to keep it and I don't see as now we need to do any mayor database moves.

Comments

geek-merlin’s picture

welcome on board pedro. happy to have you here as i dont find too much time to work on this these days.
some notes:
* bugsquashing is always great, no arguing about that...!
* yes, i can see no api freeze in 1.x
* i think we should keep example modules in this project but thats a minor issue
* as for #1408800: Abstract and standardize commerce coupon to fix general coupon problems see my comment there

pcambra’s picture

i think we should keep example modules in this project but thats a minor issue

I don't see how batch generation of coupons is an example module, I still think we should cut as much code as we can to make the "core coupon" system as maintainable as possible.

I'll work today in a refactor of our classes for #1408800: Abstract and standardize commerce coupon to fix general coupon problems (and give that issue a better naming)

Oh, and I think we should have "add tests" somewhere in the roadmap.

muschpusch’s picture

Hey, i think we should have a look what the uc_coupon module can do right now. I'm working on a solution to limit coupons to specific taxonomy terms or products. Since coupons are entities we could solve this by adding a reference field to products / taxonomies. One of steps to get there is a delete action if the basket changes: #1295316: Remove Coupons from the checkout another one a rule which checks if the reference is there #1419394: check for references of a coupon action . The last one isn't finished. Last but not least i have some code somewhere to have a commerce coupon block. Want it?

pcambra’s picture

I think this issue is a major priority also #1274280: Coupon calculation workflow review

geek-merlin’s picture

+1 for tests
and
+1 for workflow review

jonathan_hunt’s picture

This module desperately needs some love. I'd like to see it become minimally useful & solid first, confirmed by tests second, then refactored/enhanced third. Right now it's not something that can be deployed on a live site; I think an alpha designation would be more appropriate than beta4. I've offered a few patches elsewhere in the issue queue, but I wonder how we can mobilise interest to get this module workable...?

rszrama’s picture

Please also review my spec. in #1274280: Coupon calculation workflow review.

pcambra’s picture

Hey Ryan, I have that in my mind, see #4 :), atm I'm rebuilding the menu structure that as it is now, it's not working at all, I'll create an issue for that one.

rszrama’s picture

Cool, I only just found out that you were added as a co-maintainer here, so let's try to sync up on it soon. It's a high priority module (as you've already determined, since you're workin' on it and all ; ), and I'd be happy to help out where needed.

pcambra’s picture

So after getting the entities right (despite alex opinion ;)), and fixing the menu system and a number of "minor" issues here and there I'm spending most of my time with this two issues:

#1372434: refactor "basic coupon" to "fixed coupon" and "variable coupon" -> I've moved batch coupon module to its own project: http://drupal.org/project/commerce_coupon_batch and I'm working in two sandboxes, one for fixed coupons and another for percentage coupons, I think we just need an upgrade path to commit all together and move to the next issue, which is "bigger".
#1274280: Coupon calculation workflow review -> I've committed what we had until the moment because it was actually more functional than the current code. Also I'm working in the fixed coupon and got some functional features when cart is refreshing. Feedback and testing is really really needed there.

We've got also other "collateral" issues here, such as #1475052: Refactor commerce_coupon_log entity, #1318392: Negative Order Total or #1475060: When a coupon has been applied to an order, don't allow to delete it which is not big itself but we may have many of the kind.

lathan’s picture

I have also done a bunch of work on the ajax side of things how ever I have only recently spotted this split.... Here is the ajax patch http://drupal.org/node/1329600 we just need to move the rules bits into their now split out modules. I assume that is the road map commerce_coupon + commerce_coupon_fixed_amount + commerce_coupon_pct sounds a little heavy having so many modules but meh not my issue.

I would just like to get an indication if my assumption of the split is correct so that I can adjust what I have been building this has come at a bad time for us as we were half out the door with this solution please give me a heads up on the direction.

thanks.

pcambra’s picture

The split was made on March so it's very recent.

commerce_coupon + commerce_coupon_fixed_amount + commerce_coupon_pct sounds a little heavy having so many modules but meh not my issue.

We needed to split the base coupon anyways, so I think it's better to have it in different projects, there could be many extra coupon modes and I want to foster that in separate projects instead of maintaining everything in here.

Adding ajax to the submit in the checkout is a great enhancement we should have, indeed. I need to fix other issues prior to test this, but It will get attention soon!

pcambra’s picture

The refactor into independent modules has been completed, we need a change in commerce though to make those really flexible, which is #1475118: Rules support for cart line item and order refresh

Until that lands, my priorities now are: #1431782: Fix uninstall issues & #1515860: Coupon admin line item add form fixed as they are bug reports that should not be happening before adding new stuff to the module.

pcambra’s picture

Just pushed a big change to fix the uninstall issues #1431782-4: Fix uninstall issues

Next stop is #1547440: Kill coupon log entity that blocks the admin line item add form.

Feedback is really welcome.

pcambra’s picture

Crossposting from #1547440: Kill coupon log entity

* Revamped all coupon log feature into a entity reference field in the order entity so we don't have log as a separate entity.
* Removed all coupon log traces.
* Removed coupon reference field in favor of entity reference.
* Provided a component name for price components as a property of the coupon entity.
* Fixed all rules accordingly.
* Moved coupon calculation logic from line_item_refresh to a rule that can be configured
* Provided rules for deleting coupons individually and in mass.
* Code cleaning.
* Probably more but can't remember.

Testing is really appreciated.

pcambra’s picture

RMani’s picture

How to add coupouns used in emails sent to customers ?

pcambra’s picture

Just for the information of everyone, there's a 2.x branch plan to link coupons with Commerce Discounts

DYdave’s picture

Hi guys,

I've checked the commerce_discount module and there's like a mention to the Commerce Coupon 2.x branch then I tried to check in this tracker if any mention was made to the 2.x branch.

I'm trying to implement quantity based discounts with steps (repeats discount after X QTY) and I'm still hesitating on going for a new entity type, like the one introduced in commerce_discount or simply sticking with commerce_coupon, implementing a specific coupon type for that, called discount.

With the latest important changes that took place in #15, I would like to anticipate as much as possible on the trends for future changes. Since there's always so many alternatives of achieving a particular requirement, I'm worried I could be drifting away from the new orientations of these modules.

Would anybody be able to explain what would be the ideas behind the 2.x branch?
Would anybody have any idea of when the 2.x branch could potentially be open?

Feel free to let me know however we could help with that, but I would greatly appreciate if you could give some hints of what is coming next in this module.
Thanks in advance.

jazzdrive3’s picture

I echo DYdave. Is there a plan for coupon 2.0? IS it in the works? Is there current sandbox code for it? I keep reading the reference to it, but have not seen anything yet. We are about to start implementing functionality that will allow coupons to apply to only categories, have buy 2 get one free functionality, etc. But I know that overlaps a lot with what commerce_discount is doing.

nigelw’s picture

Just checking in on the state of 2.x again. Pedro, can you give us an idea of the current state of 2.x and also the potential integration with the Commerce Discount module?

We have a couple of projects on the go right now that need coupons/discounts and I just want to see if we need to make do with 1.x or...?

nigelw’s picture

It's been a couple of weeks since my last post. If someone has 2 seconds to let me know if there is a 2.x nearing release or if I have to make due with the 1.x version of this module, I would appreciate it. We have a couple of projects that require discount/coupon functionality and I don't really want to have to rip it out of there is a 2.x on it's way.

It appears that the 1.x version of coupon and discount module (and related module i.e. fixed/percentage) seem to be duct tapped together to get what we need. The abstraction that drupal commerce provides is awesome, but one again sacrificing something usable out of the box.

In ubercart there are a few modules for discounts/coupons, but in just two module, a site can get the features listed below. To get this in commerce it becomes a mess of submodules, multiple entities and intertwined rules that sort of work together, but don't.

Discounts

  • Filter both products required for the discount to apply and qualifying products that receive the discount based on multiple products, taxonomy terms, node authors, or product classes.
  • The above filters allow for a discount like: buy 3 of any of X product and get a discount on any of Y product.
  • Attempts to automatically add free products to the cart for codeless discounts.
  • Discount # of products, a percentage or a fixed amount off.
  • Multiple codes or no codes: you can enter one or more codes for a discount or you can choose to make the discount work without a code.
  • Qualification based on quantity: choose the number of items required to qualify for a discount (e.g. buy 5 items to qualify).
  • Qualification based on subtotal: choose the currency amount required to qualify for a discount (e.g. $50 in items to qualify).
  • Cart preview, checkout preview and javascript callback on checkout page: you can get a discount quote on the checkout page just like shipping quotes.
  • Weight discounts and determine the order in which they are applied.
  • Choose which discounts can be combined and which can only applied by themselves.
  • Force qualification based on a single product: if you have a "buy 4 get one free" discount that applies to all of your products, you can insist that a customer buy 4 of the same product to qualify.
  • Filter discount application by user role and required product.
  • Conditional actions integration for things like Free Shipping.
  • Provides a CCK-based module for displaying codeless discount inside product pages (requires CCK).
  • Provides a CCK-based module for displaying discounted prices in the product page (with strike-through of the original price) (requires CCK).
  • Limit number of uses per discount and per user.
  • Usage reports.
  • Expiration and activation date.

Coupons

  • Coupons can apply either a fixed price discount or a percentage discount to the order subtotal or to selected product prices.
  • Coupons can be restricted to apply to specific products, product classes, SKUs, or taxonomy terms.
  • Coupons can also be configured so they only apply between certain dates, a fixed number of times, when a fixed order quantity or order subtotal is reached, to specified users or roles, or any combination of these.
  • Bulk coupon codes can be created, each of which is given a randomised code, which can be individually restricted and distributed to customers as necessary.
  • A new report is added to the Ubercart reports page, showing you which coupons were used on specific orders and the total discounts that were applied.

Just my two cents. Sorry, I don't mean to be critical. I love Drupal and I love commerce. The hard work that you have all put in is amazing. It just seems that everything I try to use in commerce results in a wall and it's frustrating to get so close to find out that the last 25% is unfinished in every feature of commerce. Switching back to ubercart would be undoing months and months of work.

pcambra’s picture

It's been a couple of weeks since my last post. If someone has 2 seconds to let me know if there is a 2.x nearing release

Hardly to answer your one page comment in 2 secs, but let's try to do my best :)

We're solving issues with Commerce itself to get the taxes calculation right when a discount is present #1825886: Add rules actions for applying discounts to prices with VAT included hopefully that will move forward pretty soon.
There's also a new module that will provide us a great way to add conditions too (inline conditions), that will be released some time soon at least as dev.

Once we have all that working and Discounts is a much more solid module, Coupon will add a layer on top of that, but there's none worked of this last part yet.

nigelw’s picture

Thank you for following up Pedro. I really appreciate. I totally understand that this stuff takes time to bake. Coupons and discounts are not trivial tassk. They need to interact with several areas of contrib to make it happen. So at this point, with the delivery of my clients's sites scheduled for the end of this month, I will need to make due with 1.x. No prob. I will make it work. Thanks again for your hard work.

vuzzbox’s picture

Hi Pedro,

I am following up on this with the same questions regarding the state of Commerce Coupon v2. Where does this project stand right now? Do you need help developing it?

I have just completed some custom work on the latest alpha release of Commerce Discounts module and I think I have a good understanding of its internals. I would be interested in taking that knowledge and applying it to version 2 of the Coupons module, if you are interested.

The organization for which I am developing the custom Commerce Discount work has offered to sponsor work on the Commerce Coupons 2.0 module, if it helps to meet their needs. Their greatest need right now is time: they need functional coupon handling by the end of August.

Please let me know either way.

Thanks,

Ed (vuzzbox)

vuzzbox’s picture

I needed to get coupons working with Commerce Discount, so I created a new module that extends that module to include coupons. The new module borrows heavily from Commerce Coupons.

Stuff it does:

  • "Product Coupon" discount type lets you create and manage discounts and coupons in one place, the Discounts UI
  • Leverages all the smarts available in Commerce Discounts for your coupons, including %off, fixed amount off coupons, date ranges, usage count, coupons by products, by product categories, and anything else you can do with inline conditions
  • Product Level Coupons (for a "5% off all red hats" coupon, for example)

Here's the project site:
https://drupal.org/sandbox/edmcl/2060935

And here's the git repo:
http://drupalcode.org/sandbox/edmcl/2060935.git

vuzzbox’s picture

(sorry about that tag...)

pcambra’s picture

@vuzzbox that's looking great, mind to create a new issue and provide a patch for starting the 2.x branch?

vuzzbox’s picture

Thanks, Pedro.

I didn't actually start with Commerce Coupon directly - I didn't want to start hacking away at a functional module. Instead, I created a new module and pulled parts of Commerce Coupon out as I needed them. So I don't think there's a diff that I could provide that would make any sense.

Not sure which way to go with it.

pcambra’s picture

I didn't actually start with Commerce Coupon directly - I didn't want to start hacking away at a functional module. Instead, I created a new module and pulled parts of Commerce Coupon out as I needed them. So I don't think there's a diff that I could provide that would make any sense.

I think that doesn't really matter, if you checkout Coupon 1.x from git and put yours (excluding .git folder) on top, you would be able to do a diff to start with, I'd really like to review the changes and push the 2.x branch right away from your code so we can move it forward :)

vuzzbox’s picture

Can do.

pcambra’s picture

Status: Active » Fixed

Closing this in favor of #2090057: Proposed 2.x branch, that seems the closest approach we have to a 2.x branch.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.