Saturday, 27 October 2018

Magento 1.9 product Custom Options - make every first radio button checked

<script type="text/javascript">
var $j = jQuery.noConflict();
$j(document).ready(function(){

    $j('.options-list input.radio:first').attr('checked','checked');
    opConfig.reloadPrice();
});
</script>

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);
 }

Monday, 27 August 2018

Add the order number to the subject in order email template in magento 2

Re: Add the order number to the subject in order email template


{{trans "Your %store_name order confirmation" store_name=$store.getFrontendName()}} #{{var order.increment_id}}

Thursday, 23 August 2018

Customer Account Navigation links how to remove in magento 2

Customer Account Navigation links how to remove in magento 2

I created a file , inserted below, in app/design/frontend/Custom_VENDOR_Theme/My_Custom_THEME/Magento_Customer/layout/customer_account.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd" label="Customer My Account (All Pages)" design_abstraction="custom">
    <body>
        <!-- To Remove My Downloadable Products-->
        <referenceBlock name="customer-account-navigation-downloadable-products-link" remove="true"/>
        <!-- To Remove Billing Agreements-->
        <referenceBlock name="customer-account-navigation-billing-agreements-link" remove="true"/>
        <!-- To Remove My Credit Cards-->
        <referenceBlock name="customer-account-navigation-my-credit-cards-link" remove="true"/>
 
<move element="customer-account-navigation-quotes-link" destination="customer_account_navigation" after="customer-account-navigation-orders-link"/>

    </body>
</page>

Wednesday, 11 July 2018