First of all, you should find out which file is responsible for displaying the SKU on the product page. The following layout file for the “catalog_product_view.xml” of the Catalog module is responsible for this: /view/frontend/layout/catalog_product_view.xml/view/frontend/layout/catalog_product_view.xml In order to change this file, you need to copy it to the folder with your theme. It is not… Continue reading How to change SKU position
Category: Magento
how to call any block function in phtml magento 2
For ex your block class is then in any phtml file you can use following code to get method of this block.
How to trigger a minicart update after adding to cart magento 2
you need to set up a sections.xml inside etc/frontend of your module that tells Magento which sections to update for a given Ajax call. Here is an example; After my Ajax call has finished to [frontName]/[ActionPath]/[ActionName] Magento makes another call to /customer/section/load passing the sections to load. By default it requests any messages but if you have… Continue reading How to trigger a minicart update after adding to cart magento 2
How get order preview on success page Magento 2
1.Override block Create the file app/code/Vendor/Module/etc/di.xml and add the following: Create the file app/code/Vendor/Module/Block/Success.php and add the following: Override template Create the file app/code/Vendor/Module/view/frontend/layout/checkout_onepage_success.xml and add the following: Create the file app/code/Vendor/Module/view/frontend/templates/checkout/success.phtml and add the following: TIP You probably want to refresh your checkout/success page a lot, so to tackle that problem, go to file app/code/Magento/Checkout/Controller/Onepage/Success.php and change at line 22.… Continue reading How get order preview on success page Magento 2
Magento Extension Development- Simple Method
Magento Extension Development Magento consists of different modules for different purposes . Module is a structural element of Magento 2. A module can be created externally or from reusable modules inside the vendor/folder.The location of the new module created is in app/code/(new_module)/.The main use of the module is for customization in Magento. Steps for creating… Continue reading Magento Extension Development- Simple Method
lost Project files for the magento project during an system restart
Copied the project file from a colleague an pasted it in the location “/var/www/html”. Also copied the database from them and pasted it in the same location an created a database with the following commands mysql> CREATE DATABASE DatabaseName; mysql> CREATE USER ‘DatabaseUser’@’localhost’ IDENTIFIED BY ‘password’; mysql> GRANT ALL ON DatabaseName.* TO ‘DatabaseUser’@”localhost”; mysql> FLUSH… Continue reading lost Project files for the magento project during an system restart
How to Change Default Logo of Admin in Magento 2
1) For that, You need to create app/design/adminhtml/Vendor/Theme/Magento_Backend/layout/admin_login.xml and paste the below code: <?xml version=”1.0″?> <page xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” layout=”admin-login” xsi:noNamespaceSchemaLocation=”urn:magento:framework:View/Layout/etc/page_configuration.xsd”> <body> <referenceBlock name=”logo”> <arguments> <argument name=”logo_image_src” xsi:type=”string”>images/admin-custom-logo.png</argument> </arguments> </referenceBlock> </body> </page> 2) Now, Make sure admin-custom-logo.png file available on app/design/adminhtml/Vendor/Theme/web/images/ this path.
How to Add Custom LESS File in Custom Theme in Magento 2
1) Let’s assume that you have created a custom theme. Now, Create your custom less file at app/design/frontend/VendorName/ThemeName/web/css/source/_custom.less and add your less code inside that file. 2) After that you need to import this _custom.less file at app/design/frontend/VendorName/ThemeName/web/css/source/_sources.less@import ‘_custom.less’; You need to import your _custom. less file using this above line. Just add that line inside _sources. less file. If this _sources. less file does not exist in your… Continue reading How to Add Custom LESS File in Custom Theme in Magento 2
How to Add Custom Tab in Product Detail Page in Magento 2
Let’s assume that you have created custom theme. Then you need to create app/design/frontend/Vendor/Theme/Magento_Catalog/layout/catalog_product_view.xml file and paste the below code : <?xml version=”1.0″?> <page layout=”1column” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=”urn:magento:framework:View/Layout/etc/page_configuration.xsd”> <body> <referenceBlock name=”product.info.details”> <block class=”Magento\Catalog\Block\Product\View” name=”custom.tab” as=”customtab” template=”Magento_Catalog::product/view/custom.phtml” group=”detailed_info”> <arguments> <argument translate=”true” name=”title” xsi:type=”string”>Custom Tab</argument> <argument name=”sort_order” xsi:type=”string”>10</argument> </arguments> </block> </referenceBlock> </body> </page> After that, You need to create file app/design/frontend/Vendor/Theme/Magento_Catalog/templates/product/view/custom.phtml file and… Continue reading How to Add Custom Tab in Product Detail Page in Magento 2
How to Add Placeholder Text to Fields in Checkout in Magento 2
1) First of all, Let’s assume that you have created a simple module. After that, You need to create di.xml to create plugin at app/code/Module/Helloworld/etc/frontend/ and paste the below code : <?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\Checkout\Block\Checkout\AttributeMerger”> <plugin name=”add_placeholder_to_checkout” type=”Module\Helloworld\Plugin\Block\Checkout\AttributeMerger” sortOrder=”10″/> </type> </config> 2) Then, You need to create AttributeMerger.php file at app/code/Module/Helloworld/Plugin/Block/Checkout/ to add placeholder code and paste… Continue reading How to Add Placeholder Text to Fields in Checkout in Magento 2