0

i need to create sql installer in magento.....i created a module and i created table by sql query directly to sql editor...

but for global module i need to create sql installer...in magento sql... i m giving my config detail....and also i want to know that what changes in necessary for executing sql script in magento ...also i want to know that what should in sql script.

my config..

<?xml version="1.0" encoding="UTF-8" ?>
<config>
    <!-- module configuration -->
    <modules>
        <Webcreon_Seller>
            <version>0.0.1</version>
        </Webcreon_Seller>
    </modules>
    <!-- module configuration end -->
    <frontend>
        <routers>
            <seller>
                <use>standard</use>
                <args>
                    <module>Webcreon_Seller</module>
                    <frontName>seller</frontName>  
                </args>
            </seller>
        </routers>
     <layout>
            <updates>
                <seller>
                      <file>sellerform.xml</file>
                </seller>
            </updates>
       </layout>
    </frontend>
    <admin>
     <routers>
         <seller>
            <use>admin</use>
            <args>
               <module>Webcreon_Seller</module>
               <frontName>adminseller</frontName>
            </args>
         </seller>
      </routers>
 </admin>
 <adminhtml>
   <layout>
      <updates>
          <seller>
              <file>sellerform.xml</file>
           </seller>
      </updates>
   </layout>
   <menu>
      <customer translate="title" module="adminhtml">

         <sort_order>10</sort_order>
         <children>
             <set_time>
                   <title>Seller List</title>
                   <action>adminseller/adminhtml_index</action>
              </set_time>
          </children>
       </customer>
    </menu>
</adminhtml> 

    <global>
        <blocks>
            <seller>
                <class>Webcreon_Seller_Block</class>
            </seller>
         </blocks>
         <helpers>
            <seller>
                <class>Webcreon_Seller_Helper</class>
            </seller> 
        </helpers>
              <models>
          <seller>
                <class>Webcreon_Seller_Model</class>
                 <resourceModel>seller_mysql4</resourceModel>
            </seller> 
            <seller_mysql4>
             <class>Webcreon_Seller_Model_Mysql4</class>
             <entities>
                 <seller>
                   <table>db_vendor</table>
                 </seller>
              </entities>
          </seller_mysql4>
        </models>
        <resources>
        <!-- connection to write -->
        <seller_write>
            <connection>
                <use>core_write</use>
            </connection>
        </seller_write>
        <!-- connection to read -->
       <seller_read>
          <connection>
             <use>core_read</use>
          </connection>
       </seller_read>
</resources>
    </global>


</config>
1

You need to add this to your config.xml file inside the global->resources tag

<webcreon_seller_setup>
    <setup>
        <module>Webcreon_Seller</module>
    </setup>
</webcreon_seller_setup>

Then create the file sql/webcreon_seller_setup/install-0.0.1.php. This is the install script.

| improve this answer | |
  • what will be script....for sql – Deepak Kumar Nov 18 '14 at 11:34
  • To see how your should create ta table just take a look at how it's done in the code modules. Look at app/code/core/Mage/Cms/sql/cms_setup/install-1.6.0.0.php for example. – Marius Nov 18 '14 at 11:36
  • i created script but i m confuse in this line $table = $installer->getConnection() ->newTable($installer->getTable('seller/subscription'))...cna you explain it in first seller and subscription ...in what is diffrence in both...and also i got error.... Error in file: "E:\xampp\htdocs\milano_theme\app\code\local\Webcreon\Seller\sql\webcreon_seller_setup\mysql4-install-0.0.1.php" - Can't retrieve entity config: seller/subscription – Deepak Kumar Nov 18 '14 at 12:26
  • You don't have your subscription table declared in config.xml. Just like you have for seller you need one for subscription: <seller> <table>db_vendor</table> </seller> – Marius Nov 18 '14 at 12:30

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.