Skip to content

Instantly share code, notes, and snippets.

@corpsefilth
corpsefilth / press-items.html
Created November 9, 2016 01:20
Press Item Code Snippets
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 September 18, 2015 22:03
Simple CSS media queries for mobile devices
/* 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 September 18, 2015 21:55
Extended CSS Media Queries Reference
/* --------------------------------------------------------- */
/* BASIC CSS ----------------------------------------------- */
/* --------------------------------------------------------- */
/* YOUR STYLES */
@corpsefilth
corpsefilth / wpattachedsamples.php
Created September 18, 2015 21:52
display list of attached images of a page or post excluding featured image
<?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 April 16, 2015 02:17
display simple product information from configurable product.
<?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 April 16, 2015 02:16
Configurable products, make first dropdown option selected by default -- does not work with configurable swatches, only default configurable dropdown.
<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 April 16, 2015 02:14
configurable swatches magento 1.9.1, make first option selected by default -- BETA -- not for production, you will need to make slight mods.
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 March 16, 2015 12:12
Rewrite all index.php out of url on front end but not backend in magento, add this to .htaccess file
## 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 March 16, 2015 11:49
Quick hack, make sure to run only once, paste at header of theme file. Adds custom field to category. Magento.
<?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 March 12, 2015 10:09
Create a clone of your menu -- sticky menu
// 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')