Skip to content

Instantly share code, notes, and snippets.

View keuzenkamp's full-sized avatar

Pieter Keuzenkamp keuzenkamp

View GitHub Profile
wget http://www.magentocommerce.com/downloads/assets/1.7.0.2/magento-1.7.0.2.tar.gz
tar -xzvf magento-1.7.0.2.tar.gz
rm magento-1.7.0.2.tar.gz
cd magento
wget http://www.magentocommerce.com/downloads/assets/1.6.1.0/magento-sample-data-1.6.1.0.tar.gz
tar -xzvf magento-sample-data-1.6.1.0.tar.gz
mv magento-sample-data-1.6.1.0/media/* media/
mv magento-sample-data-1.6.1.0/magento_sample_data_for_1.6.1.0.sql data.sql
mysql -u magie -p
# On mysql shell
#!/bin/bash
# convertImages.sh
# Author: Peter Jaap Blaakmeer (elgentos.nl)
# https://gist.github.com/peterjaap/7080989
NEWQUALITY=80
NEWSIZE=1000
DIRECTORY=media/catalog/product/
du -hs $DIRECTORY
<?php
protected function _getProducts($productIds, $storeId, $entityId, &$lastEntityId)
{
$products = array();
$websiteId = Mage::app()->getStore($storeId)->getWebsiteId();
$adapter = $this->_getReadAdapter();
if ($productIds !== null) {
if (!is_array($productIds)) {
$productIds = array($productIds);
<?php
require_once("app/Mage.php");
Mage::app();
$orders = Mage::getModel('sales/order')->getCollection();
$i = 0;
foreach ($orders as $key => $order) {
if (!$i) {
$startDate = strtotime($order->getCreatedAt());
<?php
/*
* This script deletes duplicate images and imagerows from the database of which the images are not present in the filesystem.
* It also removes images that are exact copies of another image for the same product.
* And lastly, it looks for images that are on the filesystem but not in the database (orphaned images).
*
* This script can most likely be optimized but since it'll probably only be run a few times, I can't be bothered.
*
* Place scripts in a folder named 'scripts' (or similar) in the Magento root.
<catalogsearch_result_index translate="label">
<reference name="head">
<action method="setRobots"><value>NOINDEX,NOFOLLOW</value></action>
</reference>
</catalogsearch_result_index>
<catalogsearch_advanced_index translate="label">
<reference name="head">
<action method="setRobots"><value>NOINDEX,NOFOLLOW</value></action>
</reference>
</catalogsearch_advanced_index>
SELECT @ATTRIBUTE_ID := attribute_id FROM eav_attribute WHERE attribute_code = 'ATTRIBUTE_CODE';
UPDATE eav_attribute SET backend_model = 'eav/entity_attribute_backend_array', backend_type = 'varchar', frontend_input = 'multiselect' WHERE attribute_id = @ATTRIBUTE_ID;
INSERT INTO catalog_product_entity_varchar (entity_type_id, attribute_id, store_id, entity_id, value) SELECT entity_type_id, attribute_id, store_id, entity_id, value FROM catalog_product_entity_int WHERE attribute_id = @ATTRIBUTE_ID;
DELETE FROM catalog_product_entity_int WHERE attribute_id = @ATTRIBUTE_ID;
<?
// Preliminary work
error_reporting(E_ALL);
$start = microtime(true);
require 'app/Mage.php';
ini_set('default_socket_timeout',48000);
$resource = Mage::getModel('core/resource');
<?php
chdir(dirname(__FILE__));
require_once '../app/Mage.php';
Mage::app();
umask(0);
require_once 'countries.php'; // import lists with all countries
// UK Island shipping rates; http://www.crearegroup-ecommerce.co.uk/blog/magento-advice/shipping-rates-to-the-uk-islands.php
<?php
// Base-name
$name = 'foobar';
// Init Magento
require_once 'app/Mage.php';
Mage::app();
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
// Create the root catalog