Friday, May 20, 2011

DOB select boxes on Magento customer registration form

<?php echo $this->getLayout()->createBlock('customer/widget_dob')
   ->setDate($this->getCustomer()->getDob())
   ->toHtml() ?>

For checkout/onepage/billing.phtml:

<?php echo $this->getLayout()->createBlock('customer/widget_dob')
   ->setDate($this->getCustomer()->getDob())
   ->setFieldIdFormat('billing:%s')
   ->setFieldNameFormat('billing[%s]')
   ->toHtml() ?>

NOTE: Regarding styles - if we leave it this way, we'll move it to boxes.css
      Alternatively we could calculate widths automatically using block input parameters.
*/

/**
 * @see Mage_Customer_Block_Widget_Dob
 */
?>
<label for="<?php echo $this->getFieldId('month')?>"<?php if ($this->isRequired()) echo ' class="required"' ?>><?php if ($this->isRequired()) echo '<em>*</em>' ?><?php echo $this->__('Date of Birth') ?></label>
<div class="input-box customer-dob">
<?php
    $this->setDateInput('d',
        '<div class="dob-day">
             <input type="text" id="' . $this->getFieldId('day') . '" name="' . $this->getFieldName('day') . '" value="' . $this->getDay() . '" title="' . $this->__('Day') . '" class="input-text validate-custom" ' . $this->getFieldParams() . '  />
             <label for="' . $this->getFieldId('day') . '">' . $this->__('DD') . '</label>
         </div>'
    );?>
<select name="nday" id="nday" onchange="getElementById(<?php echo $this->getFieldId('day');?>).value=this.value" style="width:90px;">
<option value="">Select</option>
<?php
for($i=1;$i<=31;$i++)
{
echo "<option value='".$i."'>".$i."</option>";
}
?>
</select>
<select name="nmon" id="nmon" onchange="getElementById(<?php echo $this->getFieldId('month');?>).value=this.value" style="width:90px;">
<option value=''>Select</option>
<?php echo '<option value="">'.$this->__("Select").'</option>'.'<option value="01">'.$this->__("January").'</option>'.'<option value="02">'.$this->__("February").'</option>'.'<option value="03">'.$this->__("March").'</option>'.'<option value="04">'.$this->__("April").'</option>'.'<option value="05">'.$this->__("May").'</option>'.'<option value="06">'.$this->__("June").'</option>'.'<option value="07">'.$this->__("July").'</option>'.'<option value="08">'.$this->__("August").'</option>'.'<option value="09">'.$this->__("September").'</option>'.'<option value="10">'.$this->__("October").'</option>'.'<option value="11">'.$this->__("November").'</option>'.'<option value="12">'.$this->__("December").'</option>'; ?>
</select>
<select name="nyear" id="nyear" onchange="getElementById(<?php echo $this->getFieldId('year'); ?>).value=this.value" style="width:90px;">
<option value="">Select</option>
<?php
for($j=date('Y')-80;$j<=date('Y');$j++)
{
echo "<option value='".$j."'>".$j."</option>";
}
?>
</select>
</p>
<?php
    $this->setDateInput('m',
        '<div class="dob-month">
             <input type="text" id="' . $this->getFieldId('month') . '" name="' . $this->getFieldName('month') . '" value="' . $this->getMonth()  . '" title="' . $this->__('Month')  . '" class="input-text validate-custom" ' . $this->getFieldParams()  . '/>
             <label for="' . $this->getFieldId('month') . '">' . $this->__('MM')  . '</label>
         </div>'
    );

    $this->setDateInput('y',
        '<div class="dob-year">
             <input type="text" id="' . $this->getFieldId('year') . '" name="' . $this->getFieldName('year') . '" value="' . $this->getYear()  . '" title="' . $this->__('Year')  . '" class="input-text validate-custom" ' . $this->getFieldParams()  . ' />
             <label for="' . $this->getFieldId('year') . '">' . $this->__('YYYY')  . '</label>
         </div>'
    );
?>
 <?php echo $this->getSortedDateInputs() ?>
    <div class="dob-full" style="display:none;">
        <input type="hidden" id="<?php echo $this->getFieldId('dob')?>" name="<?php echo $this->getFieldName('dob')?>" />
    </div>

    <div class="validation-advice" style="display:none;"></div>
</div>
<script type="text/javascript">
//<![CDATA[
    var customer_dob = new Varien.DOB('.customer-dob', <?php echo $this->isRequired() ? 'true' : 'false' ?>, '<?php echo $this->getDateFormat() ?>');
//]]>
</script>



Friday, May 6, 2011

how to show product's more review images in main zoom frame in magento


replace the following line of code in ..../template/catalog/view/media.phtml
<li>
<a href="#" onclick="popWin(’<?php echo $this->getGalleryUrl($_image) ?>’, ‘gallery’, ‘width=200,height=200,left=0,top=0,location=no,status=yes,scrollbars=yes,resizable=yes’); return false;” title="<?php echo $this->htmlEscape($_image->getLabel()) ?>"><img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(56); ?>” width="56" height="56" alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>” /></a>
</li>
to
<li>
<a href="[removed]void(0)" onclick=’document.getElementById("image").setAttribute("src","<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(256); ?>")’ title="<?php echo $this->htmlEscape($_image->getLabel()) ?>"><img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(56); ?>” width="56" height="56" alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>” /></a>
</li>
and enjoy....