Blogs

  1. How to Auto Approve Product Review For Registered Customers in Magento 2

    Follow the steps to auto approve the product review for registered customers in magento 2 Create registration.php Directory app\code\VendorName\ModuleName\registration.php Content of registration.php <?php\Magento\Framework\Component\ComponentRegistrar::register(    \Magento\Framework\Component\ComponentRegistrar::MODULE, &
    Read more
  2. How to Override JS File in Magento 2

    To override the JS file in Magento 2 Create registration.php Directory app\code\VendorName\ModuleName\registration.php Content of registration.php <?php\Magento\Framework\Component\ComponentRegistrar::register(\Magento\Framework\Component\ComponentRegistrar::MODULE, 'VendorName_ModuleName', __DIR__); Create module.xml Directory app\code\
    Read more
  3. How To Pass Parameter To URL In Magento 2 Programmatically

    To pass a parameter to URL in Magento 2 follow this method Create Data.php Directory app\code\VendorName\ModuleName\Helper\Data.php Content of Data.php <?phpnamespace VendorName\ModuleName\Helper; use Magento\Framework\App\Helper\Context;use Magento\Framework\UrlInterface; class Data extends AbstractHelper{    protected $
    Read more
  4. How To Get Customer Address Data By Address ID In Magento 2 Programmatically

    To get the customer address data by address id in Magento 2 Directory Create the GetCustomerAddress.php file in the directory mentioned below, app/code/VendorName/ModuleName/Model/GetCustomerAddress.php Content of GetCustomerAddress.php <?php namespace VendorName\ModuleName\Model; use Magento\Customer\Api\AddressRepositoryInterface;
    Read more
  5. How To Check If The Current Area Is Frontend Or Backend In Magento 2

    There are two methods to check if the current area is frontend or backend in Magento 2 with Object Manager $objectManager = \Magento\Framework\App\ObjectManager::getInstance();$state = $objectManager->get('Magento\Framework\App\State');echo $state->getAreaCode(); With Class Method <?phpnamespace VendorName\ModuleName\Block;use Magento\
    Read more
  6. Show Loader till Ajax Call not Completed in Magento 2

    Add the following code to show the loader till ajax call is not completed in Magento 2 jQuery.ajax({    url: url,    type: 'POST',    dataType: 'json',    showLoader: true //use to display loader }).done(function (data) {    return true;}); To start the loader on the ajax call, add the
    Read more
  7. Steps to get store information on Magento 2 checkout page by Knockout Js

    Follow the following steps to get the store the information on Magento 2 Create di.xml Directory app/code/VendorName/ModuleName/etc/frontend/di.xml Content of di.xml <?xml version="1.0"?><config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="lib/internal/Magento/Framework/ObjectManager/etc/config.
    Read more
  8. How to Apply OR Conditions To Collection In Magento 2

    You can use OR & AND condition to collection in magento 2 For AND Condition use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;protected $productCollectionFactory;public function __construct(CollectionFactory $productCollectionFactory){$this->productCollectionFactory = $productCollectionFactory;}$collection = $this->
    Read more
  9. How To Load Email Template By Template ID In Magento 2

    Method to load Email template by template ID in Magento 2 To load the Email template by template Id paste the following code. <?php namespace VendorName\ModuleName\Helper; use Magento\Framework\App\Helper\AbstractHelper;use Magento\Framework\App\Helper\Context;use Magento\Email\Model\Template as coreTemplate; class Data extends
    Read more
  10. How To Remove Search From Header In Magento 2 Programmatically

    Method to remove search from the header in Magento 2 To remove the search from all the pages paste the following code in the default.xml. Directory app/code/VendorName/ModuleName/frontend/layout/default.xml Content of default.xml <?xml version="1.0"?><page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:
    Read more

Items 51-60 of 189

Show per page