Skip to content

Instantly share code, notes, and snippets.

View molotovbliss's full-sized avatar
⚗️
Code, Eat, Sleep++;

Jared molotovbliss

⚗️
Code, Eat, Sleep++;
  • DFW, Texas
View GitHub Profile
@kubaceg
kubaceg / mediaBackup.sh
Created June 16, 2014 09:55
magento media backup using rsync
#!/bin/bash
mediaPath="/var/www/magento/htdocs/media"
backupPath="/mnt/backup/media"
rsync -avr "$mediaPath/catalog" "$mediaPath/wysiwyg" "$mediaPath/categoriesDescription" --exclude="catalog/product/cache" --exclude=".thumbs" $backupPath
@piotrekkaminski
piotrekkaminski / swatchesfallback.patch
Last active August 29, 2015 14:09
[PATCH] Fixed issue where language fallback swatch images would not be loaded from media/wysiwyg/swatches
diff --git a/app/code/core/Mage/ConfigurableSwatches/Helper/Productimg.php b/app/code/core/Mage/ConfigurableSwatches/Helper/Productimg.php
index 2de62ed..c284811 100644
--- a/app/code/core/Mage/ConfigurableSwatches/Helper/Productimg.php
+++ b/app/code/core/Mage/ConfigurableSwatches/Helper/Productimg.php
@@ -227,6 +227,8 @@ class Mage_ConfigurableSwatches_Helper_Productimg extends Mage_Core_Helper_Abstr
$fileExt = self::SWATCH_FILE_EXT;
}
+ // normalize to all lower case so that value can be used as array key below
+ $value = Mage_ConfigurableSwatches_Helper_Data::normalizeKey($value);
<frontend>
<events>
<!-- logs -->
<controller_action_predispatch>
<observers><log><type>disabled</type></log></observers>
</controller_action_predispatch>
<controller_action_postdispatch>
<observers><log><type>disabled</type></log></observers>
</controller_action_postdispatch>
<customer_login>
@peterjaap
peterjaap / corehacks_in_git.sh
Last active August 29, 2015 14:19
Find Magento core hacks in Git
#/bin/bash
# This one liner starts looking in the current Git repo from the second commit
# and ends at HEAD, while looking for files changed in Git that are in the app/code/core dir
# Assumes that the first commit was the initial commit of the Magento core
# And assumes that there is no further Magento upgrade committed between the second commit and HEAD
# (otherwise all updated core files will still end up in the output)
git diff --name-only $(git log --pretty=format:%H:%B | cut -d: -f1 | grep -v '^$' | tail -2 | head -1) HEAD | grep "app/code/core"
@herveguetin
herveguetin / run_method.php
Created May 5, 2015 09:09
Call a Magento model / method from shell
#!/usr/bin/php -f
<?php
require_once 'abstract.php';
class Herve_Run_Method extends Mage_Shell_Abstract
{
protected function _parseArgs()
{
$attributeSetName = 'Editorial Product';
// active_from
$entityTypeId = Mage::getModel('eav/entity')
->setType('catalog_product')
->getTypeId();
$setId = $installer->getAttributeSet($entityTypeId, $attributeSetName, 'attribute_set_id');
// Add attribute set if it does not exists
if($setId === null) {
@milkfarm
milkfarm / counter.js
Created February 27, 2012 20:11
Prototype UJS Character Counter: Twitter-style character counter with optional input field truncation
/* Counter Script
* Requires Prototype Library
* By: <stuff@milkfarmproductions.com>
* http://milkfarmproductions.com
* This work is licensed under the Creative Commons Attribution-Share Alike 3.0
* http://creativecommons.org/licenses/by-sa/3.0/us/
*
* Requirements:
* - A 'texter' input field, the field to be counted
* - A 'counter' input field with class equal to 'countClass' variable, the field to contain the count
@jasonbaik
jasonbaik / gist:2327644
Created April 7, 2012 11:11 — forked from behrendtio/gist:2260890
Magento Snippets

Magento Snippets

Download extension manually using pear/mage

Pear for 1.4, mage for 1.5. File downloaded into /downloader/.cache/community/

./pear download magento-community/Shipping_Agent
./mage download community Shipping_Agent

Clear cache/reindex

@trev
trev / filter.phtml
Created April 13, 2012 06:11
Magento Color Attribute Swatches Implementation
<ol>
<?php foreach ($this->getItems() as $_item): ?>
<li>
<?php if ($_item->getCount() > 0): ?>
// Add attribute option image before label
<?php if($_item->getName() == "Color") : ?>
<img src="<?php echo Mage::helper('attributeoptionimage')->getAttributeOptionImage($_item->getValue()); ?>" alt="" />
<?php endif; ?>
<a href="<?php echo $this->urlEscape($_item->getUrl()) ?>"><?php echo $_item->getLabel() ?></a>
<?php else: echo $_item->getLabel() ?>
@peterdietz
peterdietz / fix-oscommerce-import-to-magento.diff
Created May 9, 2012 02:51
The Magento oscommerce-migration-tool is broken and needs to be manually patched to successfully import. This is the changes I had to do (picked it up from forum posts) to get the import to work. Also, make sure all products have images, and none of your
diff --git a/app/code/core/Mage/Oscommerce/Block/Adminhtml/Import/Run.php b/app/code/core/Mage/Oscommerce/Block/Adminhtml/Import/Run.php
index 4b5e822..7d46a2a 100644
--- a/app/code/core/Mage/Oscommerce/Block/Adminhtml/Import/Run.php
+++ b/app/code/core/Mage/Oscommerce/Block/Adminhtml/Import/Run.php
@@ -158,7 +158,7 @@ function sendImportData(data) {
new Ajax.Request("'.$this->getUrl('*/*/batchRun').'", {
- method: "post",
+ method: "get",