Skip to content

Instantly share code, notes, and snippets.

<?php
if(!Mage::getSingleton('customer/session')->isLoggedIn()){
echo $this->__('Sign In');
}else{
echo $this->__('Hello, %s!', $this->helper('customer')->getCustomerName());
}
?>
@Polar77
Polar77 / collection.php
Last active June 15, 2016 14:27
addFieldToFilter
$collection->addFieldToFilter(
array('title', 'content'),
array(
array('like'=>'%$titlesearchtext%'),
array('like'=>'%$contentsearchtext%')
)
)
$collection->addFieldToFilter(
array('field_1', 'field_2', 'field_3'), // columns
<block type="cms/block" name="block_name">
<action method="setBlockId"><id>block_code</id></action>
</block>
{{block type="cms/block" block_id="block_code"}}
{{block type="catalog/product_list" category_id="79" template="catalog/product/list_random.phtml"}}
@Polar77
Polar77 / 0_reuse_code.js
Created June 29, 2016 10:58
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@Polar77
Polar77 / index.php
Created July 25, 2016 08:58 — forked from korbax/index.php
Configure nginx for use multistore in Magent0
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
<?php
/*
* Magento get products without category
* @author Vladimir Polyakov
*/
//load Magento
$mageFilename = 'app/Mage.php';
if (!file_exists($mageFilename)) {
echo $mageFilename." was not found";
@Polar77
Polar77 / exportAttributesToCsv.php
Created August 9, 2016 16:57 — forked from peterjaap/exportAttributesToCsv.php
Export Magento attributes and their options to a human-readable CSV file.
<?php
chdir(dirname(__FILE__));
require_once '../app/Mage.php';
Mage::app();
umask(0);
$productModel = Mage::getModel('Mage_Catalog_Model_Product');
$categoryModel = Mage::getModel('Mage_Catalog_Model_Category');
@Polar77
Polar77 / supee-7405-1.1.md
Created August 9, 2016 17:01 — forked from peterjaap/supee-7405-1.1.md
Overview of Magento patch SUPEE-7405 1.1

Patch SUPEE-7405 1.1 overview

This patch is not to be confused with the SUPEE-7405 that was released on January 20th, 2016. This is a fix for that patch.

"Yo dawg, we heard you like patching so here's a patch for your patch so you can patch while you're patching." - Xzibit, MCD+

Changed files

  • app/code/core/Mage/Adminhtml/Helper/Sales.php +1/-1
  • app/code/core/Mage/Core/Model/Config.php +2/-2
  • app/code/core/Mage/Sales/Model/Quote/Item.php +3/-2
  • lib/Varien/File/Uploader.php +2/-2
  • app/etc/applied.patches.list +7/-0