1

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?

2

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

    }
}

See Magento - remove one quantity from cart

| improve this answer | |
0

Try this.

$_NULL = new Zend_Db_Expr("NULL");
$quote -> setcolumn($_NULL);
| improve this answer | |
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – brentwpeterson Feb 12 '15 at 4:29
  • What are you supposed to do with this answer? And who ever down voted, can I know the reason? – Sukeshini Feb 12 '15 at 10:53

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.