Skip to content

Instantly share code, notes, and snippets.

Avatar

SNH_NL seansan

View GitHub Profile
@seansan
seansan / update_reviews.php
Created Dec 3, 2018
Magento 1.x script to copy product reviews from storeview A to B (and v.v.)
View update_reviews.php
<?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();
View cache collection
$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 Jun 25, 2016
Shopper theme full bestseller list support
View Bestsellerlist.phtml
<?php
/**
* Product list template
*
* @see Mage_Catalog_Block_Product_List
*/
?>
<?php
$_productCollection = $this->getCollection();
$helper = $this->helper('shoppersettings/image');
View language.phtml
<?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 Dec 9, 2014
Magento stock report
View stockstatus.php
<?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 Dec 9, 2014
Magento last 3 months sales report in excel (be aware of table prefix)
View revenue_last3month
<?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 Dec 18, 2015 — forked from antond/redis install
Install redis, phprdis and collinmollenhours extensions
View redis install
# 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 Oct 27, 2012
Retailtower multidomain
View productapi.php
<?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;
You can’t perform that action at this time.