Skip to content

Instantly share code, notes, and snippets.

@bekapod
bekapod / query.sql
Created May 28, 2014 11:02
MAGENTO: Make all categories 'Anchor Categories'
SELECT * FROM eav_attribute where attribute_code = 'is_anchor';
-- Then replace the ? in the following query with the attribute_id shown from the previous query and run.
UPDATE catalog_category_entity_int set value = 1 where attribute_id = ?;
@bekapod
bekapod / template.php
Created January 30, 2014 17:54
MAGENTO: logging
Mage::log($message, null, 'mylogfile.log');
@bekapod
bekapod / local.xml
Created January 29, 2014 15:41
MAGENTO: Breadcrumbs on Account Pages
<?xml version="1.0"?>
<layout version="0.1.0">
<!--
///////////////////////////////////////////////////////
/////// BREADCRUMBS IN CUSTOMER ACCOUNT AREA ////////
///////////////////////////////////////////////////////
add default crumbs to display in all the customer account pages
this will add Home / My Account crubms.
-->
@bekapod
bekapod / mysql4-install-0.1.0.php
Created January 29, 2014 15:41
MAGENTO: Category Attributes
$installer->addAttribute(Mage_Catalog_Model_Category::ENTITY, 'is_showcase', array(
'type' => 'text', // varchar
'backend' => '',
'frontend' => '',
'label' => "Showcase category?",
'input' => 'select', // image
'class' => '',
'source' => 'eav/entity_attribute_source_boolean',
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
'visible' => true,
@bekapod
bekapod / head.phtml
Created October 25, 2013 09:21
MAGENTO: Translating text in JS File
<!-- AFTER getTranslateScript(); -->
<script>
Translator.add( 'Text to translate', '<?php echo $this->__( 'Text to translate' ); ?>' );
</script>
@bekapod
bekapod / local.xml
Created September 26, 2013 08:31
MAGENTO: Include a standard template block in local.xml
<!-- template attribute is relative to template directory -->
<block type="core/template" name="block-name" template="path/file.phtml" />
@bekapod
bekapod / gist:6639782
Created September 20, 2013 16:00
MAGENTO: Change admin password
UPDATE admin_user SET password=CONCAT(MD5('qXadmin123'), ':qX') WHERE username='admin';
@bekapod
bekapod / js.js
Last active November 28, 2016 11:03
JS: Equal height elements
var maxHeight = 0;
$("div").each(function(){
if ($(this).height() > maxHeight) { maxHeight = $(this).height(); }
});
$("div").height(maxHeight);
@bekapod
bekapod / local.xml
Created April 16, 2013 12:40
MAGENTO: Move product reviews to product page
<catalog_product_view>
<reference name="content">
<reference name="product.info">
<block type="review/product_view_list" name="product.info.product_additional_data" as="reviews" template="review/product/view/list.phtml">
<block type="review/form" name="product.review.form" as="review_form">
<block type="page/html_wrapper" name="product.review.form.fields.before" as="form_fields_before" translate="label">
<label>Review Form Fields Before</label>
<action method="setMayBeInvisible"><value>1</value></action>
<action method="setElementClass"><value>rewards</value></action>
</block>
@bekapod
bekapod / style.css
Last active December 15, 2015 07:29
CSS: Responsive Video
>> Wrapping the iframe in another element will give us the control we need to add proper responsive functionality to the video.
.video {
position: relative;
padding-bottom: 56.25%;
height: 0;
overflow: hidden;
}
.video iframe,
.video object,