Skip to content

Instantly share code, notes, and snippets.

@gayanhewa
Created September 19, 2012 04:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gayanhewa/3747737 to your computer and use it in GitHub Desktop.
Save gayanhewa/3747737 to your computer and use it in GitHub Desktop.
Magent extention : Working config.xml file with custom table
<config>
<modules>
<Sample_Socialmedia>
<version>0.0.1</version>
</Sample_Socialmedia>
</modules>
<frontend>
<routers>
<socailpromo>
<use>standard</use>
<args>
<module>Sample_Socialmedia</module>
<frontName>sharediscount</frontName>
</args>
</socailpromo>
</routers>
</frontend>
<global>
<models>
<socialmedia>
<class>Sample_Socialmedia_Model</class>
<resourceModel>socialmedia_mysql4</resourceModel>
</socialmedia>
<socialmedia_mysql4>
<class>Sample_Socialmedia_Model_Mysql4</class>
<entities>
<discount>
<table>sharediscount</table>
</discount>
</entities>
</socialmedia_mysql4>
</models>
<helpers>
<socialmedia>
<class>Sample_Socialmedia_Helper</class>
</socialmedia>
</helpers>
<events>
<sales_quote_collect_totals_after>
<observers>
<set_discount_static>
<type>singleton</type>
<class>Sample_Socialmedia_Model_Observer</class>
<method>setdiscountamount</method>
</set_discount_static>
</observers>
</sales_quote_collect_totals_after>
</events>
<resources>
<socialmedia_write>
<connection>
<use>core_write</use>
</connection>
</socialmedia_write>
<socialmedia_read>
<connection>
<use>core_read</use>
</connection>
</socialmedia_read>
<socialmedia_setup>
<setup>
<module>Sample_Socialmedia</module>
</setup>
<connection>
<use>core_setup</use>
</connection>
</socialmedia_setup>
</resources>
</global>
</config>
@gayanhewa
Copy link
Author

This config xml will look for a Model file named Discount in your Model directory and Make sure you have a resource files and collection added as well. The table name sharediscount.

PS: I just added this gist for my reference :) I tend to do mistakes in the config and break the damn thing !!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment