2014-11-25 71 views
0

我已根據客戶需求定製搜索產品網格已創建新網格並禁用搜索網格)在銷售訂單創建頁面下。以編程方式在magento admin中添加產品到銷售報價

我在「Items Ordered」塊之後成功創建了新的網格。

當我點擊「添加產品到項目」我的自定義網格的按鈕,我在我的自定義控制器文件中獲得了所選產品的產品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(); 

我不知道,含報價的產品,否則

該塊有什麼想法,如何選擇產品添加到「項目有序」塊銷售訂單創建頁面。

熱切期待您的回覆!

回答

0

長途狩獵後我找到了解決方案。

剛過產品陣列productGridAddSelected()方法如下面

order.productGridAddSelected(products);

產品陣列必須像

產品[PRODUCT_ID] =量;

相關問題