Magento update configurable option drop down on product detail page

create a configurable.phtml file in the given directory
and put the below code on that file..

Clear your cache and than refresh your browser.

 * Magento
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to so we can send you a copy immediately.
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to for more information.
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2014 Magento Inc. (
 * @license  Academic Free License (AFL 3.0)

$_product    = $this->getProduct();
$_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());
$_product    = $this->getProduct();
$_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());
<?php if ($_product->isSaleable() && count($_attributes)):?>

    <?php foreach($_attributes as $_attribute): ?>
        <label class="required"><em>*</em><?php echo $_attribute->getLabel() ?></label>        
            <span class="input-box">
                <select name="super_attribute[<?php echo $_attribute->getAttributeId() ?>]" 
id="attribute<?php echo $_attribute->getAttributeId() ?>" 
class="required-entry super-attribute-select">
                    <option><?php echo $this->__('Choose an Option...') ?></option>
    <?php endforeach; ?>
    <script type="text/javascript">
        var spConfig = new Product.Config(<?php echo $this->getJsonConfig() ?>);
 function replaceSelectOption() {
    jQuery(".super-attribute-select").each(function () {
        var drop_down = jQuery(this);
        drop_down.find("option[value!='']").each(function () {
            var option = jQuery(this);
            jQuery("<a>", {
                text: option.text(),
                href: '#product-options-wrapper',
                class: 'product_attribute_option_link',
                'data-id': drop_down.attr('id'),
                'data-name': drop_down.attr('name'),
                'data-value': option.val(),
                'data-label': option.text(),
                click: function () {
                    var obj = drop_down.get();
                    Event.observe(obj[0], 'change', function () {
                    fireEvent(obj[0], 'change');
                    var selected_combination = [];
                    jQuery(".super-attribute-select").each(function () {
                        if (jQuery(this).val()) {
                            jQuery(".product_attribute_option_link[data-value=" + jQuery(this).val() + "]").addClass('product_attribute_option_link_selected');
                    jQuery.each(selected_combination, function (index, selection) {
                        if (index + 1 < selected_combination.length)
                            jQuery('#selected_combination').append(" - ");
                    return false;

document.observe('dom:loaded', function () {

    jQuery(".product-view .add-to-cart .button.btn-cart").attr('onclick', '');
    jQuery(".product-view .add-to-cart .button.btn-cart").on('click', function () {
        var chk = true;
        jQuery(".input-box .product_attribute_option_link").each(function () {
            if (jQuery(this).hasClass("product_attribute_option_link_selected")) {
                chk = false;
                return false;
        if (chk) {
            jQuery("#product-options-wrapper .input-box").addClass('validation-failed');
            jQuery("#product-options-wrapper > p.required").css({
                display: 'block',
                position: 'absolute',
                right: '0',
                top: '30px',
                color: 'red'
            jQuery("#product-options-wrapper > p.required").fadeOut(3000, function () {
                jQuery("#product-options-wrapper .input-box").removeClass('validation-failed');
        else {


<?php endif;?>

Magento update product sku programmatically using csv

Put a skucsv.csv file which containt 2 columns.
1st column containt OLD sku list and 2nd column containt New sku list.
Create a updateProductSku.php file in root and paste below script on this file.

ini_set('display_errors', 1);
define('MAGENTO_ROOT', getcwd());
$mageFilename = 'app/Mage.php';
require_once $mageFilename;
$row = 1;

if (($handle = fopen("skucsv.csv", "r")) !== FALSE) {

    while (($sku = fgetcsv($handle, 1000, ",")) !== FALSE) {
 // $sku[0] OLD sku list
 // $sku[1] New sku list
        $product = Mage::getModel('catalog/product')->loadByAttribute('sku',
        if ($product && $product->getTypeId() == 'simple') {
            echo $sku[0].' Does not found SKU <br />';



Magento remove product from category programatically

Create a file in root directory of project and paste below code on that file and run this file on browser.
Please take a DB backup before use it.

In below script we are checking New category product From Date and To Date. if any product does not meet the date range than product automatically removed from that category

ini_set('display_errors', 1);
define('MAGENTO_ROOT', getcwd());
$mageFilename = '../app/Mage.php';
require_once $mageFilename;
$newCatId = 147; //category Id those you want to check it.

$cat = Mage::getModel('catalog/product')->setId($newCatId);
$collection = Mage::getModel('catalog/product')->getCollection()
$collection->addAttributeToFilter('status', 1);
$collection->addFieldToFilter(array(array('attribute' => 'visibility', 'neq' => "1")));

//Subtract 1 Day from current date
$date = strtotime(date('Y-m-d'));
$newDateDay = date('Y-m-d', strtotime('-1 day', $date)) . ' ' . date('H:i:s'); 

if (count($collection) > 0):
    foreach ($collection as $item):
        if (($item->getNewsFromDate() != '' && $item->getNewsFromDate() < date('Y-m-d H:i:s'))
                && ($item->getNewsToDate() == '' or $item->getNewsToDate() >= $newDateDay)) {
		// put the code that you want to meet the requirement
        } else {
            //Remove product from that category	    
		->removeProduct($newCatId,$item->getId());  // First Parameter is Category Id and Second is Product Id


// Indexing of the category
$process = Mage::getModel('index/indexer')->getProcessByCode('catalog_category_product');

magento change choose an option text in product detail page

It’s very simple to change the text of default Magento choose an option to size or whatever we want.

Go to your theme file location


Rplace this code 
 <script type="text/javascript">
        var spConfig = new Product.Config(<?php echo $this->getJsonConfig() ?>);

to this one

<script type="text/javascript">
        $jsonConfig = $this->getJsonConfig();
        $jsonConfig = str_replace("Choose an Option...", "Size", $jsonConfig);
    var spConfig = new Product.Config(<?php echo $jsonConfig; ?>);

magento pincode number digit validation

<input type="text" maxlength="6" placeholder="Zip/Postal Code*" class="input-text required-entry validate-length maximum-length-6 minimum-length-6 validate-digits" value="" id="billing:postcode" name="billing[postcode]" title="Pincode">

if you want to use any number of integer validation on input filed use this 2 syntax.
class=”input-text required-entry validate-length maximum-length-6 minimum-length-6 validate-digits”