Skip to content

Instantly share code, notes, and snippets.

View tim-reynolds's full-sized avatar

Tim Reynolds tim-reynolds

View GitHub Profile
@tim-reynolds
tim-reynolds / Bug Shown
Created February 10, 2015 22:11
Bug in Magento's Varien_Simplexml_Element appendChild method
<?php
public function appendChild($source)
{
/* This is the bug
If an element has no children, only text, but has one or more attributes this call will evaluate to TRUE when it should
evaluate to FALSE.
The solution is simple. Wrap $source->children() in a call to count()
if (count($source->children()) {...
Note: This bug still exists in Magento 2 at this time.
@tim-reynolds
tim-reynolds / jquery.centerit.js
Created June 29, 2012 18:16
Setting scroll to center on an element (jQuery) - Super simple stuff
/*
If you have a horizontal (or vertical) scroll container and want to set the scroll to center a specific
element in the container you can use the following super simple technique.
I'm going to show you how it was derived, because it's important to know why, not just how.
*/
/*
Setup:
[HTML]
<div class="outer">
@tim-reynolds
tim-reynolds / gist:2889107
Created June 7, 2012 14:31
Add left side table filter to phpmyadmin. Off by default in Ubuntu 12.04
Edit /etc/phpmyadmin/config.inc.php
Add line:
$cfg['LeftDisplayTableFilterMinimum'] = 20; //Can be any integer.
Restart apache.
@tim-reynolds
tim-reynolds / changelogo.layout.update.xml
Created March 27, 2012 14:26
Magento: Change company logo for specific CMS page
<!--
--Tim Reynolds (@razialx) 2012 - Do whatever you want license -
--
--If you need to change the company logo on a specific page you can do this easily using
--Layout Update XML. On the CMS page editor in the Magento Admin, go to the Design tab
--on the left. There will be a large text area labeled 'Layout Update XML'
--
--Insert the following XML into it.
--
--This is using Layout actions to call the method setLogo(src,alt) on the Block class