Skip to content

Instantly share code, notes, and snippets.

View willboudle's full-sized avatar

Will Boudle willboudle

View GitHub Profile
@cmtickle
cmtickle / unbuffered_shell_example.php
Created January 31, 2018 14:55
Use unbuffered SQL queries with Magento to reduce memory usage on large data sets.
<?php
require_once 'abstract.php';
class Cmtickle_Demo_Shell_Tool extends Mage_Shell_Abstract
{
private $_readConnection = null;
protected function _getReadConnection()
{
@JeansBolong
JeansBolong / Magento2.md
Last active April 2, 2023 06:50
Magento2 CheatSheet

Magento 2 tutorial

http://devdocs.magento.com/guides/v2.1/frontend-dev-guide/bk-frontend-dev-guide.html
https://www.creare.co.uk/blog/magento/theming-in-magento-2-part-1
https://www.creare.co.uk/blog/magento/theming-in-magento-2-part-2
http://alanstorm.com/category/magento-2/

I have installed Magento 2 successfully, but icons are not displaying and not able to click anywhere in backend.

Please try running following command.

@cristianstan
cristianstan / Magento:XML: Remove Footer links.xml
Created February 26, 2014 09:50
Magento:XML: Remove Footer links
@anunay
anunay / magento-import-coupons-csv.php
Created February 13, 2014 21:57
Magento: Import Coupon Code with CSV
<?php
// Import coupon codes
// Thanks go out to Marius Strajeru
// Original URL: http://marius-strajeru.blogspot.nl/2010/04/create-bulk-discount-rules.html
require 'app/Mage.php';
Mage::app();
// Import CSV from ViArt format:
@drobinson
drobinson / form_key_checks.txt
Created December 11, 2013 16:38
List (and command that generated it) of places that form key validation has been added in 1.13.1
Controllers that have added form key validation:
$ git grep --files-with-matches "this->_validateFormKey())" <core_sources_update_commit_hash>
<core_sources_update_commit_hash>:app/code/core/Enterprise/Checkout/controllers/CartController.php
<core_sources_update_commit_hash>:app/code/core/Enterprise/GiftRegistry/controllers/IndexController.php
<core_sources_update_commit_hash>:app/code/core/Enterprise/GiftRegistry/controllers/ViewController.php
<core_sources_update_commit_hash>:app/code/core/Enterprise/Reward/controllers/CustomerController.php
<core_sources_update_commit_hash>:app/code/core/Enterprise/Wishlist/controllers/SearchController.php
<core_sources_update_commit_hash>:app/code/core/Mage/Catalog/controllers/Product/CompareController.php
<core_sources_update_commit_hash>:app/code/core/Mage/Checkout/controllers/CartController.php
@kalenjordan
kalenjordan / Batched Iterator for Magento collections
Last active May 9, 2022 12:25
Batched iterator for Magento collections
// This is how you would use it. Pass in your collection
// along with an individual callback as well as a batch callback
Mage::getSingleton('stcore/resource_iterator_batched')->walk(
$collection,
array($this, 'batchIndividual'),
array($this, 'batchAfter'),
self::BATCH_SIZE
);
public function batchIndividual($model)
<?php
//Table names and table prefixes
$tableName = Mage::getSingleton('core/resource')
getTableName('catalog_product_entity');
// if prefix was 'mage_' then the below statement
// would print out mage_catalog_product_entity
echo $tableName;
//Accessing the database connection resource
add_shortcode( 'custom-add-to-cart','custom_woocommerce_product_add_to_cart' );
/**
* Display a single prodcut price + cart button
*
* @access public
* @param array $atts
* @return string
*/
function custom_woocommerce_product_add_to_cart( $atts ) {
if (empty($atts)) return;
@molotovbliss
molotovbliss / gist:2562551
Last active September 7, 2022 20:18 — forked from davidalexander/gist:1086455
Magento Snippets

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