In Magento 1.x I have created following function in Namespace/Modulename/Model/Observer.php public function salesQuoteItemSetCustomAttribute($observer){ $quoteItem = $observer->getQuoteItem(); $product = $observer->getProduct(); $quoteItem->setCustomerProductPoints($product->getCustomerProductPoints()); } Called this function in Namespace/Modulename/etc/config.xml <sales_quote_item_set_product> <observers> <product_point_quote> <class>productpoint/observer</class> <method>salesQuoteItemSetCustomAttribute</method> </product_point_quote> </observers> </sales_quote_item_set_product> Also Have converted my custom attribute...
Month: June 2016
magento objectManager command (Memeroy)
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $customer_object = $objectManager->create('Magento\Customer\Model\Customer');
Magenot 2 customer custom attribute not add in frontend but can add in admin (resolved)
You must use customer factory and updateDate to update the custom value $customer = $this->customerFactory->create(); $customerData = $this->customer->getDataModel(); $customerData->setCustomAttribute('cuser_id', 'testnew1235'); $customer->updateData($customerData); $customer->setData('email',"abcd123t@gmail.com"); $customer->setFirstname("First Nametestdfdf"); $customer->setLastname("Last namesdfadsf"); $customer->setPassword("test1123"); $customer->save();
Magento force update Quote totals
You can add custom calcule in total module but it can't recalcul when you not force recalcul in certain step so you can use => to force reload total $this->_objectManager->get('\Magento\Checkout\Model\Session')->setCartWasUpdated(false)->loadCustomerQuote();