简体   繁体   English

Magento:同一项目,报价/订单价格不同

[英]Magento: Same item, different prices in quote/order

I would like to create an order in magento with the same product, added twice to the cart, but with different prices. 我想用相同的产品在magento中创建一个订单,将其添加到购物车两次,但价格不同。 For example; 例如;

3 pcs of product A @ 0 USD
12 pcs of product A @ 15 USD
10 pcs of product B @ 15 USD,

etc. 等等

But, (when using Adminhtml_Model_Sales_Order_Create), if I first add the "free" products, they are overwritten the second 12 products. 但是,(当使用Adminhtml_Model_Sales_Order_Create时),如果我先添加“免费”产品,则它们将覆盖后12个产品。

Is it possible to add the same SKU to an order twice? 是否可以将同一SKU两次添加到订单中? If so, how? 如果是这样,怎么办?

Cheers, MO 密苏里州的干杯

You can also add custom options dynamically, without storing them permanently in the products, that they will be only used in the quote item: 您还可以动态添加自定义选项,而不必将其永久存储在产品中,因为它们只会在报价项目中使用:

// load the products
$a = Mage::getModel('catalog/product')->load('A');
$b = Mage::getModel('catalog/product')->load('B');

// add the default products
$quote->addProduct($a, 12);
$quote->addProduct($b, 10);

// customize the product a 
$a->addCustomOption('code', serialize('value'));
// add the customized product
$item = $quote->addProduct($a, 3);
// customize the price
$item->setCustomPrice(0);
$item->setOriginalCustomPrice(0);
$item->getProduct()->setIsSuperMode(true);
// set a custom message
$item->setMessage('This is a gift!');

Add and extra product option and make sure you have different option value for your different price types. 添加和额外的产品期权,并确保您为不同的价格类型拥有不同的期权价值。 Then it will show those products seperately. 然后它将分别显示这些产品。

You can add product options from you magento backend, Manage Products and in Custom options tab. 您可以从magento后端,“管理产品”以及“自定义选项”标签中添加产品选项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM