Satchmo:指定订单的交货日期/发货日期
我使用 Satchmo 开发电子商务网站。然而,我的商店几乎不需要定制。
- 在订购产品时,我应该能够指定交货日期(发货日期)。
- 一种产品每天只能进行 20 (max_num_delievries) 次交付。如果特定产品的特定日期的交付数量超过“max_num_delievries”,则用户在订购产品时不应选择该日期。
有人可以帮忙并指导我如何使用 Satchmo 实现这一目标吗?
提前致谢..
I working on e-commerce website using Satchmo. However, there are few customization required for my store.
- While ordering a product I should be able to specify a delivery date (shipping date).
- There can be only 20 (max_num_delievries) deliveries possible per day for a product. If number of deliveries for a particular date for a particular product exceeds 'max_num_delievries', user should not be able to select that date while ordering the product.
Can someone please help in this and guide me how to achieve this using Satchmo?
Thanks in advance..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我会尝试这样的事情:
1)使用“DeliveryDate”等模型创建一个本地应用程序(例如delivery_date)。例如 localsite/delivery_date/models.py:
2) 验证最多 20 个现有订单...嗯,好问题,也许最好的办法是在表单上进行?覆盖 clean 方法并检查此交货日期是否已与 20 个订单相关联...可能类似于 localsite/delivery_date/forms.py
...但表单可能不是执行此操作的最佳位置。
您可能还想隐藏并自动设置产品和订单的初始值,并且用户只需选择一个日期。
3)关于satchmo...我将在产品添加到购物车后使用信号进行反应(仅针对这种情况有一个信号),并添加一个侦听器,将用户重定向到可以选择日期的视图对于这个产品。查看此处带有信号“cart_add_view”的示例: http://www.facebook.com /note.php?note_id=101466134049
也许 ajax 在这里是一个不错的选择。页面中存在一个隐藏容器...将产品添加到购物车后会显示(仅当产品还没有与此订单/产品关联的 DeliveryDate 时),并要求用户选择日期。
整个内容将在侦听器上:检查产品是否需要交货日期,如果是,则发送 ajax 响应以弹出窗口,并将表单放入响应上下文中,并隐藏初始产品和订单字段。
为了保存交货日期,您将需要另一个 ajax-view。
好吧,这只是我如何尝试做到这一点的一个想法;-) 当然,它可能需要在这里或那里进行调整。但希望它能进一步帮助您。
问候,
安德里亚
I would try something like this:
1) create a local app (eg. delivery_date) with a model like "DeliveryDate" or so. For example localsite/delivery_date/models.py:
2) the validation of the max 20 existing orders... mhh, good question, maybe the best would be, to do it on the form? Override the clean method and check if this delivery date is associated with 20 orders already... maybe something like localsite/delivery_date/forms.py
... but maybe the form isn't the best place to do this.
You also probably want to hide and auto-set the initial values for product and order yourself, and the user only being supposed to select a date.
3) Regarding satchmo... I would use signals to react after a product has been added to the cart (there is a signal just for this case), and add a listener which redirects the user to a view where he can select the date for this product. Look at the example here with the signal "cart_add_view": http://www.facebook.com/note.php?note_id=101466134049
Maybe ajax would be a good option here. With a hidden container in your page... which shows up after adding a product to the cart (only if the product hasn't already a DeliveryDate associated to this order/product), and asking the user to select a date.
This whole stuff would be on the listener: check if the product needs a delivery date, and if yes, send an ajax response to pop-up the window, and put in the repsonse-context the form, with the initial product and order hidden fields.
And to save the delivery-date you will need another ajax-view.
Well it's merely an idea how I would try to do it ;-) It will probably need adjustments here and there, of course. But hopefully it helps you further.
Regards,
Andrea