以编程方式在Magento管理员中添加产品到销售报价
-
12-12-2019 - |
题
我已经定制了搜索产品网格,因为客户需要(创建的新网格和禁用的搜索网格)
我在“订购了”块的项目中成功创建了新网格。
当我点击“添加产品”到Item“的”我的自定义网格的项目“按钮时,我在Custom Controller文件中获得了所选产品的产品ID和数量。
我试图添加那些产品来报价,没有任何改变。i dunno,如何在“订购” block中的“项目下,从我的自定义网格中添加这些所选产品。
我尝试过以下代码来添加产品以引用。
.
$customer_id = 26; // set this to the ID of the customer.
$customerObj = Mage::getModel('customer/customer')->load($customer_id);
$quoteObj=Mage::getModel('sales/quote')->assignCustomer($customerObj);
$quoteObj = $quoteObj->setStoreId(Mage::app()->getStore()->getId());
$productModel=Mage::getModel('catalog/product');
$productObj = $productModel->load($_id);
$quoteItem = Mage::getModel('sales/quote_item')->setProduct($productObj);
$quoteItem->setQty($qty);
$quoteObj->addItem($quoteItem);
$quoteObj->collectTotals();
$quoteObj->save();
我不确定,那个包含报价产品的块或
有任何想法,如何将选定的产品添加到“订购的”块中的项目“在销售订单中创建页面。
热切期待您的回复!
解决方案
我在长时间发现了解决方案。
刚刚通过产品数组到ProductionGridAddSelected()方法,如下所示
order.productGridAddSelected(products);
产品阵列必须像
产品[product_id]=数量;