What is the difference between echo, print,var_dump, and print_r in PHP?

print  and  echo  are more or less the same; they are both language constructs that display strings. The differences are subtle:  print  has a return value of 1 so it can be used in expressions whereas  echo  has a  void  return type;  echo  can take multiple parameters, although such usage is rare; echo is slightly faster… Continue reading What is the difference between echo, print,var_dump, and print_r in PHP?

Published
Categorized as Magento

How To Create a Modal Popup

A modal is a dialog box/popup window that is displayed on top of the current page: Html code <h2>Modal Example</h2> <!– Trigger/Open The Modal –> <button id=”myBtn”>Open Modal</button> <!– The Modal –> <div id=”myModal” class=”modal”> <!– Modal content –> <div class=”modal-content”> <span class=”close”>&times;</span> <p>Some text in the Modal..</p> </div> </div> Javascript code // Get the… Continue reading How To Create a Modal Popup

Published
Categorized as Magento

jquery, add/remove the class when the window width changes

// Returns width of browser $( window ).width(); if ($(window).width() >= 768) {$(‘.footersection .accordion-item .accordion-collapse’).removeClass(‘collapse’);$(‘.video-section .accordion-item .accordion-collapse’).addClass(‘show’);} else {$(‘.footersection .accordion-item .accordion-collapse’).addClass(‘collapse’);$(‘.footersection .accordion-item #collapseOne,#collapseThree,#collapseTwo’).removeClass(‘show’);}

Published
Categorized as Magento

Load price phtml file in magento2

we have to get product price HTML using Magento 2 below way, we have to create a block Vendor\Module\Block\Product. PHP and get your product object and call the below function in your template file. protected $resultLayout; public function __construct(\Magento\Framework\View\Result\Layout $resultLayout) {$this->resultLayout = $resultLayout;} public function getProductPriceHtml(\Magento\Catalog\Model\Product $product){/** @var \Magento\Framework\Pricing\Render $priceRender */$priceRender = $this->resultLayout->getLayout()->getBlock(\Magento\Framework\Pricing\Render::class);if (!$priceRender) {$priceRender… Continue reading Load price phtml file in magento2

Published
Categorized as Magento

filter sales invoice grid collection based on order_id in Magento 2

1. Create di.xml inside the app/code/Vendor/Module/etc/. And add the following plugin to your di.xml file. <?xml version=”1.0″?> <config xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=”urn:magento:framework:ObjectManager/etc/config.xsd”> <type name=”Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory”> <plugin name=”Vendor_Module::aroundGetReport” type=”Vendor\Module\Plugin\CollectionFactory” sortOrder=”1″/> </type> </config> 2. Create plugin class file CollectionFactory.php inside the app/code/Vendor/Module/Plugin/ <?php /** * Vendor Desc. * * @category Vendor Category * @package Vendor_Module * @author Vendor name *… Continue reading filter sales invoice grid collection based on order_id in Magento 2

Published
Categorized as Magento

How to add a new field to Admin User Info in Magento 2?

I have added a new field(tertiary_user_field) in the database table admin_user using the following. 1)Vendor/Module/etc/db_schema.xml 2)Vendor/Module/etc/adminhtml/di.xml 3)Vendor/Module/Plugin/Block/Adminhtml/User/Edit/Tab/Main.php OUTPUT:

Published
Categorized as Magento