dongshi1207 2010-10-08 00:31
浏览 70
已采纳

Magento自定义订单属性/字段? 在脚下射击自己? [关闭]

I'm building a Magento store using a single catalog over 4 domains: 1 for the US and 3 for Europe (UK, French, and German). There's 1 fulfillment warehouse in Europe, 1 in the US and a sort of unofficial/internal "warehouse" in the US where giveaways and such are fulfilled, and we are not tracking inventory levels in Magento. We need to track particular transaction types like plain web sales along with internal/admin orders like non web sales, giveaways, trade show orders, etc. My plan is to extend the core order model and adding some kind of "order/transaction type" field and then, upon the placement of an order, process the order data and direct which warehouse it is sent off to for fulfillment based on the store id and the 'order type' value.

Being new to Magento, I want to know if this kind of setup is a bad idea for any reason. Am I shooting myself in the foot? Is there any reason a single catalog might be problematic? Is there an easier or better way of handling this flow? Is there a way to add custom attributes to orders like you can to products?

  • 写回答

2条回答 默认 最新

  • du532861657 2010-10-08 01:25
    关注

    You're heading in the right direction, but (as with most things Magento), there are a couple of options. The most important principle here is that the architecture of the modifications must not lead to the situation where upgrades/patches on the core are compromised. What's interesting about that is that Magento has moved away from the highly extensible and upgrade-safe (mostly) EAV model for Mage_Sales_Model_Order (and related objects) in the current release. That makes it more difficult to add attributes in a upgrade-safe manner, IMHO.

    I would recommend that you use the Observer system to add your new attribute values, but into a related Model. That is, rather than adding the attribute into the Order model itself, create a model that holds an order_id and your custom attributes. Hook into the appropriate event (probably sales_convert_quote_to_order for all Orders or checkout_type_onepage_save_order_after for frontend orders) and examine the Quote Items to set the values in your custom Model. When you execute your process to transmit orders to the fulfilment house, you can lookup the custom attributes via the order_id.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 关于#java#的问题,请各位专家解答!
  • ¥15 急matlab编程仿真二阶震荡系统
  • ¥20 TEC-9的数据通路实验
  • ¥15 ue5 .3之前好好的现在只要是激活关卡就会崩溃
  • ¥50 MATLAB实现圆柱体容器内球形颗粒堆积
  • ¥15 python如何将动态的多个子列表,拼接后进行集合的交集
  • ¥20 vitis-ai量化基于pytorch框架下的yolov5模型
  • ¥15 如何实现H5在QQ平台上的二次分享卡片效果?
  • ¥30 求解达问题(有红包)
  • ¥15 请解包一个pak文件