我已经根据客户需求自定义了搜索产品网格(创建新网格和禁用的搜索网格)在销售订单创建页面下。
我在"订购的项目"块之后成功创建新网格。
当我单击自定义网格的"将产品添加到项目"按钮时,我在自定义控制器文件中获得了所选产品的产品 ID 和数量。
我试图添加这些产品来报价,没有任何变化。我不知道,如何从"订购的项目"块下的自定义网格中添加这些选定的产品。
我尝试使用以下代码将产品添加到报价中。
$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();
我不确定,该块包含报价产品或其他
有任何想法,如何将所选产品添加到销售订单创建页面中的"订购项目"块。
热切期待您的回复!
经过长时间的狩猎,我找到了解决方案。
刚刚将产品数组传递给 productGridAddSelected() 方法,如下所示
order.productGridAddSelected(products);
产品阵列必须类似
产品[product_id]= 数量;