Skip to content

Instantly share code, notes, and snippets.

View steverobbins's full-sized avatar

Steve Robbins steverobbins

View GitHub Profile
<?php
final class Mage
{
// ...
public static function dispatchEvent($name, array $data = array())
{
$e = new Exception();
Mage::log(
$name . ': ' . implode(', ', array_keys($data)) . "\n"
#!/bin/bash
################################################################################
# FUNCTIONS
################################################################################
# 1. Check required system tools
_check_installed_tools() {
local missed=""
@steverobbins
steverobbins / Paypal.php
Last active April 22, 2024 12:18
PayPal API Requests
<?php
class Paypal
{
/**
* API Version
*/
const VERSION = 51.0;
/**
[xdebug]
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_autostart=1
xdebug.profiler_enable_trigger=1
zend_extension="/Applications/MAMP/bin/php/php5.5.3/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so"
@steverobbins
steverobbins / magento-fetch-media.php
Last active May 10, 2017 10:09
Download product media images to your local Magento store without rsync/ftp.
<?php
$range = array_merge(range('a', 'z'), range('A', 'Z'), range(0, 9), array('_'));
foreach ($range as $a) foreach ($range as $b) mkdir("$a/$b", 0777, true);
$db = new PDO('mysql:127.0.0.1;dbname=magento', 'root', 'root');
//$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
$result = $db->query('select distinct value from catalog_product_entity_media_gallery');
<?php
$code = 'color';
$opts = Mage::getSingleton('eav/config')
->getAttribute('catalog_product', $code)
->getSource()
->getAllOptions(false);
foreach($opts as $opt) {
<?php
include 'app/Mage.php';
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
umask(0);
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';
Mage::app($mageRunCode, $mageRunType);
<?php
/**
* Short description of module
*
* PHP version 5
*
* @category Kering
* @package Kering_Modulename
* @author Kering Magento Team <magento@kering.com>
* @copyright 2015 Kering
select
eu_flat.entity_id,
eu_flat.sku,
def_eav.value default_eav_price,
eu_eav.value eu_eav_price,
eu_flat.price eu_flat_price
from catalog_product_flat_3 eu_flat
inner join catalog_product_entity_decimal eu_eav
on eu_flat.entity_id = eu_eav.entity_id
and eu_eav.attribute_id = 75
<?php
ini_set('display_errors', 1);
include 'app/Mage.php';
Mage::setIsDeveloperMode(true);
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';
Mage::app($mageRunCode, $mageRunType);
$mail = new Zend_Mail();