Skip to content

Instantly share code, notes, and snippets.

View seansan's full-sized avatar

SNH_NL seansan

View GitHub Profile
@seansan
seansan / update_reviews.php
Created December 3, 2018 10:43
Magento 1.x script to copy product reviews from storeview A to B (and v.v.)
<?php
error_reporting(~0); ini_set('display_errors', 1);
// adjust for where your file is, ours is in protected subdirectory of /
define('MAGENTO_ROOT', dirname(dirname(__FILE__)));
$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
require_once $mageFilename;
umask(0);
Mage::app();
$store_id = Mage::app()->getStore()->getId();
$rootId = Mage::app()->getStore($store_id)->getRootCategoryId();
$catCollection = $_product->getCategoryCollection()->addAttributeToSelect('name')->addUrlRewriteToResult()
->addIsActiveFilter()->addFieldToFilter('path', array('like'=> "1/$rootId/%"))->setOrder('id','ASC');
$cache = Mage::app()->getCache(); // [TODO] Cache the collection result not sure if this works
$cache->setLifetime(28800);
$catCollection->initCache($cache,'customcategoryfilter_', array('collections'));
@seansan
seansan / Bestsellerlist.phtml
Created June 25, 2016 10:13
Shopper theme full bestseller list support
<?php
/**
* Product list template
*
* @see Mage_Catalog_Block_Product_List
*/
?>
<?php
$_productCollection = $this->getCollection();
$helper = $this->helper('shoppersettings/image');
<?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
@seansan
seansan / stockstatus.php
Created December 9, 2014 08:18
Magento stock report
<?php
// define('MAGENTO_ROOT', getcwd());
define('MAGENTO_ROOT', dirname(dirname(__FILE__)));
$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
require_once $mageFilename;
// umask(0);
ini_set('display_errors', 1);
@seansan
seansan / revenue_last3month
Created December 9, 2014 08:17
Magento last 3 months sales report in excel (be aware of table prefix)
<?php
error_reporting(0); ini_set('display_errors', 1);
// define('MAGENTO_ROOT', getcwd());
define('MAGENTO_ROOT', dirname(dirname(__FILE__)));
$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
require_once $mageFilename;
umask(0);
@seansan
seansan / redis install
Last active December 18, 2015 21:18 — forked from antond/redis install
Install redis, phprdis and collinmollenhours extensions
# 1.CentOS 6.3
# yum install make gcc
cd /opt
wget http://redis.googlecode.com/files/redis-2.6.14.tar.gz
tar zxf redis-2.6.14.tar.gz
cd redis-2.6.14
make
make install
@seansan
seansan / productapi.php
Created October 27, 2012 08:52
Retailtower multidomain
<?php
set_time_limit(1600);
ini_set('memory_limit', '-1');
include_once 'app/Mage.php';
umask(0);
Mage::app();
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';
$_storeId = null;