Skip to content

Instantly share code, notes, and snippets.

View eniuz's full-sized avatar

Mariusz Szot eniuz

View GitHub Profile
@eniuz
eniuz / magento-patch-check.sh
Created November 2, 2015 11:41
Magento - Verify applied patches
grep -F '|' app/etc/applied.patches.list|cut -f 2,1 -d'|'
@eniuz
eniuz / gist:e00aab0ce2b51986dcf5
Created November 2, 2015 11:43 — forked from ReactiveRaven/gist:8824407
downgrade php 5.5 to 5.4
# upgrade system, so you can add to ignore all updates later
sudo apt-get update
sudo apt-get upgrade
# remove your php, apache, etc
sudo apt-get purge apache2 php5 libapache2-mod-php5 # add here your server packages
# change repositories to raring (with backup)
sudo sed -i.bak "s/saucy/raring/g" /etc/apt/sources.list
@eniuz
eniuz / get-php-extension-dir.sh
Created November 2, 2015 15:57
Get php extension dir
php -i | grep extension_dir
@eniuz
eniuz / 1.factory-methods.md
Created November 11, 2015 10:00 — forked from Vinai/1.factory-methods.md
Model & Resource Model Class Resolution Steps

Debugging (Resource) Model Instantiation

Follow each step manually and any bugs during (resource) model instantiation will become obvious.

Since many people find model and resource model instantiation to be one of the more challenging things in Magento 1, these are all the steps Magento does to resolve the factory name to the real PHP class name.

To debug, simply follow each step manually until you find a non-match. This works really well in my experience.
Less guessing, more and faster results.

In the examples I use a factory name of "example/thing".

@eniuz
eniuz / curl-paypal-nvp.sh
Created November 19, 2015 10:55
curl paypal nvp
curl -s --insecure https://api-3t.sandbox.paypal.com/nvp -d
"USER={YourUserID}
&PWD={YourPassword}
&SIGNATURE={YourSignature}
&METHOD=SetExpressCheckout
&VERSION=98
&PAYMENTREQUEST_0_AMT=10
&PAYMENTREQUEST_0_CURRENCYCODE=USD
&PAYMENTREQUEST_0_PAYMENTACTION=SALE
&cancelUrl=http://www.example.com/cancel.html
insert into core_config_data (`scope`, scope_id, `path`, `value`) values('default', 0, 'dev/log/active', '1') on duplicate key update `value`='1';
insert into core_config_data (`scope`, scope_id, `path`, `value`) values('default', 0, 'admin/security/session_cookie_lifetime', '360000') on duplicate key update `value`='360000';
insert into core_config_data (`scope`, scope_id, `path`, `value`) values('default', 0, 'web/cookie/cookie_lifetime', '360000') on duplicate key update `value`='360000';
insert into core_config_data (`scope`, scope_id, `path`, `value`) values('default', 0, 'admin/security/password_is_forced', '0') on duplicate key update `value`='0';
insert into core_config_data (`scope`, scope_id, `path`, `value`) values('default', 0, 'admin/security/password_is_forced', '0') on duplicate key update `value`='0';
update core_config_data set value = 'http://project.192.168.50.100.xip.io/' where path like '%base_url';
update core_config_data set value = ''
@eniuz
eniuz / gist:6a4c549c865c7030caf9
Created December 7, 2015 09:03 — forked from molotovbliss/gist:2562551
Magento Snippets

Magento Snippets

Set all categories to is_anchor 1

Find attribute_id

SELECT * FROM eav_attribute where attribute_code = 'is_anchor'

Update all of them with anchor_id from above (usually is ID 51)

UPDATE `catalog_category_entity_int` set value = 1 where attribute_id = 51
@eniuz
eniuz / gist:e30de10bf688a702272f
Created December 7, 2015 09:03 — forked from molotovbliss/gist:4f71f6242a16fa894a92
Debugging Layout XML issues
Source: https://magento.stackexchange.com/questions/95/debugging-layout-xml-loading
You can log the compiled layout XML directives which are used to generate blocks. Create an observer on controller_action_layout_generate_blocks_before, and in the observer method log the update XML from the transported layout object:
public function logCompiledLayout($o)
{
$req = Mage::app()->getRequest();
$info = sprintf(
"\nRequest: %s\nFull Action Name: %s_%s_%s\nHandles:\n\t%s\nUpdate XML:\n%s",
$req->getRouteName(),
@eniuz
eniuz / createTaxRules.php
Created December 29, 2015 16:50 — forked from peterjaap/createTaxRules.php
Generate tax rules for Magento
<?php
chdir(dirname(__FILE__));
require_once '../app/Mage.php';
Mage::app();
umask(0);
require_once 'countries.php'; // import lists with all countries
// UK Island shipping rates; http://www.crearegroup-ecommerce.co.uk/blog/magento-advice/shipping-rates-to-the-uk-islands.php
@eniuz
eniuz / disable-local-modules.txt
Created December 31, 2015 12:06
Disable local magento modules
<disable_local_modules>true</disable_local_modules>