Skip to content

Instantly share code, notes, and snippets.

<?php
// Basic settings
$storeCodes = array('bork');
$attributes = array('name', 'description');
$categoryIds = array();
// Initialize Magento
require_once 'app/Mage.php';
Mage::app();
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
@yireo
yireo / .gitignore
Created July 16, 2017 11:11
Magento 2 gitignore file
# Metadata
/.buildpath
/.cache
/.metadata
/.project
/.settings
atlassian*
/nbproject
/sitemap
/.idea
<?php
// Basic settings
$storeCodes = array('french');
$attributes = array('name', 'description');
$categoryIds = array(4);
// Initialize Magento
require_once 'app/Mage.php';
Mage::app();
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
@yireo
yireo / getSkuById.php
Created April 9, 2016 07:29
Magento function to fetch Magento product SKU by ID
<?php
function getSkuById($productId)
{
$productResourceModel = Mage::getResourceModel('catalog/product');
$adapter = Mage::getSingleton('core/resource')->getConnection('core_read');
$select = $adapter->select()
->from($productResourceModel->getEntityTable(), 'sku')
->where('entity_id = :entity_id');
$bind = array(':entity_id' => (string)$productId);
$productSku = $adapter->fetchOne($select, $bind);
@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 / phpstorm_xdebug_gnome.md
Last active July 30, 2022 17:35
Open up XDebug links in PhpStorm under Gnome

Open up XDebug links in PhpStorm under Gnome

Configure XDebug in PHP

Open up your XDebug file (possibly /etc/php.d/15-xdebug.ini) and configure XDebug:

xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.file_link_format="phpstorm://open?file=%f&line=%l"

Restart your webserver to activate XDebug.

@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 / phpbrew-install.md
Last active March 25, 2020 14:32
phpbrew installation on Fedora

Installation notes for phpbrew on Fedora

Pre-install

Getting the dependancies right:

$ yum install libxml2-devel openssl-devel curl-devel \
      bzip2-devel libmcrypt-devel readline-devel \
      libxslt-devel httpd-devel

Brewing PHP

@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 / evaldecode.php
Created June 24, 2014 15:23
Decode evil scripts encoded with eval(gzinflate(base64_decode()))
<?php
/*
* Basic script to decrypt files encoded with eval(gzinflate(base64_decode($data)));
*/
$file = 'encrypted.php';
$content = file_get_contents($file);
function evaldecode($content, $step = 0) {
//echo "STEP $step\n";