Thursday 13 September 2018

How to Login with phone number without extension? [duplicate] in magento 1

Override Mage_Customer_AccountController to your local module and update loginPostAction function with below code.


    ......
    if ($this->getRequest()->isPost()) {
        $login = $this->getRequest()->getPost('login');
        // NEW CODE ADDED
        $phoneNumber = $login['username'];
        $customer = Mage::getResourceModel('customer/address_collection')
            ->addAttributeToSelect('telephone')
            ->addAttributeToFilter('telephone', $phoneNumber)
            ->getFirstItem()->getCustomer();
        if ($customer !== false) {
            $login['username'] = $customer->getEmail();
        }else{
            $login['username'] = $phoneNumber;
        }
        // NEW CODE COMPLETED
    .......

Tuesday 11 September 2018

How to display star rating summary in custom phtml page in magento 1

<?php if ($_rating['rating_summary']) {?>
  <div class="ratings">
      <div class="rating-box">
         <div class="rating" style="width:<?php echo $_rating['rating_summary']; ?>%"></div>
      </div>
  </div>
<?php } ?>

Tuesday 4 September 2018

Magento 2: Get product attribute’s select option id,label for configurable product




<?php
    $_helper = $this->helper('Magento\Catalog\Helper\Output');
    $_product = $block->getProduct();
    $optionId = $_product->getColor()
?>


$attr = $_product->getResource()->getAttribute('color');
 if ($attr->usesSource()) {
       $optionText = $attr->getSource()->getOptionText($optionId);
 }