Saturday, January 17, 2015

Add Class to fixed header

    <script>
    /*############fix menu##############*/
    jQuery("document").ready(function($){
    var nav = $('#menu');
    $(window).scroll(function () {
    if ($(this).scrollTop() > 136) {
    nav.addClass("f-nav");
    } else {
    nav.removeClass("f-nav");
    }
    });
   
    });
    </script>
<style>
.f-nav { .position :fixed;}
</style>

Friday, January 16, 2015

Magento -Magento how to get configurable product attributes option

<?php $cProduct = Mage::getModel('catalog/product')->load($_product->getId());
            //check if product is a configurable type or not
            if ($cProduct->getData('type_id') == "configurable")
            {
                //get the configurable data from the product
                $config = $cProduct->getTypeInstance(true);
                //loop through the attributes
                foreach($config->getConfigurableAttributesAsArray($cProduct) as $attributes)
                {
                    ?>
                    <dl>
                        <dt><label class="required"><em>*</em><?php echo $attributes["label"]; ?></label></dt>
                        <dd>
                            <div class="input-box">
                                <select name="super_attribute[<?php echo $attributes['attribute_id'] ?>]" id="attribute<?php echo $attributes['attribute_id'] ?>">
                                    <?php
                                    foreach($attributes["values"] as $values)
                                    {
                                        echo "<option>".$values["label"]."</option>";
                                    }
                                    ?>
                                </select>
                            </div>
                        </dd>
                    </dl>
                    <?php
                }
            }?>

Thursday, January 8, 2015

Magento - Custom layout in magneto like 1column

Follow the following steps :

Step 1.  add
app/etc/modules/Easylife_Layout.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Easylife_Layout>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <Mage_Page />
            </depends>
        </Easylife_Layout>
    </modules>
</config>

Step 2.  add
app/code/local/Easylife/Layout/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Easylife_Layout>
            <version>0.0.1</version>
        </Easylife_Layout>
    </modules>
    <global>
        <page>
            <layouts>
                <lookbook module="page" translate="label">
                    <label>Lookbook</label>
                    <template>page/1column-lookbook.phtml</template>
                    <layout_handle>lookbook</layout_handle>
                </lookbook>
            </layouts>
        </page>
    </global>
    <frontend>
        <layout>
            <updates>
                <easylife_layout>
                    <file>easylife_layout.xml</file>
                </easylife_layout>
            </updates>
        </layout>
    </frontend>
</config>
Step 3.  add
app/design/frontend/{interface}/{theme}/layout/easylife_layout.xml

<?xml version="1.0"?>
<layout>
    <lookbook translate="label">
        <label>Lookbook</label>
        <reference name="root">
            <action method="setTemplate"><template>page/1column-lookbook.phtml</template></action>
            <action method="setIsHandle"><applied>1</applied></action>
        </reference>
    </lookbook>
</layout>