Hi. I had a need to enable scheduled sales by product, and used your module as a base. What I've done is add two fields to the feature, sale_start_date and sale_end_date. Outside (at this point) of the module, in another, I hook cron and, if there are dates and the current date is within them, I set the check box, and if the current date is outside the current date and the check box is set, I clear it. I leave the check box alone if there are no dates (in case the user wants to control the sale event manually).
It would be better, of course, if this became part of the module. It this functionality you'd like? If so, I'll move the cron logic into your module and create a patch.
Comments
Comment #1
AndyF CreditAttribution: AndyF commentedHi,
I think it would make a good submodule (I don't want to force people to have start and end fields defined if they don't need them). However I think it's more flexible and accurate to use a Rule for the logic rather than the cron run. You could use hook_default_rules_configuration_alter() to add conditions to the Rules component
rules_commerce_saleprice_component
. The conditions will get a little hairy I think: I guess we'd be looking for the following behaviour.I believe this is all doable with Rules, but as I say the conditions will probably end up being a bit complex: I imagine it would make sense to refactor them using condition sets.
Thoughts?
Comment #2
AndyF CreditAttribution: AndyF commentedAh, but it occurs to me this can't be made compatible with Commerce's precalculated price system, which is a serious drawback (eg. you can't sort products by their price). So it's probably better to go back to your original idea! I'd certainly accept a patch, thanks!
Comment #3
AndyF CreditAttribution: AndyF commentedI'd like to get around to adding this, but don't have time just yet.
Comment #4
j. ayen green CreditAttribution: j. ayen green commentedNo problem. I've been waiting for testing with the client to complete before I submit the code.
Comment #5
Summit CreditAttribution: Summit commentedHi, any news on this please!
Greetings, Martijn
Comment #6
Horroshow CreditAttribution: Horroshow commentedI would interested in that too.
Comment #7
j. ayen green CreditAttribution: j. ayen green commentedThe client ended up not needing/wanting the feature implemented, but I would be happy to take a look at working on it anyway. It's been awhile since I first brought it up...is it something that still makes sense?
Comment #8
AndyF CreditAttribution: AndyF commentedYes please! (As well as the interest shown above, I've also heard it asked for on Drupal Answers.)
Thanks
Comment #9
Horroshow CreditAttribution: Horroshow commented> is it something that still makes sense?
Yes please! :-)
Comment #10
j. ayen green CreditAttribution: j. ayen green commentedOk, starting to work on it
Comment #11
Horroshow CreditAttribution: Horroshow commentedHi, any progress? Many thanks for your time on this module. It would be great to have this feature.
Comment #12
izarco CreditAttribution: izarco commentedHi, any progress?
Thanks in advance.
Comment #13
Horroshow CreditAttribution: Horroshow commentedWould be great if working with the Date module.
Comment #14
AndyF CreditAttribution: AndyF commentedMarking as closed, but will happily reopen if someone makes some progress!