concretecms-community-store / community_store

An open, free and community developed eCommerce system for Concrete CMS
https://concretecms-community-store.github.io/community_store/
MIT License
106 stars 66 forks source link

Add "Sales Suspension" feature #782

Closed mlocati closed 1 year ago

mlocati commented 1 year ago

Close #781

Mesuva commented 1 year ago

I've merged this and I'm having a look.

I really like this idea, the only pause I have is that there already is a similar (but simpler) feature under 'Cart and Checkout', where you can put it into 'Catalog Mode'.

They serve slightly different purposes though (and yours is much more featured), so I'm just thinking through whether the features should be combined

mlocati commented 1 year ago

Yep, they both turn off selling items. Here's what we can do:

  1. in the upgrade method, check if we are upgrading from a version older than the one that introduces this new feature: in this case, set the community_store.salesSuspension.suspend configuration key to the value of community_store.shoppingDisabled
  2. remove the select that contains "Disabled (Catalog Mode)" in the "Cart and Checkout" section
  3. in the new "Sales Suspension", we can:
    1. change the select, so that it presents these options:
      • Sales are active (pre-selected if community_store.salesSuspension.suspend is false)
      • Sales are disabled (catalog mode) (pre-selected if community_store.salesSuspension.suspend is true and start/end dates are both null)
      • Sales are temporarily disabled (pre-selected otherwise)
    2. if the first or the second option are selected, we don't display the date/time pickers for start/end dates
    3. when saving: community_store.salesSuspension.suspend is false if the first option is selected, true otherwise
mlocati commented 1 year ago

If that's ok for you, I can of course submit a PR with these changes

Mesuva commented 1 year ago

Of course, all your help here is immensely appreciated.

I agree with the approach you've outlined.

mlocati commented 1 year ago

And here's the PR: #793