Unable to configure EAV setup resource - magento

I'm trying to create a EAV module and I got stuck in here for a very long time.
error msg :
Invalid entity_type specified: gagan_eavfaq
#0 C:\wamp\www\www.ubt.com\app\code\core\Mage\Eav\Model\Config.php(328): Mage::throwException('Invalid entity_...')
#1 C:\wamp\www\www.ubt.com\app\code\core\Mage\Eav\Model\Entity\Abstract.php(276): Mage_Eav_Model_Config->getEntityType('gagan_eavfaq')
#2 C:\wamp\www\www.ubt.com\app\code\local\Gagan\Eavfaq\Model\Resource\Eav\Mysql4\Eavfaq.php(9): Mage_Eav_Model_Entity_Abstract->setType('gagan_eavfaq')
#3 C:\wamp\www\www.ubt.com\app\code\core\Mage\Core\Model\Resource\Abstract.php(44): Gagan_Eavfaq_Model_Resource_Eav_Mysql4_Eavfaq->_construct()
#4 C:\wamp\www\www.ubt.com\app\code\core\Mage\Core\Model\Config.php(1348): Mage_Core_Model_Resource_Abstract->__construct(Array)
#5 C:\wamp\www\www.ubt.com\app\code\core\Mage\Core\Model\Config.php(1380): Mage_Core_Model_Config->getModelInstance('eavfaq_mysql4/e...', Array)
#6 C:\wamp\www\www.ubt.com\app\Mage.php(490): Mage_Core_Model_Config->getResourceModelInstance('eavfaq/eavfaq', Array)
#7 C:\wamp\www\www.ubt.com\app\Mage.php(518): Mage::getResourceModel('eavfaq/eavfaq', Array)
#8 C:\wamp\www\www.ubt.com\app\code\core\Mage\Core\Model\Abstract.php(139): Mage::getResourceSingleton('eavfaq/eavfaq')
#9 C:\wamp\www\www.ubt.com\app\code\core\Mage\Core\Model\Abstract.php(225): Mage_Core_Model_Abstract->_getResource()
#10 C:\wamp\www\www.ubt.com\app\code\local\Gagan\Eavfaq\controllers\IndexController.php(8): Mage_Core_Model_Abstract->load(1)
#11 C:\wamp\www\www.ubt.com\app\code\core\Mage\Core\Controller\Varien\Action.php(419): Gagan_Eavfaq_IndexController->indexAction()
#12 C:\wamp\www\www.ubt.com\app\code\core\Mage\Core\Controller\Varien\Router\Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')
#13 C:\wamp\www\www.ubt.com\app\code\core\Mage\Core\Controller\Varien\Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#14 C:\wamp\www\www.ubt.com\app\code\core\Mage\Core\Model\App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#15 C:\wamp\www\www.ubt.com\app\Mage.php(683): Mage_Core_Model_App->run(Array)
#16 C:\wamp\www\www.ubt.com\index.php(87): Mage::run('', 'store')
#17 {main}
Config:
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Gagan_eavfaq>
<version>0.1.0</version>
</Gagan_eavfaq>
</modules>
<frontend>
<routers>
<eavfaq>
<use>standard</use>
<args>
<module>Gagan_Eavfaq</module>
<frontName>eavfaq</frontName>
</args>
</eavfaq>
</routers>
</frontend>
<global>
<models>
<eavfaq>
<class>Gagan_Eavfaq_Model</class>
<resourceModel>eavfaq_mysql4</resourceModel>
</eavfaq>
<eavfaq_mysql4>
<class>Gagan_Eavfaq_Model_Resource_Eav_Mysql4</class>
<entities>
<dinkchika>
<table>gagan_eavfaq</table>
</dinkchika>
</entities>
</eavfaq_mysql4>
</models>
<resources>
<eavfaq_setup>
<setup>
<module>Gagan_Eavfaq</module>
<class>Gagan_Eavfaq_Entity_Setup</class>
</setup>
<connection>
<use>core_setup</use>
</connection>
</eavfaq_setup>
<eavfaq_write>
<connection>
<use>core_write</use>
</connection>
</eavfaq_write>
<eavfaq_read>
<connection>
<use>core_read</use>
</connection>
</eavfaq_read>
</resources>
</global>
</config>
Resource :
<?php
class Gagan_Eavfaq_Model_Resource_Eav_Mysql4_Eavfaq
extends Mage_Eav_Model_Entity_Abstract
{
public function _construct() {
$resource = mage::getSingleton('core/resource');
$this->setType('gagan_eavfaq');
$this->setConnection(
$resource->getConnection('eavfaq_read'),
$resource->getConnection('eavfaq_write')
);
}
}
setup :
<?php
class Gagan_Eavfaq_Entity_Setup extends
Mage_Eav_Model_Entity_Setup{
}
install script:
I want this exception to show. It looks like my setup is not finding a way to this file, from this I can conclude something is wrong with my config. But I've checked that several time still no luck. Please help. Thank you
<?php $installer = $this;
throw new Exception("set up configured ");
folder structure:

Related

Magento 1.9 custom module with custom database table not saving

I have developed a custom module that also has a custom database table.
However, I cannot insert records since I am presented with the following error:
Fatal error: Call to a member function beginTransaction() on boolean in /httpdocs/includes/src/__default.php on line 6105
Here is the code that I am trying:
$data = array(
'voucher' => 'voucher',
'customer_name' => 'customer_name',
'order' => 'order',
'value' => 'value',
'status' => 1,
'date' => '',
);
$model = Mage::getModel('antikatavoles/antikatavoles')->setData($data);
And this is my config file:
<?xml version="1.0" ?>
<config>
<modules>
<ID_Antikatavoles>
<version>0.1.0</version>
</ID_Antikatavoles>
</modules>
<frontend>
<routers>
<antikatavoles>
<use>standard</use>
<args>
<module>ID_Antikatavoles</module>
<frontName>antikatavoles</frontName>
</args>
</antikatavoles>
</routers>
</frontend>
<global>
<models>
<antikatavoles>
<class>ID_Antikatavoles_Model</class>
<resourceModel>antikatavoles_mysql4</resourceModel>
</antikatavoles>
<antikatavoles_mysql4>
<class>ID_Antikatavoles_Model_Mysql4</class>
<entities>
<antikatavoles>
<table>antikatavoles</table>
</antikatavoles>
</entities>
</antikatavoles_mysql4>
</models>
<resources>
<antikatavoles_setup>
<setup>
<module>ID_Antikatavoles</module>
</setup>
<connection>
<use>core_setup</use>
</connection>
</antikatavoles_setup>
<antikatavoles_write>
<connection>
<use>core_write</use>
</connection>
</antikatavoles_write>
<antikatavoles_read>
<connection>
<use>core_read</use>
</connection>
</antikatavoles_read>
</resources>
<helpers>
<antikatavoles>
<class>ID_Antikatavoles_Helper</class>
</antikatavoles>
</helpers>
</global>
</config>
Can anyone help me figure this one out?
thanks!
EDIT:
My model and resource model:
class ID_Antikatavoles_Model_Antikatavoles extends Mage_Core_Model_Abstract
{
public function _construct()
{
parent::_construct();
$this->_init('antikatavoles/antikatavoles');
}
}
class ID_Antikatavoles_Model_Mysql4_Antikatavoles extends Mage_Core_Model_Mysql4_Abstract
{
public function _construct()
{
$this->_init('antikatavoles/antikatavoles', 'antikatavoles_id');
}
}

magento - Can't retrieve entity config

I have created two tables in my custom module. 1) wallets 2) sellerrequest
When I load Mage::getModel("wallets/wallets")->load(); it works properly. But when I try to load Mage::getModel("wallets/sellerrequest")->load(); it gives error - Can't retrieve entity config: wallets/sellerrequest I am not sure whether I can do this in single module or not. I am new to magento.
Here is my config.xml file -
<config>
<modules>
<Adept_Wallets>
<version>1.4.0</version>
</Adept_Wallets>
</modules>
<frontend>
<routers>
<wallets>
<use>standard</use>
<args>
<module>Adept_Wallets</module>
<frontName>wallets</frontName>
</args>
</wallets>
</routers>
<layout>
<updates>
<wallets>
<file>wallets.xml</file>
</wallets>
</updates>
</layout>
</frontend>
<admin>
<routers>
<wallets>
<use>admin</use>
<args>
<module>Adept_Wallets</module>
<frontName>wallets</frontName>
</args>
</wallets>
</routers>
</admin>
<global>
<models>
<wallets>
<class>Adept_Wallets_Model</class>
<resourceModel>wallets_mysql4</resourceModel>
</wallets>
<wallets_mysql4>
<class>Adept_Wallets_Model_Mysql4</class>
<entities>
<wallets>
<table>wallets</table>
</wallets>
</entities>
</wallets_mysql4>
<sellerrequest>
<class>Adept_Sellerrequest_Model</class>
<resourceModel>sellerrequest_mysql4</resourceModel>
</sellerrequest>
<sellerrequest_mysql4>
<class>Adept_Sellerrequest_Model_Mysql4</class>
<entities>
<sellerrequest>
<table>sellerrequest</table>
</sellerrequest>
</entities>
</sellerrequest_mysql4>
</models>
<resources>
<wallets_setup>
<setup>
<module>Adept_Wallets</module>
</setup>
<connection>
<use>core_setup</use>
</connection>
</wallets_setup>
<wallets_write>
<connection>
<use>core_write</use>
</connection>
</wallets_write>
<wallets_read>
<connection>
<use>core_read</use>
</connection>
</wallets_read>
</resources>
<blocks>
<wallets>
<class>Adept_Wallets_Block</class>
</wallets>
</blocks>
<helpers>
<wallets>
<class>Adept_Wallets_Helper</class>
</wallets>
</helpers>
</global>
</config>
And the Model file structure is -
Model -
- Sellerrequest.php
- Wallets.php
- Mysql4
- Sellerrequest.php
- Wallets.php
- Sellerrequest
- Collection.php
- Wallets
- Collection.php
Here is Sellerrequest.php in Model directory -
<?php
class Adept_Wallets_Model_Sellerrequest extends Mage_Core_Model_Abstract
{
public function _construct()
{
parent::_construct();
$this->_init('wallets/sellerrequest');
}
}
Mysql4 -> Sellerrequest.php
<?php
class Adept_Wallets_Model_Mysql4_Sellerrequest extends Mage_Core_Model_Mysql4_Abstract
{
public function _construct()
{
// Note that the banners_id refers to the key field in your database table.
$this->_init('wallets/sellerrequest', 'id');
}
}
Mysql4 -> Sellerrequest -> Collection.php
<?php
class Adept_Wallets_Model_Mysql4_Sellerrequest_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
{
public function _construct()
{
parent::_construct();
$this->_init('wallets/sellerrequest', 'id');
}
}
I have checked various solutions on google as well but, I am not getting what I am doing wrong.
Same structure for the wallets table is working fine.
Any help is highly Appreciated !!
Thanks.
You are using the wrong model handler based on your config.xml.
You should call
Mage::getModel("sellerrequest/sellerrequest")->load();
And your _init() function in models may also be faulty.
They should also stand sellerrequest/sellerrequest instead of wallets/sellerrequest/
And your <class> tag for the model sallerrequest may be wrong too.
You are stating:
<sellerrequest>
<class>Adept_Sellerrequest_Model</class>
<resourceModel>sellerrequest_mysql4</resourceModel>
</sellerrequest>
Which means Magento is going to look in the folder app/code/local/Adept/Sellerrequest/Model/.
Where your Model file state they are Adept_Wallets_Model_ thus must be located in the folder app/code/local/Adept/Wallets/Model.
As a matter of fact this declaration is, in Magento way of doing things, totally wrong. Because with the line <class>Adept_Sellerrequest_Model</class> you are stating that the models of the module Adept_Wallets are in another module: Adept_Sellerrequest, which can work, but that I can not at all recommend you to do.
But, if you really want your module to be clear, here are how they would do it in Magento core files:
In your configuration XML file:
<config>
<modules>
<Adept_Wallets>
<version>1.4.0</version>
</Adept_Wallets>
</modules>
<frontend>
<routers>
<wallets>
<use>standard</use>
<args>
<module>Adept_Wallets</module>
<frontName>wallets</frontName>
</args>
</wallets>
</routers>
<layout>
<updates>
<wallets>
<file>wallets.xml</file>
</wallets>
</updates>
</layout>
</frontend>
<admin>
<routers>
<wallets>
<use>admin</use>
<args>
<module>Adept_Wallets</module>
<frontName>wallets</frontName>
</args>
</wallets>
</routers>
</admin>
<global>
<models>
<wallets>
<class>Adept_Wallets_Model</class>
<resourceModel>wallets_mysql4</resourceModel>
</wallets>
<wallets_mysql4>
<class>Adept_Wallets_Model_Mysql4</class>
<entities>
<wallets>
<table>wallets</table>
</wallets>
<!-- the table to connect to seller request is here -->
<sellerrequest>
<table>sellerrequest</table>
</sellerrequest>
</entities>
</wallets_mysql4>
<!-- do not use two models definition -->
<!-- sellerrequest>
<class>Adept_Sellerrequest_Model</class>
<resourceModel>sellerrequest_mysql4</resourceModel>
</sellerrequest>
<sellerrequest_mysql4>
<class>Adept_Sellerrequest_Model_Mysql4</class>
<entities>
<sellerrequest>
<table>sellerrequest</table>
</sellerrequest>
</entities>
</sellerrequest_mysql4 -->
</models>
<resources>
<wallets_setup>
<setup>
<module>Adept_Wallets</module>
</setup>
<connection>
<use>core_setup</use>
</connection>
</wallets_setup>
<wallets_write>
<connection>
<use>core_write</use>
</connection>
</wallets_write>
<wallets_read>
<connection>
<use>core_read</use>
</connection>
</wallets_read>
</resources>
<blocks>
<wallets>
<class>Adept_Wallets_Block</class>
</wallets>
</blocks>
<helpers>
<wallets>
<class>Adept_Wallets_Helper</class>
</wallets>
</helpers>
</global>
</config>
Then you can use Mage::getModel('wallets/sellerrequest') and also your class names in Adept_Wallets_Model_(...) for sellerrequest are right.
Little explanation about the models in Magento
Mage::getModel("module_handler/path_to_class");
This is how Magento get its models, but that also works for blocks when using Mage::getBlockSingleton() or Mage::helper() or Mage::getSingleton(), ...
So, what does this module_handler and path_to_class correspond to and how does Magento get to the right class in the right folder you may ask?
Here it goes from the start till the end:
First things first you are here requesting a model because you call Mage::getModel(), so Magento is going to parse the config.xml of all the modules to find a module with the handler: module_handler.
So, in your config.xml there should be something looking like
<config>
<!--
the line above means that
we are going to add something to the global config
-->
<global>
<!--
the line above means we are going to add something
which can be accessed by both fronted and backend elements
-->
<models>
<!--
the line above means that
we are going to add a model to the existing models
-->
<module_handler>
<!--
the line above means that
our new model have the handler module_handler
-->
<class>Company_Module_Model</class>
<!--
the line above states
where the files of this model are located
-->
<!-- some declaration should come here -->
</module_handler>
<models>
</global>
</config>
Ok, now Magento can get to your classes: it knows that calling module_handler/path_to_class have to map to Company_Module_Model_Path_To_Class which translate in the file in Company/Module/Model/Path/To/Class.php.
And for even further comprehension it knows, based on the file in app/etc/modules/Company_Module.xml where this Module files are because you stated something like:
<config>
<modules>
<Company_Module>
<active>true</active>
<codePool>local</codePool>
<depends/>
</Company_Module>
</modules>
</config>
So, it knows it is a local module and it is going to look in the folder in app/code/local.
So, your file is in app/code/local/Company/Module/Model/Path/To/Class.php.
Same if you call a simpler Mage::getModel('module_handler/class')
it knows the file is in app/code/local/Company/Module/Model/Class.php.

Magento Model Rescource

I am a newbie with Magento. I have a problem with Model Rescource of Magento.
This is config.xml
<config>
<Magentotutorial_Weblog>
<version>0.0.1</version>
</Magentotutorial_Weblog>
<frontend>
<routers>
<weblog>
<use>standard</use>
<args>
<module>Magentotutorial_Weblog</module>
<frontName>weblog</frontName>
</args>
</weblog>
</routers>
</frontend>
<global>
<models>
<weblog>
<class>Magentotutorial_Weblog_Model</class>
<resourceModel>weblog_resource</resourceModel>
</weblog>
<weblog_resource>
<class>Magentotutorial_Weblog_Model_Resource</class>
<entities>
<blogpost>
<table>blog_posts</table>
</blogpost>
</entities>
</weblog_resource>
</models>
<resources>
<weblog_setup>
<setup>
<module>Magentoturorial_Weblog</module>
</setup>
<connection>
<use>core_setup</use>
</connection>
</weblog_setup>
<weblog_write>
<connection>
<use>core_write</use>
</connection>
</weblog_write>
<weblog_read>
<connection>
<use>core_read</use>
</connection>
</weblog_read>
</resources>
</global>
</config>
Model
<?php
class Magentotutorial_Weblog_Model_Blogpost extends Mage_Core_Model_Abstract
{
protected function _construct()
{
$this->_init('weblog/blogpost');
}
}
?>
Model resource
<?
class Magentotutorial_Weblog_Model_Resource_Blogpost extends Mage_Core_Model_Resource_Db_Abstract{
protected function _construct()
{
$this->_init('weblog/blogpost', 'blogpost_id');
}
}
?>
I call $blogpost = Mage::getResourceModel('weblog/blogpost');
This variable of $blogpost return is false;
but my screen on browser show "_init('weblog/blogpost', 'blogpost_id');";
I found all code lines, I don't see nolines could show it.
If I comment //$this->_init('weblog/blogpost', 'blogpost_id');, so "_init('weblog/blogpost', 'blogpost_id');" don't appear
It looks like you have PHP short tags turned off on your server, but your model resource file
<?
class Magentotutorial_Weblog_Model_Resource_Blogpost extends Mage_Core_Model_Resource_Db_Abstract{
protected function _construct()
{
$this->_init('weblog/blogpost', 'blogpost_id');
}
}
?>
Uses a short tag opening/ Change
<?
to
<?php
and your immediate problem should be solved.

My Module installer doesnt run and doesnt gets into the resource table

I've been working on a module that needs some attributes added to the table of sales_orders. So i thought i will make an resource install script and add it to the XML. Well for me this wasn't a easy task. To be really honest I cant make it work. I have searched some hours to get the solution, but i haven't found it. The weird thing is that my module isnt at the core_resource table...
Well this is my XML. I'm a bit new to XML editing. Maybe i have made an error.
XML:
<config>
<global>
<modules>
<Sendcloud_Magento>
<version>0.2.0</version>
</Sendcloud_Magento>
</modules>
<helpers>
<magento>
<class>Sendcloud_Magento_Helper</class>
</magento>
</helpers>
<models>
<magento>
<class>Sendcloud_Magento_Model</class>
<resourceModel>magento_resource</resourceModel>
</magento>
<magento_mysql4>
<class>Sendcloud_Magento_Model_Mysql4</class>
</magento_mysql4>
</models>
<resources>
<!-- ... -->
<magento_setup>
<setup>
<module>Sendcloud_Magento</module>
<class>Sendcloud_Magento_Model_Resource_Mysql4_Setup</class>
</setup>
<connection>
<use>core_setup</use>
</connection>
</magento_setup>
<!-- ... -->
</resources>
</global>
<admin>
<routers>
<magento>
<use>admin</use>
<args>
<module>Sendcloud_Magento</module>
<frontName>sendcloud</frontName>
</args>
</magento>
</routers>
</admin>
<adminhtml>
<acl>
<resources>
<all>
<title>Allow Everything</title>
</all>
<admin>
<children>
<system>
<children>
<config>
<children>
<sendcloud>
<title>Sendcloud</title>
</sendcloud>
</children>
</config>
</children>
</system>
</children>
</admin>
</resources>
</acl>
<layout>
<updates>
<magento>
<file>magento.xml</file>
</magento>
</updates>
</layout>
<events>
<core_block_abstract_prepare_layout_before>
<observers>
<magento_core_block_abstract_prepare_layout_before>
<class>Sendcloud_Magento_Model_Observer</class>
<method>addMassAction</method>
</magento_core_block_abstract_prepare_layout_before>
</observers>
</core_block_abstract_prepare_layout_before>
</events>
</adminhtml>
Ive put an installer script in my module. the path
/local/Sendcloud/Magento/sql/magento_setup/mysql4-install-0.2.0.php
echo 'Running This Upgrade: '.get_class($this)."\n <br /> \n";
die("Exit for now");
I have an model made in
Sendcloud/Magento/Model/Resource/Mysql4/Setup.php
class Sendcloud_Magento_Model_Resource_Mysql4_Setup extends Mage_Core_Model_Resource_Setup {
}
I hope some of you have an solution to my question.
Best regards and a happy new year,
Paul
So now you need to update the version from 0.2.0 to 0.3.0, Try this
app\code\local\Sendcloud\Magento\etc\config.xml
<?xml version="3.0"?>
<config>
<modules>
<Sendcloud_Magento>
<version>0.3.0</version>
</Sendcloud_Magento>
</modules>
<frontend>
<routers>
<magento>
<use>standard</use>
<args>
<module>Sendcloud_Magento</module>
<frontName>magento</frontName>
</args>
</magento>
</routers>
</frontend>
<global>
<models>
<magento>
<class>Sendcloud_Magento_Model</class>
<resourceModel>magento_mysql4</resourceModel>
</magento>
<magento_mysql4>
<class>Sendcloud_Magento_Model_Mysql4</class>
<entities>
<magento>
<table>magento</table>
</magento>
</entities>
</magento_mysql4>
</models>
<resources>
<magento_setup>
<setup>
<module>Sendcloud_Magento</module>
</setup>
<connection>
<use>core_setup</use>
</connection>
</magento_setup>
<magento_write>
<connection>
<use>core_write</use>
</connection>
</magento_write>
<magento_read>
<connection>
<use>core_read</use>
</connection>
</magento_read>
</resources>
</global>
</config>
app\code\local\Sendcloud\Magento\Model\Magento.php
class Sendcloud_Magento_Model_Magento extends Mage_Core_Model_Abstract
{
public function _construct()
{
parent::_construct();
$this->_init('magento/magento');
}
}
app\code\local\Sendcloud\Magento\Model\Mysql4\Magento.php
class Sendcloud_Magento_Model_Mysql4_Magento extends Mage_Core_Model_Mysql4_Abstract
{
public function _construct()
{
// Note that the magento_id refers to the key field in your database table.
$this->_init('magento/magento', 'magento_id');
}
}
app\code\local\Sendcloud\Magento\Model\Mysql4\Magento\Collection.php
class Sendcloud_Magento_Model_Mysql4_Magento_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
{
public function _construct()
{
parent::_construct();
$this->_init('magento/magento');
}
}
app\code\local\Sendcloud\Magento\sql\magento_setup\mysql4-upgrade-0.2.0-0.3.0.php
$installer = $this;
$installer->startSetup();
$installer->addAttribute(
));
$installer->endSetup();
app\etc\modules\Sendcloud_Magento.xml
<?xml version="1.0"?>
<config>
<modules>
<Sendcloud_Magento>
<active>true</active>
<codePool>local</codePool>
</Sendcloud_Magento>
</modules>
</config>
Did you activate your model by putting another XML file in app/etc/modules/ ?

magento unable to load the observe class

when i try to write the observer for the checkout_type_onepage_save_order event like following
<events>
<checkout_type_onepage_save_order>
<observers>
<Appeal_Consignor_Model_Observer>
<type>singleton</type>
<class>consignor/observer</class>
<method>savedata</method>
</Appeal_Consignor_Model_Observer>
</observers>
</checkout_type_onepage_save_order>
</events>
above code i tried in frontend as well as global.
Even i tried following as well.
<events>
<checkout_type_onepage_save_order>
<observers>
<Appeal_Consignor_Model_Observer>
<type>singleton</type>
<class>Appeal_Consignor_Model_Observer</class>
<method>savedata</method>
</Appeal_Consignor_Model_Observer>
</observers>
</checkout_type_onepage_save_order>
</events>
full config.xml file is as follows
<?xml version="1.0"?>
<config>
<modules>
<Appeal_Consignor>
<version>1.0.1</version>
</Appeal_Consignor>
</modules>
<global>
<models>
<consignor>
<class>Appeal_Consignor_Model</class>
</consignor>
</models>
<resources>
<consignor_setup>
<setup>
<module>Appeal_Consignor</module>
</setup>
<connection>
<use>core_setup</use>
</connection>
</consignor_setup>
<consignor_write>
<connection>
<use>core_write</use>
</connection>
</consignor_write>
<consignor_read>
<connection>
<use>core_read</use>
</connection>
</consignor_read>
</resources>
<helpers>
<consignor>
<class>Appeal_Consignor_Helper</class>
</consignor>
</helpers>
</global>
<frontend>
<routers>
<consignor>
<use>standard</use>
<args>
<module>Appeal_Consignor</module>
<frontName>consignor</frontName>
</args>
</consignor>
</routers>
<events>
<checkout_type_onepage_save_order>
<observers>
<Appeal_Consignor_Model_Observer>
<type>singleton</type>
<class>Appeal_Consignor_Model_Observer</class>
<method>savedata</method>
</Appeal_Consignor_Model_Observer>
</observers>
</checkout_type_onepage_save_order>
</events>
</frontend>
<adminhtml>
<layout>
<updates>
<consignor>
<file>consignor.xml</file>
</consignor>
</updates>
</layout>
</adminhtml>
</config>
yet the following error is coming. I cleared cache 1000 times, deleted var cache folder file manually as well.
2012-07-23T11:04:09+00:00 ERR (3): Warning: include(Appeal_Consignor_Model_Observer.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory in E:\xampp\htdocs\magento\includes\src\Varien_Autoload.php on line 93
2012-07-23T11:04:09+00:00 ERR (3): Warning: include() [<a href='function.include'>function.include</a>]: Failed opening 'Appeal_Consignor_Model_Observer.php' for inclusion (include_path='E:\xampp\htdocs\magento\includes\src;.;E:\xampp\php\PEAR') in E:\xampp\htdocs\magento\includes\src\Varien_Autoload.php on line 93
Judging by the include warning, it seems like you have the compiler enabled but it cannot find the (flattened) file.
So either disable the compiler:
php shell/compiler.php disable
Or run a compilation so that it will generate the file for you:
php shell/compiler.php compile
This is what I am using to run the observer when a new product is added to the cart:
etc\config.xml
<?xml version="1.0"?>
<config>
<modules>
<Iln_Cartvalidation>
<version>0.1.0</version>
</Iln_Cartvalidation>
</modules>
<global>
<helpers>
<cartvalidation>
<class>Iln_Cartvalidation_Helper</class>
</cartvalidation>
</helpers>
</global>
<frontend>
<events>
<checkout_cart_product_add_after>
<observers>
<Iln_Cartvalidation_Model_Observer>
<type>singleton</type>
<class>Iln_Cartvalidation_Model_Observer</class>
<method>Mytestmethod</method>
</Iln_Cartvalidation_Model_Observer>
</observers>
</checkout_cart_product_add_after>
</events>
</frontend>
</config>
Helper\Data.php
<?php
class Iln_Cartvalidation_Helper_Data extends Mage_Core_Helper_Abstract {
}
Model\observer.php
<?php
class Iln_Cartvalidation_Model_Observer {
public function Mytestmethod($observer) {
$event = $observer->getEvent(); //Fetches the current event
$product = $event->getProduct();
$eventmsg = "Current Event Triggered : " . $event->getName() . "Currently Added Product : " . $product->getName();
//Adds Custom message to shopping cart
echo Mage::getSingleton('checkout/session')->addSuccess($eventmsg);
//Your Custom Logic Here
print_r($product);
}
}
I think it should helps to you:
<events>
<checkout_type_onepage_save_order>
<observers>
<consignor>
<type>model</type>
<class>consignor/observer</class>
<method>savedata</method>
</consignor>
</observers>
</checkout_type_onepage_save_order>
</events>

Resources