Skip to content

Instantly share code, notes, and snippets.

View MagePsycho's full-sized avatar

magepsycho MagePsycho

View GitHub Profile

Magento Code Snippets

Download extension manually using mage

./mage config-set preferred_state stable
./mage clear-cache
./mage sync
./mage download community Module_Name
@MagePsycho
MagePsycho / local.xml
Created September 23, 2013 10:06
Translation is not working for Breadcrumbs injected via layout update file. Refer below XML code:
<checkout_cart_index>
<reference name="breadcrumbs">
<action method="addCrumb">
<crumbName>home</crumbName>
<crumbInfo>
<label>Home</label>
<title>Home</title>
<link>/</link>
</crumbInfo>
</action>
<?php
/**
* Generates data with ready-to-edit CSV for magento translation
*
* A handy tool that generates CSV data for magento theme translation
* You can set the $mode to:
* a) either write that data to translate.csv at path you specify,
* b) or just to dump that data in browser for you to copy and use (default).
* In the write mode it appends new data to translate.csv thus you dont
<?php
/**
* Magento version/edition helper for determining the Magento BASE version (regardless of edition) and adds functions to check if Enterprise, Professional or Community are being run.
* Adds isMageCommunity(), isMageProfessional() and isMageEnterprise()
*
* @category TBT
* @package TBT_Rewards
* @author WDCA Sweet Tooth Team <contact@sweettoothhq.com>
*/
class TBT_Rewards_Helper_Version extends Mage_Core_Helper_Abstract {
@MagePsycho
MagePsycho / mage-db-repair-tool.rb
Created July 10, 2015 14:47
Magento DB Repair Tool Using CLI - Ruby + Mechanize
#!/usr/bin/env ruby
#
# Magento DB Repair tool using CLI
# Uses Ruby's Mechanize gem
#
# @author Raj KB <magepsycho@gmail.com>
# @website http://www.magepsycho.com
#
# Tested on Mac OS-X 10.X
@MagePsycho
MagePsycho / gist:79136da8a2980b5a5353
Last active October 26, 2015 10:43
PHP5 Namespace / Aliasing explained in a script
<?php
#@author Raj KB<magepsycho@gmail.com>
#ini_set('display_errors',true);
#error_reporting(E_ALL | E_STRICT);
// You cannot have above because:
// Namespace declaration statement has to be the very first statement in the script
// How to use namespace?
namespace MagePsycho\Easypathhints\Helper;
@MagePsycho
MagePsycho / m2-installer.sh
Last active December 2, 2022 08:47
Magento 2 Installer - Full Bash Script with Documentation - https://github.com/MagePsycho/magento2-installer-bash-script
#!/usr/bin/env bash
#
# Script to install Magento2
#
# @author Raj KB <magepsycho@gmail.com>
# @website http://www.magepsycho.com
# @version 0.1.0
# UnComment it if bash is lower than 4.x version
@MagePsycho
MagePsycho / M2 acl.xml
Created February 13, 2016 14:16 — forked from Vinai/M2 acl.xml
My current Magento 2 PHPStorm File Templates (Feb 2016)
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
<acl>
<resources>
<resource id="Magento_Backend::admin">
</resource>
</resources>
</acl>
</config>
@MagePsycho
MagePsycho / Data.php
Last active March 26, 2016 15:03
Magento 2 - Custom Logger
<?php
namespace MagePsycho\Demo\Helper;
/**
* @category MagePsycho
* @package MagePsycho_Demo
* @author magepsycho@gmail.com
* @website http://www.magepsycho.com
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@MagePsycho
MagePsycho / Data.php
Created March 28, 2016 18:36
Magento 2 Custom Logger - 2nd Approach
<?php
// File: app/code/MagePsycho/Helper/Data.php
// Usage: MagePsycho\Demo\Helper\Data::log($message)
namespace MagePsycho\Demo\Helper;
class Data extends \Magento\Framework\App\Helper\AbstractHelper
{
/**