Reputation: 1
First post on stack overflow! Here we go…
OK, so I have Magento community edition v1.5.1.0 setup on my server and have a single product all ready to go. The product has a date attribute which is the date the customer would like the product delivered. The product is an item that I make when a customer orders it. There are only so many of this product that I can physically make a day. So my question is, how do I keep track of the total orders that have been set for delivery on a certain date and disable that date from being selected on the front end when the cap has been met.
I've tried looking for plugins but haven't found anything that suits this situation yet. Any advice/pointers would be great.
I'm quite happy to start prodding at the internal code if need be. Just wanted to make sure I wasn't missing an easy option before diving in!
Thanks in advance
Justyn
Upvotes: 0
Views: 725
Reputation: 633
Yes this is quite an unusual module and I can understand why there is no pre made plugin yet.
First of all - don't prod the internal code!!! You must extend the platform by writing a custom module, otherwise your application will not be future proof.
Here is a quick plan of attack to show you some Magento techniques for achieving your aim.
Add an attribute to the products which you wish to have this constraint apply to, "delivery_date_capacity"
Create a custom module which listens for orders and stores a record of product and date to be delivered, as well as the threshold orders per delivery day, which is fired when product has the identifying attribute in( "delivery_date_capacity" ).
Depending on the user experience you require, (when the daily threshold is met), when customer clicks "Add to Cart" the module could redirect with a message saying this delivery date is not available, and suggest ones which are close to it before and after.
You may wish to add reverse functionality to automatically add capacity if orders are cancelled. Add an observer which is fired when a product is loaded in the admin which checks if the product availability should be checked again by referencing "delivery_date_capacity" attribute, when an order is cancelled.
You could also load a calendar which show the available dates to reduce the click rate of user, especially if you anticipate suggested dates not being easy for a customer to choose.
Upvotes: 1