2

I have customized search product grid as per client need (created new grid and disabled search grid) under sales order create page.

I have created new grid successfully after "Items Ordered" block.

When i click "Add product(s) To Item" button of my custom grid, I got product id and quantity of that selected product in my custom controller file.

I have tried to add those products to quote, Nothing has been changed. I dunno, how to add these selected products from my custom grid under "Items Ordered" block.

I have tried following code to add products to quote.

 $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();

I'm not sure, That block containing quote products or else

Have any idea, How to add selected products to "Items Ordered" block in sales order create page.

Eagerly awaiting for your response!

2

I have found the solution after long hunt.

Just passed products array to productGridAddSelected() method like below

order.productGridAddSelected(products);

products array must be like

products[product_id]= quantity;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.