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条)

报告相同问题?

悬赏问题

  • ¥20 ue5运行的通道视频都会有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 Revit2020下载问题
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 单片机无法进入HAL_TIM_PWM_PulseFinishedCallback回调函数