0
votes

I believe I have a config issue with the code below, module is activated but observer is not being fired on event. Can anyone spot the issue?

app/etc/modules/James_CoreProductCheck.xml

<?xml version="1.0"?>
<config>
<modules>
    <James_CoreProductCheck>
        <active>true</active>
        <codePool>local</codePool>
    </James_CoreProductCheck>
</modules>
</config>

app/code/local/James/CoreProductCheck/etc/config.xml

<?xml version="1.0"?>
<config>
 <modules>
   <James_CoreProductCheck>
     <version>0.0.1</version>
   </James_CoreProductCheck>
 </modules>
<global>
<models>
  <james_coreproductcheck>
    <class>James_CoreProductCheck_Model</class>
  </james_coreproductcheck>
</models>
  <events>
    <checkout_cart_product_add_after>
      <observers>
        <james_coreproduct_check_model_observer>
          <type>singleton</type>
          <class>James_CoreProductCheck_Model_Observer</class>
          <method>check</method>
        </james_coreproduct_check_model_observer>
      </observers>
    </checkout_cart_product_add_after>
  </events>
</global>
</config>

app/code/local/James/CoreProductCheck/Model/Observer.php

class James_CoreProductCheck_Model_Observer {

   public function check(Varien_Event_Observer $observer) {

      Mage::log('Yet another product added', null, 'product-updates.log');

 }
}
2
1. Check other extension using the same obsever 2. Clear CacheAnurag Prashant
This seem like a cache issue. Please try to flush your cache storage and trySaurabh

2 Answers

1
votes

try this one.

     <events>
        <checkout_cart_product_add_after>
            <observers>
                <sales_quote_add_item>
                    <class>James_CoreProductCheck_Model_Observer</class>
                    <method>check</method>
                </sales_quote_add_item>
            </observers>
        </checkout_cart_product_add_after>  
    </events>

Make sure you clear cache. Thanks :)

0
votes

Try Different Module name instead of CoreProductCheck.

so your code will look like following and it will work perfectly.

app/code/local/James/Prodcheck/etc/config.xml

<?xml version="1.0"?>
<config>
  <modules>
    <James_Prodcheck>
      <version>1.0.0</version>
    </James_Prodcheck>
  </modules>
  <global>
       <events>
      <checkout_cart_product_add_after> 
        <observers>
          <checkout_cart_product_add_after> 
            <type>singleton</type> 
            <class>prodcheck/observer</class> 
            <method>check</method>  
            <args></args> 
          </checkout_cart_product_add_after>
        </observers>
      </checkout_cart_product_add_after>
    </events>
  </global>
</config> 

and observer file app/code/local/James/Prodcheck/Model/Observer.php

class James_Prodcheck_Model_Observer
{

            public function check(Varien_Event_Observer $observer)
            {
                //Your code stuff.
            }

}