How to add new blocks to a page in magento

First of all, write the code in the respective phtml file and then copy the content to the backend by creating a block in CONTENT-> BLOCK -> NEW BLOCK then call the block in the respective HTML file using the following code <?php echo $this->getLayout() ->createBlock(‘Magento\Cms\Block\Block’) ->setBlockId(‘nb_about_us’) ->toHtml(); ?>

Published
Categorized as Magento

How to add new blocks to a page

First of all, write the code in the respective phtml file and then copy the content to the backend by creating a block in CONTENT-> BLOCK -> NEW BLOCK then call the block in the respective HTML file using the following code <?php echo $this->getLayout() ->createBlock(‘Magento\Cms\Block\Block’) ->setBlockId(‘block name’) ->toHtml(); ?>

Published
Categorized as Magento

How to use different layouts for different category levels.

Sometimes we need to use different layouts or structures based on category levels. For this, we can able to use different layouts based on different category levels. Solution: To create different layout structures for different categories develop layout files under the Magento_Catalog. One option would be adding a layout handle based on the category depth… Continue reading How to use different layouts for different category levels.

Published
Categorized as Magento

Adding custom classes to Magento shipping page address fields

Create plugin after Attribute merge Plugin to add custom classes to shipping address page In your module create MODULE/NAME/etc/di.xml Then in \MODULE\NAME\Model\Plugin create a php file AttributeMergerPlugin.php Example: <?php namespace JJ\Catalog\Plugin\Checkout\Block; class AttributeMergerPlugina { public function afterMerge(\Magento\Checkout\Block\Checkout\AttributeMerger $subject, $result) { if (array_key_exists(‘checkout-step-shipping’, $result)) { $result[‘checkout-step-shipping’][‘additionalClasses’] = ‘checkout-shipping-address’; } if (array_key_exists(‘telephone’, $result)) { $result[‘telephone’][‘additionalClasses’] = ‘mobile-number-validation’; ]; return… Continue reading Adding custom classes to Magento shipping page address fields

Magento Adding custom validations-(Phone Number)

Magento doesn’t have any validation for a ten digit mobile number validation.For getting this there are some many ways.This method is taking about overriding the inbuilt validation rules. For this we have to Create a custom module for the theme , for reference: https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/themes/theme-create.html after that inside the create path Magento Ui >Magento_Ui/web/js/lib/validation/rules.js Here we… Continue reading Magento Adding custom validations-(Phone Number)

How to set multiple currencies in one storefront?

To setup multiple currency on Magento 2 follow this step: Setup currency: Move to menu Stores >> Configuration. Under GENERAL tab you will find sub menu Currency Setup. Setup Currency Options with what you need and click Save Config. 2.Setup currency rates: Move menu to Stores >> Currency Rates. Set value for all parameters and hit Saves Currency Rates

Published
Categorized as Magento

How to get step name on checkout page in magento 2?

You can use the Magento_Checkout/js/view/progress-bar component or Magento_Checkout/js/model/step-navigator componen (used by progress-bar) inside your custom block template/component. Using progress-bar: Using step-navigator: or:

Published
Categorized as Magento