As of May 31, 2023, we have updated our Code of Conduct.
7 votes
Accepted

I want to set custom price programmatically to the product Magento 2

Try the following code to update price foreach ($products_array as $value) { $params['qty'] = 1;//product quantity $_product = $this->productRepository->getById($value); ...
Priyank's user avatar
  • 7,582
5 votes
Accepted

Why is there a base_row_total variable in Quote and Order models?

Magento has the ability to calculate currencies based on a conversion rate from store to store. Your base store may be in USD, but you also sell in the UK so you accept GBP. The base_row_total is ...
philwinkle's user avatar
  • 35.7k
5 votes

I want to set custom price programmatically to the product Magento 2

You can achieve this with the observer. First create events.xml file in folder ‘test/Hello/etc/frontend’ and use event ‘checkout_cart_product_add_after’. <?xml version="1.0"?> <config xmlns:...
Prakash Patel's user avatar
4 votes

When Quote id generated in magento?

The quote id is generated when a product is added to cart. Here's the workflow: app/code/core/Magento/Checkout/controllers/CartController.php => addAction() method $cart = $this->_getCart(); .....
Raphael at Digital Pianism's user avatar
4 votes
Accepted

Getting Value of product attribute on cart page even not assigned to that particular product Magento 2

Becuase you use same object every time in foreach. YOu need to create new object in foreach loop. So you final code look like this: $objectManager = \Magento\Framework\App\ObjectManager::getInstance()...
Prince Patel's user avatar
  • 22.4k
3 votes
Accepted

convert quote to order for guest users

Try following way: $quoteObj = Mage::getModel('sales/quote')->load(706); $items = $quoteObj->getAllItems(); $quoteObj->reserveOrderId(); //print_r($items); $addressData = array( 'firstname' => '...
Sohel Rana's user avatar
  • 35.2k
3 votes

Create Duplicate quote item instead of updating existing quote item for same product

To change what's getting added to the cart you need to observe an event before the quote item is created. This way you can choose to update the qty of an existing item, add one or more new items, or ...
Fabian Schmengler's user avatar
3 votes
Accepted

Get Quote ID from an Order ID or Order Number SQL?

There are only one relation between Magento quote item tables & sales order tables and that is sales_flat_order.quote_id=sales_flat_quote_item.quote_id. In magento,...
Amit Bera's user avatar
  • 76.7k
3 votes
Accepted

Get quotes (active and inactive) for a customer

$quote_collection = Mage::getResourceModel('sales/quote_collection') ->addFieldToSelect('entity_id') ->addFieldToSelect('subtotal') ->addFieldToFilter('customer_id', 5)...
eetzen's user avatar
  • 479
2 votes
Accepted

Magento programatically convert quote to order - orders missing in backend

Ok, I figured this out myself. The not registered order in Magento Backend even if PayPal captured the payment was due to an extension that returned an error after redirection to success page. If ...
MMScreenX's user avatar
  • 131
2 votes
Accepted

save custom field from sales_flat_order_item to sales_flat_order

You'll need to decide whether you want that information at the entire order level or at the order line-item level. Both these tables, sales_flat_order_item and sales_flat_order, serve different ...
Prateek's user avatar
  • 1,949
2 votes

Programmatically assign customer to a quote

A quote is actually a 'cart' object. A customer can have many quotes. One for each website. the quote object is not created when the customer is created. It is created when the customer adds the first ...
Denish Vachhani's user avatar
2 votes

How to change product name in quote item dynamically

Take a look at Magento change product name adding to cart Use event sales_quote_item_set_product class Mynamespace_Samples_Model_Observer { public function salesQuoteItemSetProduct(...
MagePal Extensions's user avatar
2 votes

Change registered customer biliing email address on the time of checkout

$quote->getCustomer() retrieved the customer model. The email address for the order / quote is stored in the billing address object and in the quote object. $quote->getBillingAddress()->...
Sander Mangel's user avatar
  • 37.5k
2 votes
Accepted

get product id from quote id - Magento 1.9

Use below code $quoteId=784; $quote = Mage::getModel('sales/quote')->load($quoteId); $cartItems = $quote->getAllVisibleItems(); foreach ($cartItems as $item) { $productId = $item->...
Prashant Valanda's user avatar
2 votes

Remove SalesRule from Quote Magento 1.x

I figured it out myself although I am not sure how efficient this answer is. As previously mentioned the code is executing in the salesrule_validator_process this event pass following data with ...
Capri82's user avatar
  • 213
2 votes

Update "sales_flat_order_item" table when making an order

Managed to get last item id with this solution. I know, it isn't the most efficient way but still public function orderPlaceAfter($observer) { $order = $observer->getEvent()->getOrder(); ...
Sergiu Turus's user avatar
2 votes
Accepted

Magento 1: Check if customer has quote

You can filter that table with its corresponding collection model: $quote = Mage::getResourceModel('sales/quote_collection') ->addAttributeToFilter('customer_id', $customer->getId()) ...
EssGee's user avatar
  • 339
2 votes
Accepted

Show value of all totals in controller action

This should work: $quote = Mage::getModel('checkout/session')->getQuote(); $address = $quote->getShippingAddress(); $quoteData = $quote->getData(); //getData() is not necessary, you could ...
hardik's user avatar
  • 496
2 votes

Getting Value of product attribute on cart page even not assigned to that particular product Magento 2

Please Try something like this .... function productData($pro_id) { $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $product_object = $objectManager->create(...
Divyarajsinh Dodiya's user avatar
1 vote
Accepted

Magento 1: when is the email added to the quote?

Email address is added to the quote in conjunction with the billing address. On standard checkout, this is step 1 (or 2, after login/register) of the checkout process. If a customer completes that ...
Ryan Hoerr's user avatar
  • 12.1k
1 vote

Magento 2 saving custom attribute to sales_order_items

You need to create custom order attribute for it. And then programmatically assign value for it. You can follow given thread to create order attribute. Magento 2 How to create new order attribute ...
Kishan Patadia's user avatar
1 vote
Accepted

Get quote data(Shipping zip code) from observer magento 2

First of all, you can not get order object $order from this observer. This observer only able to give u Quote Object mean Cart object $this->eventManager->dispatch( '...
Amit Bera's user avatar
  • 76.7k
1 vote

How to add new input field in cart page in magento2?

You have bellow a more links for new custom field in cart page. How To Add Additional Options In Magento 2 Cart How do I add a custom field to the cart in magento 2?
St3phan's user avatar
  • 2,847
1 vote

Magento2 Split Order Based on Vendor

First, You should not use the ObjectManager $product = $objectManager->get('Magento\Catalog\Model\Product')->load($product_id); directly! https://magento.stackexchange.com/a/117103/69 Also, it ...
B00MER's user avatar
  • 8,287
1 vote

Magento model not fetching data

I dont know why you use method2 b'cuz method 1 is right $quote_address = Mage::getModel('sales/quote_address')->getCollection(); $quote_address->addFieldToFilter("address_type", array("eq" =&...
Murtuza Zabuawala's user avatar
1 vote
Accepted

Remove item from Quote item - Magento1.9

try below code because save method doesnot work with collection $quote = Mage::getModel('sales/quote')->load(quote_id); // get item id by your logic $quote->removeItem($itemId); $quote->...
Murtuza Zabuawala's user avatar
1 vote

Magento 1.9 Not able to create quote item

to find if particular product is in quote if (! $quote->hasProductId($product_id)) { // Product is not in quote so add your logic } else { $item = $quote->getItemByProduct($product_id); ...
Gopal Patel's user avatar
  • 3,109
1 vote

get cart items from custom column value

You can try the below code: $deviceId=802; $collection = Mage::getModel('sales/quote_item')->setStoreId(1)->getCollection()->addFieldToFilter('device_id', array('eq' => $deviceId)); ...
Prasanta Hatui's user avatar
1 vote

get cart items from custom column value

you can do, try below code tested by me $deviceId=802; //if your value in ales_flat_quote table $quote = Mage::getModel('sales/quote')->load($deviceId,'device_id');//here device_id is feild in ...
Murtuza Zabuawala's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible