Skip to content

Instantly share code, notes, and snippets.

@yireo
yireo / MageBridge robots.txt
Created July 18, 2014 10:55
Example robots.txt file for MageBridge environments
# Example robots.txt for MageBridge.
# Jooomla! is assumed to be in the root /
# Magento is assumed to be installed in /magento/
# MageBridge Root Menu-Item is assumed to have an URL /shop/
User-agent: *
Disallow: /administrator/
Disallow: /bin/
Disallow: /cache/
Disallow: /cli/
@yireo
yireo / fedora-screen-recording.md
Created March 18, 2015 12:02
Fedora screencasts ... the hard-core way

Fedora screencasts ... the hard-core way

1) Create a recording

Use vokoscreen to create a screencast with audio and video, optionally with webcam. Save as MKV file.

video-with-noise.mkv

Export to MPEG4 video and MP3 audio.

2) Extract audio from MKV

@yireo
yireo / vm2mage_plugin.php
Last active August 29, 2015 14:23
Vm2Mage plugin for manipulate VirtueMart data before migration to Magento
<?php
defined('_JEXEC') or die();
class PlgSystemCustom extends JPlugin
{
/**
* Plugin event dealing with raw VirtueMart data
*/
public function onVm2MageItemConvertBefore($item, $type)
{
@yireo
yireo / mage_passwordreset.php
Last active October 13, 2015 12:18
Script to reset customer password
<?php
require_once 'app/Mage.php';
Mage::app();
$password = 'password01';
$customerId = 1;
$customer = Mage::getModel('customer/customer')->load($customerId);
$customer->setPassword($password);
$customer->setConfirmation($password);
@yireo
yireo / yireo_bingtranslate_product.php
Last active December 17, 2015 00:49
Magento script to automate product-translations using the Yireo BingTranslate extension
<?php
// Basic settings
$storeCodes = array('french', 'german', 'danish', 'dutch');
$productAttributes = array('name', 'short_description', 'description');
// Initialize Magento
require_once 'app/Mage.php';
Mage::app();
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
@yireo
yireo / yireo_bingtranslate_basic.php
Last active December 17, 2015 00:58
Magento script to translate a specific text using the Yireo BingTranslate extension
<?php
// Basic settings
$text = 'Hello World';
$source = 'en';
$destination = 'fr';
// Startup the application
require_once 'app/Mage.php';
Mage::app();
@yireo
yireo / vm2mage_reset_customers.sql
Created May 6, 2013 13:19
Vm2Mage SQL-file to wipe out all Magento customers
-- Disable foreign key checks temporarily --
SET SQL_MODE='';
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO';
-- Reset all vm2mage information
TRUNCATE TABLE `vm2mage_categories`;
-- Reset all customer information
TRUNCATE TABLE `customer_address_entity`;
@yireo
yireo / vm2mage_reset_products.sql
Last active December 17, 2015 00:59
Vm2Mage SQL-file to wipe out all Magento products
-- Disable foreign key checks temporarily --
SET SQL_MODE='';
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO';
-- Reset all product information
TRUNCATE TABLE `catalog_product_bundle_option`;
TRUNCATE TABLE `catalog_product_bundle_option_value`;
TRUNCATE TABLE `catalog_product_bundle_selection`;
TRUNCATE TABLE `catalog_product_entity_datetime`;
@yireo
yireo / vm2mage_reset_categories.sql
Created May 6, 2013 13:18
Vm2Mage SQL-file to wipe out all Magento categories
-- Disable foreign key checks temporarily --
SET SQL_MODE='';
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO';
-- Reset all vm2mage information
TRUNCATE TABLE `vm2mage_categories`;
-- Reset all category information
TRUNCATE TABLE `catalog_category_entity`;
@yireo
yireo / yr_delete_urlrewrites.php
Last active December 19, 2015 00:09
Manually delete all entries from the core_url_rewrites folder (make sure to reindex afterwards)
<?php
require_once 'app/Mage.php';
Mage::app();
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
$urlRewrites = Mage::getModel('core/url_rewrite')->getCollection();
foreach($urlRewrites as $urlRewrite) {
$urlRewrite->delete();
}