0

I have some form.

<form action="<?php echo Mage::getUrl('siteblocks/test/test', array('_current' => true,'_use_rewrite' => true))?>" method="post">
        <h3>Enter your information</h3>
        <p>
            <label for="name" class="name" >Customer Name</label>
            <input id="customer_name" name="customer_name" required="required" type="text"/>
        </p>
        <p>
            <label for="phone" class="phone" >Customer Phone</label>
            <input id="customer_phone" name="customer_phone" required="required" type="text"/>
        </p>
        <p>
            <label for="calltime" class="ctime"  >Call Time</label>
            <input id="calltime" name="call_time" required="required" type="text"/>
        </p>
    </form>

Information comes from the form to the controller

class Test_Test_Controller extends Mage_Core_Controller_Front_Action {

public function testAction()
{

    $this->getRequest()->getPost();

    Mage::getModel('siteblocks/callEntity')->setData($this->getRequest()->getPost())

        ->save();
}

The problem is that data is not sent in base

<?php
$installer = $this;
$installer->startSetup();
$table = $installer->getConnection()->newTable($installer->getTable('fast_call'))
    ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, array(
        'unsigned' => true,
        'nullable' => false,
        'primary' => true,
        'identity' => true,
    ), 'id')
    ->addColumn('customer_name', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
        'nullable' => false,
        'default' => '',
    ), 'customer_name')
    ->addColumn('customer_phone', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
        'nullable' => false,
        'default' => '',
    ), 'customer_phone')
    ->addColumn('call_time', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
        'nullable' => true,
        'default' => '',
    ), 'call_time')
    ->setComment('fast_call');
$installer->getConnection()->createTable($table);
$installer->endSetup();

config.xml

<config>
    <modules>
        <Test_Test>
            <version>0.1.0</version>
        </Test_Test>
    </modules>
    <global>
        <models>
            <siteblocks>
                <class>Test_Test_Model</class>
                <resourceModel>siteblocks_resource</resourceModel>
            </siteblocks>
            <siteblocks_resource>
                <class>Test_Test_Resourse</class>
                <entities>
                    <block>
                        <table>fast_call</table>
                    </block>
                </entities>
            </siteblocks_resource>
        </models>
        <resources>
            <siteblocks_setup>
                <setup>
                    <module>Test_Test</module>
                </setup>
            </siteblocks_setup>
        </resources>
        <helpers>
            <siteblocks>
                <class>Test_Test_Helper</class>
            </siteblocks>
        </helpers>
    </global>
    <frontend>
        <routers>
            <siteblocks>
                <use>standard</use>
                <args>
                    <module>Test_Test</module>
                    <frontName>siteblocks</frontName>
                </args>
            </siteblocks>
        </routers>
        <translate>
            <modules>
                <Test_Test>
                    <files>
                        <defaul>Test_Test.scv</defaul>
                    </files>
                </Test_Test>
            </modules>
        </translate>
        <layout>
            <updates>
                <mymodule>
                    <file>test_catalog.xml</file>
                </mymodule>
            </updates>
        </layout>
    </frontend>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <siteblocks before="Mage_Adminhtml">Test_Test_Adminhtml</siteblocks>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
    <default>
        <web>
            <routers>
                <siteblocks_callentity>
                    <area>frontend</area>
                    <class>Test_Test_Controller_Router</class>
                </siteblocks_callentity>
            </routers>
        </web>
      </default>
    </config>

When information is sent form the controller receives it and seemingly must enter it into the database. But this is not happening. Debug gave nothing. Maybe someone will find a mistake

2
  • did you flush your store cache? Jul 19, 2016 at 7:18
  • where you defined the callEntity model? Jul 19, 2016 at 7:21

2 Answers 2

1

Change your controller code . As you not defined the callEntity model. And in config xml you named your model block

class Test_Test_Controller extends Mage_Core_Controller_Front_Action {

 public function testAction()
 {

      $this->getRequest()->getPost();

       Mage::getModel('siteblocks/block')->setData($this->getRequest()->getPost())

    ->save();
  }
}
0

In config.xml

    <siteblocks_resource>
    <class>Test_Test_Resourse</class>
    <entities>
        <block>
            <table>fast_call</table>
        </block>
    </entities>
</siteblocks_resource>

replace with

<siteblocks_resource>
<class>Test_Test_Resourse</class>
<entities>
    <siteblocks>
        <table>fast_call</table>
    </siteblocks>
</entities>

in sqlscript file

$installer->getConnection()->newTable($installer->getTable('fast_call'))

replace with

$installer->getConnection()->newTable($installer->getTable('siteblocks/siteblocks')

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.