I want to be able to clear a custom column like this as soon as I login and I find that a particular SKU is in the cart.:
$quote -> setcolumn('');
How can I achieve this?
Try creating an observer for customer_login
In config.xml
.....
<customer_login>
<observers>
<yourobservername>
<type>model</type>
<class>yourmodule/path_to_class</class>
<method>customerLogin</method>
</yourobservername>
</observers>
</customer_login>
In Observer.php
class YourCompany_YourModule_Model_Observer
{
public function customerLogin($observer)
{
//$customer = $observer->getCustomer();
$updateCart = false
$quote = Mage::getSingleton('checkout/session')->getQuote();
$cartItems = $quote->getAllVisibleItems();
foreach ($cartItems as $item) {
if($sku == $item->getSku()){
$item->setcolumn('');
$updateCart = true;
}
}
if(updateCart){
$quote$quote->getCart()->save();
}
}
}
Try this.
$_NULL = new Zend_Db_Expr("NULL");
$quote -> setcolumn($_NULL);