2022 Developer Survey is open! Take survey.
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); ...
user avatar
  • 7,332
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 ...
user avatar
  • 35.6k
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:...
user avatar
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' => '...
user avatar
  • 34.1k
3 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(); .....
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,...
user avatar
  • 75.5k
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 ...
user avatar
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)...
user avatar
  • 479
3 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()...
user avatar
  • 21.5k
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 ...
user avatar
  • 131
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()->...
user avatar
  • 37.4k
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 ...
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 ...
user avatar
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->...
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(...
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 ...
user avatar
  • 113
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(); ...
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()) ...
user avatar
  • 341
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 ...
user avatar
  • 486
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(...
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 ...
user avatar
  • 11.9k
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( '...
user avatar
  • 75.5k
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?
user avatar
  • 2,757
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 ...
user avatar
  • 8,279
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" =&...
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->...
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); ...
user avatar
  • 3,099
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)); ...
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 ...
user avatar
1 vote

How to add quote Item id as new field?

I have a solution here for Magento 2. I am sharing this for basic Idea. You can create an observer in 1.9 for sales_model_service_quote_submit_after in your XML file. <events> <...
user avatar

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