Skip to content

Instantly share code, notes, and snippets.

View dfelton's full-sized avatar

Darren Felton dfelton

View GitHub Profile
@dfelton
dfelton / hideSimpleOfConfigurable.sql
Last active May 12, 2016 17:23
Magento - Hide ALL simple products that are a child of a configurable product
UPDATE
`catalog_product_entity_int`
SET
`value` = '1'
WHERE
`attribute_id` = (
SELECT
`attribute_id`
FROM
`eav_attribute`
@dfelton
dfelton / 000 - sync.md
Last active August 30, 2016 15:37
Magento - Syncs a live DB into a development db and updates Magento's base URLs to a localhost URL

Scripts for synching a development Magento database database with it's live counterpart.

@dfelton
dfelton / Adminhtml.php
Last active May 18, 2016 16:03
Magento - Add Webform drop down to CMS Pages (Works with VladimirPopov_WebForms)
<?php
// app/code/local/FirstScribe/ModuleName/Model/Observer/Adminhtml.php
/**
* Observer class. Public method names correspond directly to the event which
* they observe.
*
* @category FirstScribe
* @package FirstScribe_ModuleName
* @author ${author}
* @version ${date}
@dfelton
dfelton / 000 - region selector.md
Last active July 22, 2016 20:57
Magento - Add region selector to custom entities

Adds a Region Selector to custom Magento entity types that have standard address attributes.

@dfelton
dfelton / simple-of-configurable-apply-base-image.php
Last active May 26, 2016 19:34
Finds simple products which belong to a configurable, and have no base image. Then assigns the base image from the configurable to that simple product.
<?php
/**
* Finds simple products which belong to a configurable, and have no base image.
* Then assigns the base image from the configurable to that simple product.
*
* @category FirstScribe
* @package FirstScribe_Shell
* @author Darren Felton
*/
@dfelton
dfelton / simple-of-grouped-apply-base-image.php
Last active May 26, 2016 19:30
Finds simple products which belong to a grouped product, and have no base image. Then assigns the base image from the grouped product to that simple product.
<?php
/**
* Finds simple products which belong to a grouped product, and have no base image.
* Then assigns the base image from the grouped product to that simple product.
*
* @category FirstScribe
* @package FirstScribe_Shell
* @author Darren Felton
*/
@dfelton
dfelton / uploadModelFile.php
Last active June 2, 2016 18:56
Reusable file upload logic for Magento Models. Good for use in observer classes when image fields have been added to flat table entities such as CMS Page objects.
<?php
// Example Usage for cms/page objects.
// cms_page_prepare_save event observer logic:
//
// $model = $observer->getEvent()->getPage();
// $this->processFile($model, 'image_1', 'cms/page', array('jpg', 'jpeg', 'png', 'bmp', 'gif'));
/**
@dfelton
dfelton / 000 - Magento SQL Snippets.md
Last active November 22, 2021 15:15
Useful SQL snippets for a Magento store.

Numerous SQL snippets to reference for pulling data straight from Magento's database.

All SQL snippets assume there is no database table name prefix configured. In the event that your database does have a table nameprefix, you should be able to simply update the original table names found in the "FROM" and "LEFT JOIN" declarations. All table names are aliased therefore a full revision of the SQL snippets would not be necessary.

@dfelton
dfelton / 000 - Magento - Instagram Feed
Last active March 4, 2019 20:54
Instagram Feed for Magento
Instructions on how to add an Instagram Feed to a Magento Site.
Includes:
Block Class w/ base template for rendering the feed
System -> Configuration options for connecting to the client's Instagram account
Default CSS Styles
@dfelton
dfelton / 1-styles.min.css
Last active June 10, 2016 15:26
A better styles.css for Magento's rwd package.
.item-options dt,.product-pricing .benefit,.tier-prices .benefit,.tier-prices-grouped .benefit,dfn{font-style:italic}article,aside,details,figcaption,figure,footer,header,hgroup,img,nav,section,summary{display:block}abbr,acronym,body,fieldset,html,img,legend{border:0}.block .actions:after,.buttons-set:after,q:after,q:before{content:''}.bml-checkout-type,.map-popup .map-popup-checkout .additional-addtocart-box li{list-style-type:none}audio,canvas,video{display:inline-block}audio:not([controls]){display:none;height:0}[hidden]{display:none}html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-tap-highlight-color:transparent;-webkit-text-size-adjust:100%}body{margin:0;background:#FFF}a:focus{outline:#3091c2 dotted thin;color:#143d52}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}mark{background:#ff0;color:#000}code,kbd,pre,samp{font-family:monospace,serif;font-size:1em}pre{white-space:pre;white-space:pre-wrap;word-wrap:break-word}q{quotes:"\201C" "\201D" "\2018" "