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
@pinedamg
pinedamg / export-attributes.markdown
Created August 2, 2012 14:15
Magento Attributes
@wonderfan
wonderfan / gist:4011192
Created November 4, 2012 10:21
Magento Code Snippets For CSV Report
public function statAction(){
$fileName = 'report.csv';
$io = new Varien_Io_File();
$path = Mage::getBaseDir('var') . DS . 'export' . DS;
$name = md5(microtime());
$file = $path . DS . $name . '.csv';
$io->setAllowCreateFolders(true);
$io->open(array('path' => $path));
$io->streamOpen($file, 'w+');
$io->streamLock(true);
@ajankovic
ajankovic / magento-assign-image.php
Created November 14, 2012 17:39
Assign existing media gallery image to the loaded product.
$product = Mage::getModel('catalog/product')
->setStoreId($store->getId())
->load($product->getId());
$gallery = $product->getMediaGallery();
$mediaAttribute = array('image', 'small_image', 'thumbnail');
if($gallery && count($gallery['images'])) {
$product_attributes = $product->getTypeInstance()->getSetAttributes();
$gal_backend = $product_attributes['media_gallery']->getBackend();
@philwinkle
philwinkle / compare-core-mods.sh
Last active December 12, 2015 05:49
MD5 Comparison snapshot of current Magento release files. Works and tested on OSX, CentOS; though OSX requires md5 instead of md5sum
#!/bin/bash
find app/code/core/Mage app/code/core/Enterprise app/code/core/Zend lib/Varien lib/Mage lib/Zend -type f | grep -v '\.svn' | sort -d -f -k1 | xargs md5sum | awk {'print $2, $1'} > 1.11.2.0.local.md5
diff 1.11.2.0.base.md5 1.11.2.0.local.md5
@hans2103
hans2103 / noindex.xml
Created October 21, 2013 10:45
Reduce Magento resources using meta tag robots. Copy to your version of local.xml
<!--
SET META ROBOTS
-->
<!--
Search pages
-->
<catalogsearch_result_index>
<reference name="head">
<action method="setRobots"><meta>NOINDEX,NOFOLLOW</meta></action>
</reference>
find . -name "*.phtml" -print | xargs grep --color=auto -iRnH "Mage::getModel("
find . -name "*.phtml" -print | xargs grep --color=auto -iRnH "Mage::getResourceModel("
find . -name "*.phtml" -print | xargs grep --color=auto -iRnH "Mage::getSingleton("
find . -name "*.phtml" -print | xargs grep --color=auto -iRnH "SELECT.*FROM.*;[\"\']"
find . -name "*.php" -print | xargs grep --color=auto -iRnH "htmlEscape("
find ./app/code/local -name "*.php" -print | xargs grep --color=auto -iRnH "htmlEscape("
find ./app/code/local -name "*/Block/*.phtml" -print | xargs grep --color=auto -iRnH "SELECT.*FROM.*;[\"\']"
find ./app/code/local -name "*.php" -print | xargs grep --color=auto -iRnH "\$_[GET|REQUEST|SERVER|POST]"
find ./app/code/local -name "*.php" -print | xargs grep --color=auto -iRnH "public _construct"
find . -name "*.php" -print | xargs grep --color=auto -iRnH "public _construct"
@hans2103
hans2103 / price.phtml M1.8
Last active December 29, 2015 02:49
Implementation of structured data itemprop=price on app/design/frontend/<your_package>/<your_theme>/template/catalog/product/price.phtml - Magento 1.8.0.0 - http://schema.org/Offer - more information: http://www.byte.nl/blog/magento-rich-snippets-made-easy/
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
@peterjaap
peterjaap / magentoUpgradeCheck.sh
Last active February 4, 2016 18:59
This small script lists files that have significant changes done to them with the last Magento upgrade. Run this under the same user that did the update. It'll ignore files that are new or only have changes in the comment section (ie Copyright update). Use the upgrade git commit reference hash as your first argument. This script assumes your Mag…
#!/bin/bash
if [ ! "$1" ]; then
echo "No commit reference found! Please add the commit hash of your upgrade."
exit
fi
function echocolor() { # $1 = string
COLOR='\033[1;33m'
NC='\033[0m'
Malware that steal card numbers during checkout, targeting Magento based stores
www.3guysgolfcarts.com - Regexp("onepage|checkout")
www.marisaperry.com - eval(atob(
bocolife.com - regexp('onestepcheckout')
www.vimedis.fr - regexp("checkout")
some others to try
https://accesscards.co.uk
https://www.actiumplus.dk
@Marko-M
Marko-M / magento_dump_ssh.sh
Last active February 8, 2016 11:00
One-liner dump Magento database trough SSH directly to your machine
#!/bin/bash
# Marko Martinović
# Print command traces
set -x
# SSH user
SSHUSER=""
# SSH host