Skip to content

Instantly share code, notes, and snippets.

@corpsefilth
corpsefilth / press-items.html
Created Nov 9, 2016
Press Item Code Snippets
View press-items.html
working code sample
<div class="col col-md-3 col-sm-6 col-xs-12 press-item editorial digital wrapper featured">
<div class="pressitemholder press-padder">
<a href="{{media url='wysiwyg/press/Online_WhoWhatWear-2.9.16.jpg'}}" title="WHO WHAT WEAR February 2016" class="lightbox pressanchor"></a>
<img src="{{media url="wysiwyg/press/Online_WhoWhatWear-2.9.16.jpg"}}" alt="" />
<div class="press-item-title">
<div class="press-title-wrap">
<span class="maintitle">WHO WHAT WEAR</span>
<span class="subtitle">February 2016</span>
</div>
@corpsefilth
corpsefilth / mediaqueries.css
Created Sep 18, 2015
Simple CSS media queries for mobile devices
View mediaqueries.css
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
@media only screen
and (min-width : 321px) {
@corpsefilth
corpsefilth / mediaqueriesextended.css
Created Sep 18, 2015
Extended CSS Media Queries Reference
View mediaqueriesextended.css
/* --------------------------------------------------------- */
/* BASIC CSS ----------------------------------------------- */
/* --------------------------------------------------------- */
/* YOUR STYLES */
@corpsefilth
corpsefilth / wpattachedsamples.php
Created Sep 18, 2015
display list of attached images of a page or post excluding featured image
View wpattachedsamples.php
<?php
//get featured image ID
$thumb_ID = get_post_thumbnail_id( $post->ID );
//attachement loop - with exclude argument for featured image
$args = array(
'orderby' => 'menu_order',
'post_type' => 'attachment',
'post_parent' => get_the_ID(),
'post_mime_type' => 'image',
@corpsefilth
corpsefilth / simpleinfo.php
Created Apr 16, 2015
display simple product information from configurable product.
View simpleinfo.php
<?php
if($_product->getTypeId() == "configurable"):
$conf = Mage::getModel('catalog/product_type_configurable')->setProduct($_product);
$simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions();
foreach($simple_collection as $simple_product){
echo $simple_product->getSku() . " - " . $simple_product->getName() . " - " . Mage::helper('core')->currency($simple_product->getPrice()) . "<br>";
}
endif;
?>
@corpsefilth
corpsefilth / dropdownSelect.php
Created Apr 16, 2015
Configurable products, make first dropdown option selected by default -- does not work with configurable swatches, only default configurable dropdown.
View dropdownSelect.php
<script>
//we create new function
spConfig.setInitialState = function(dropdown_id) {
//select dropdown
var dropdown = $(dropdown_id);
//remove empty option from dropdown so it is not selectable after initial selection
@corpsefilth
corpsefilth / spConfigIndex.js
Created Apr 16, 2015
configurable swatches magento 1.9.1, make first option selected by default -- BETA -- not for production, you will need to make slight mods.
View spConfigIndex.js
function fireEvent(element,event)
{
if (document.createEventObject)
{
// dispatch for IE
var evt = document.createEventObject();
return element.fireEvent('on'+event,evt);
}
else
{
@corpsefilth
corpsefilth / .htaccess
Created Mar 16, 2015
Rewrite all index.php out of url on front end but not backend in magento, add this to .htaccess file
View .htaccess
## rewrite everything else to index.php
RewriteRule .* index.php [L]
RewriteCond %{REQUEST_URI} !^/index.php/admin/
RewriteCond %{REQUEST_URI} !^/index.php/admin
RewriteRule ^index.php/(.*) /$1 [R=301,QSA,L]
@corpsefilth
corpsefilth / CategoryCustomField.php
Created Mar 16, 2015
Quick hack, make sure to run only once, paste at header of theme file. Adds custom field to category. Magento.
View CategoryCustomField.php
<?php
require_once('app/Mage.php');
Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID));
$installer = new Mage_Sales_Model_Mysql4_Setup;
$attribute = array(
'type' => 'text',
'label'=> 'Custom Title',
'input' => 'textarea',
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
'visible' => true,
@corpsefilth
corpsefilth / menucloner.js
Created Mar 12, 2015
Create a clone of your menu -- sticky menu
View menucloner.js
// Create a clone of the menu, right next to original.
jQuery('.header')
.addClass('original')
.clone().insertAfter('.header')
.addClass('cloned')
.css('position','fixed')
.css('top','0')
.css('margin-top','0')
.css('z-index','500')
.removeClass('original')