Skip to content

Instantly share code, notes, and snippets.

@tinchodev
tinchodev / magentoLoadCategory.php
Last active August 29, 2015 14:11
Magento Load Category
// Load by name
$_category = Mage::getModel('catalog/category')->loadByAttribute('name', 'Acoustic Guitars');
@tinchodev
tinchodev / ratingsToProducts.php
Created December 22, 2014 00:34
Magento Append Ratings to Product Collection
if ($productCollection instanceof Varien_Data_Collection) {
$productCollection->load();
Mage::getModel('review/review')->appendSummary($productCollection);
}
$form = new Varien_Data_Form();
$form->addField('yesno', 'select', array(
'label' => $this->__('Yes or No?'),
'values' => Mage::model('adminhtml/system_config_source_yesnocustom')
->toOptionArray(),
));
$form->addField('custom_value', text, array(
'label' => $this->__('Other'),
));
@tinchodev
tinchodev / xdebug.ini
Created July 17, 2015 15:19
Xdebug Config
xdebug.remote_enable=1
xdebug.remote_host="10.0.2.2"
xdebug.remote_connect_back=0
xdebug.remote_port=9007
xdebug.remote_handler="dbgp"
xdebug.remote_mode=req
xdebug.profiler_enable=0
xdebug.idekey="PHPSTORM"
xdebug.max_nesting_level=100
xdebug.dump.SERVER="REQUEST_URI"
@tinchodev
tinchodev / xdebug.sh
Created July 20, 2015 19:37
Remote shell xdebug example
XDEBUG_CONFIG="idekey=PHPSTORM" PHP_IDE_CONFIG="serverName=www.server.com" php import.php categorias_v3.csv --truncate
/*
<config>
<frontend>
<events>
<page_block_html_topmenu_gethtml_before>
<observers>
<my_module>
<class>my_module/observer</class>
<method>addToTopmenu</method>
@tinchodev
tinchodev / rename_git_branch
Created July 22, 2015 02:38
Rename git branch
git branch -m <oldname> <newname>
git branch -m <newname>
@tinchodev
tinchodev / quote.php
Created July 29, 2015 19:37
Magento get quote disregarding store
$quote= Mage::getModel('sales/quote')->loadByIdWithoutStore($quoteid);
@tinchodev
tinchodev / php_mail_ssmtp.txt
Last active March 6, 2016 19:55
Set up PHP mail() with sSMTP
sudo apt-get install ssmtp
sudo nano /etc/ssmtp/ssmtp.conf
------------------ CUT HERE ---------------------
#
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
@tinchodev
tinchodev / xdebug_remote_console.sh
Created July 31, 2015 14:28
XDebug remote console debug
XDEBUG_CONFIG="idekey=PHPSTORM" PHP_IDE_CONFIG="serverName=www.remoteserver.com" php import.php categorias_v3.csv --truncate