$installer = $this; $installer->startSetup(); $table = $installer->getConnection() ->newTable($installer->getTable('wmpayment/webmoney_response')) ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array( 'identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true, ), 'Id') ->addColumn('id_order', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array( 'unsigned' => true, 'nullable' => false ), 'Id order') ->addColumn('response', Varien_Db_Ddl_Table::TYPE_TEXT, null, array( 'nullable' => false, ), 'Response in json format') ->addIndex('id_order', 'id_order'); $installer->getConnection()->createTable($table);
2015-10-15
How to create table in magento installation script
2015-10-06
Change magento configuration programmatically
$configModel = Mage::getModel('core/config'); $configModel->saveConfig('path/to/config', 'new value');
2015-08-19
How to use regex route rewrite in zf1
Just add construction like this to your config file:
resources.router.routes.exhange.type = "Zend_Controller_Router_Route_Regex" resources.router.routes.exhange.route = "([a-zA-Z0-9]+)-to-([a-zA-Z0-9]+).html" resources.router.routes.exhange.defaults.module = default resources.router.routes.exhange.defaults.controller = index resources.router.routes.exhange.defaults.action = exchange resources.router.routes.exhange.map.1 = "from" resources.router.routes.exhange.map.2 = "to"Then you will be able to use links like: /one-to-two.html, where $_GET['from'] will be "one" and $_GET['to'] - "two".
2015-07-15
How to compare float numbers in php
/** * Return true if $a equals to $b * * @param float $a * @param float $b * * @return bool */ function isEqualFloat($a, $b) { $epsilon = 0.00001; if (abs($a - $b) < $epsilon) { return true; } return false; }
2015-04-03
How to create table in bootstrap
Add this code:
And then you can create table:
$this->bootstrap('db'); $db = $this->getResource('db'); Zend_Registry::set('db', $db);after
parent::__construct($application);in your bootstrap constructor.
And then you can create table:
$tableAuthSession = new Application_Model_DbTable_AuthSession();
2015-03-24
How to group WHERE clause in zf1
$db = $this->getAdapter(); $select = $db->select(); $select->from($this->_name); $select->where('ip = ?', '120.0.0.1'); $select->orWhere('login = ?', 'test'); $subQuery = $select->getPart(Zend_Db_Select::WHERE); $select->reset(Zend_Db_Select::WHERE); $select->where(implode(' ', $subQuery)); $select->where('created_at = ?', date('Y-m-d')); $res = $select->query()->fetchAll();This will create sql with WHERE clause like as: "((ip = '127.0.0.1') OR (login = 'test')) AND (created_at = '2015-03-24')"
Subscribe to:
Posts (Atom)