Magento:报价项目和报价地址项目之间的概念区别是什么?
受到另一个问题的启发我最近在 SO 上看到,我想看看是否有人可以解释报价项目(Mage_Sales_Model_Quote_Item)和报价地址项目(Mage_Sales_Model_Quote_Address_Item)之间的区别?
我想我理解报价项目的概念(Mage_Sales_Model_Quote_Item - 映射到 sales_flat_quote_item 数据库表) - 基本上是客户购物车中的一个行项目,其中包括产品的名称/sku、数量和任何特殊选项。我不明白的是报价地址项 Mage_Sales_Model_Quote_Address_Item - 映射到 sales_flat_quote_address_item 数据库表)的用途。我看到它有一个与之关联的地址,但这到底是做什么用的呢?我可以想象它可能与多地址运输(我从未使用过)有关,但这是一个疯狂的猜测。
作为第二个问题(实际上是这个问题的全部原因:/),是否有处理报价项目的自定义模块可以安全地忽略报价地址项目的情况?
Inspired by another question I saw recently on SO, I wanted to see if anyone could explain the difference between a Quote Item (Mage_Sales_Model_Quote_Item) and a Quote Address Item (Mage_Sales_Model_Quote_Address_Item)?
I think I understand the concept of a Quote Item (Mage_Sales_Model_Quote_Item - mapped to sales_flat_quote_item db table) - basically a line item in the customer's cart which includes the name/sku of the product, quantity, and any special options. What I don't understand is what the Quote Address Item Mage_Sales_Model_Quote_Address_Item - mapped to sales_flat_quote_address_item db table) is for. I see that it has an address associated to it, but what the heck is that for? I can imagine that it might have something to do with multi-address shipping (which I have never used) but that is a wild guess.
As a secondary question (actually the whole reason for this question :/), are there any cases where a custom module dealing with Quote Items could safely ignore the Quote Address Item?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我以前处理过这个问题。
基本上报价项目正如您所描述的那样。它代表购物车中的一个订单项及其所有详细信息。
至于报价地址项,它只是一个对象,其中包含对报价项对象的引用、对地址对象的引用以及要运送到该特定地址的报价项的子集数量(但随后它们毫无用处地复制从报价项目到它的所有内容)。
在多重发货结帐的情况下,报价地址项目用于创建多个 Magento 订单对象(每个订单就好像它与报价项目的子集是分开的)。
当然,这是一个笨拙的设计。如果他们只保留报价项数据并添加地址 ID 字段并完全消除“报价地址项”概念,那就更好了。看起来像是过度正常化却给他们带来了适得其反的情况。
如果只处理单页结帐(并且禁用多发货),想要扰乱购物车的代码可以安全地忽略报价地址项目。
如果您还想让更改在多重运输结帐中正确显示,您还必须弄乱报价地址项(并且这些区域中的代码非常难看)。
I've dealt with this before.
Basically the quote item is as you described it. It represents a line item in the cart with all of its details.
As for the quote address item, it is just an object that contains a reference to the quote item object, a reference to a address object and the subset quantity out of the quote item that is to be shipped to this particular address (but then they duplicate everything from the quote item to it uselessly).
In case of multishipping checkout, it is the quote address items that are used to create several Magento Order objects (each order as if it were separate with a subset of the quote items).
Of course, this is a clunky design. It would have been better if they just kept the quote item data and added an address id field and eliminated the "quote address item" concept entirely. Looks like a case of excessive normalization that backfired on them.
Code that wants to mess with the cart can safely ignore quote address items in case of dealing only with onepage checkout (and multishipping is disabled).
If you want to also have the changes appear correctly in multishipping checkout, you have to also mess with quote address items (and the code in these areas is quite ugly).
它与“运送到多个地址”相关,因为每个项目都需要映射到单独的地址
Its related to "ship to multiple addresses" as each item needs to be mapped to separate address