Skip to content

Instantly share code, notes, and snippets.

View jahvi's full-sized avatar
👨‍💻
Deep in the code

Javier Villanueva jahvi

👨‍💻
Deep in the code
View GitHub Profile
@jahvi
jahvi / config.xml
Created November 1, 2015 10:48
Register Admin routes (Deprecated)
<admin>
<routers>
<custom_module>
<use>admin</use>
<args>
<module>custom_module</module>
<frontName>custom_module</frontName>
</args>
</custom_module>
</routers>
@jahvi
jahvi / config.xml
Created November 1, 2015 10:50
Register Admin Routes
<admin>
<routers>
<adminhtml>
<args>
<modules>
<custom_module after="Mage_Adminhtml">CustomModule_Adminhtml</custom_module>
</modules>
</args>
</adminhtml>
</routers>
@jahvi
jahvi / collection.php
Last active November 1, 2015 11:09
SQL statement filter (Deprecated)
<?php
$collection->addFieldToFilter('(field1 – field2)', array('eq' => 3));
// or...
$collection->addFieldToFilter('`field`', array('eq' => 3));
@jahvi
jahvi / collection.php
Created November 1, 2015 11:08
SQL statment filter
<?php
$expression = '(field1 - field2)';
$condition = $this->_getConditionSql($expression, array('eq' =>3 ));
$this->_select->where($condition);
// or..
$collection->addFieldToFilter('field', array('eq' => 3));
@jahvi
jahvi / config.xml
Last active November 1, 2015 11:37
Register Magento resource
<global>
<models>
<custom_module>
<class>Custom_Module_Model</class>
<resourceModel>module_mysql4</resourceModel>
</custom_module>
<module_mysql4>
<class>Custom_Module_Model_Mysql4</class>
<entities>
<custom_module>
@jahvi
jahvi / config.xml
Created November 1, 2015 11:59
Register Magento resource
<global>
<models>
<custom_module>
<class>Custom_Module_Model</class>
<resourceModel>module_resource</resourceModel>
</custom_module>
<module_resource>
<class>Custom_Module_Model_Resource</class>
<entities>
<custom_module>
@jahvi
jahvi / install-1.0.0.php
Created November 1, 2015 12:12
SQL install script
<?php
/* @var $installer Mage_Core_Model_Resource_Setup */
$installer = $this;
$installer->startSetup();
$installer->run("
-- DROP TABLE IF EXISTS {$this->getTable('cms_block')};
@jahvi
jahvi / install-1.0.0.php
Created November 1, 2015 12:24
SQL install script
<?php
/* @var $installer Mage_Core_Model_Resource_Setup */
$installer = $this;
$installer->startSetup();
/**
* Create table 'cms/block'
*/
@jahvi
jahvi / index.php
Created November 1, 2015 13:20
Magento store run
<?php
/* Store or website code */
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';
/* Run store or run website */
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';
Mage::run($mageRunCode, $mageRunType);
@jahvi
jahvi / .git-commit-template.txt
Last active July 11, 2017 08:58 — forked from adeekshith/.git-commit-template.txt
This commit message template that helps you write great commit messages and enforce it across your team.
# (If applied, this commit will...) <subject> (Max 50 char)
# |<---- Using a Maximum Of 50 Characters ---->|
# Explain why this change is being made
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->|
# Provide links or keys to any relevant tickets, articles or other resources
# Example: Github issue #23