Page 50 of 69

Magento 2 – How to Get URL in JS File

In this post I am going to explain how to get URL in js file in magento 2. Use below code snippet to get URL in the js file. define([ ‘jquery’, ‘mage/url’ ], function($, url) { // Login Page URL var loginUrl = url.build(‘customer/account/login’); console.log(loginUrl); // Customer Account URL var accountUrl = url.build(‘customer/account’); console.log(accountUrl); });…

Magento 2 – How to Write log

Logging is an important part of any development process. Logs assist you to spot an error and the reason for it. Magento 2 contains built-in logging solution based on Monolog Library. To start working with a logger, you must create an instance of \Psr\Log\LoggerInterface. With this interface, you can call the following functions to write…

Magento 2 – How To Validate Custom Form

In this post I am going to explain how to validate custom form in magento 2. The data validation is the important step before the submission. The data needs to be checked for correct input and the validity of data can be checked via default Magento 2 validation rules. Follow the steps to add validation…

Magento 2 – How to Disable Caching for CMS Page from Backend

In this post I am going to explain how to disable caching for CMS page from backend in magento 2. If you need to update the CMS page often hence if you want to disable the cache for that particular page, then add below code snippet in cms page “Layout Update XML”. <referenceContainer name=”content”> <block…

Magento 2 – How to Add Top Link

Any website’s header is the perfect place to display the important links. Top Links block in Magento 2 is used to add links related to customer account like Login, Logout, My Account, My Wishlist etc. So, in this post I am going to explain how to add top link in magento 2. First, Add or…

Magento 2 – How to Get Product Stock Quantity, Min Quantity and Other Stock Information

In this post I am going to explain how to load product stock quantity, min quantity and other stock information in magento 2. 1. Using Dependency Injection Add below code snippet in Block class. protected $_stockItemRepository; public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\CatalogInventory\Model\Stock\StockItemRepository $stockItemRepository, array $data = [] ) { $this->_stockItemRepository = $stockItemRepository; parent::__construct($context, $data); }…

Magento 2 – How to Get Product by SKU

In this post I am going to explain how to load product by SKU in magento 2. 1. Using Dependency Injection Add below code snippet in Block class. protected $_productRepository; public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Catalog\Model\ProductRepository $productRepository, array $data = [] ) { $this->_productRepository = $productRepository; parent::__construct($context, $data); } public function getProductBySku($productSku) { return $this->_productRepository->get($productSku);…

Magento 2 – How to Get Product by ID

In this post I am going to explain how to load product by ID in magento 2. 1. Using Dependency Injection Add below code snippet in Block class. protected $_productRepository; public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Catalog\Model\ProductRepository $productRepository, array $data = [] ) { $this->_productRepository = $productRepository; parent::__construct($context, $data); } public function getProductById($productId) { return $this->_productRepository->getById($productId);…

PrestaShop Checkout – An innovative payment solution built with PayPal

Recently, PrestaShop and PayPal has launched a brand new simplified payment solution called as PrestaShop Checkout to provide the best checkout experience to PrestaShop e-shops! PrestaShop’s partnership with PayPal allows merchants to manage all cashing processes for their store on one single interface. There’s no denying that when it comes to accepting and receiving payments…

How to show cover image of your product with combination in PrestaShop 1.7?

In e-Commerce business, Product image is a vital aspect, to attract a visitor’s eye in the first place. In PrestaShop 1.7, If you have combination product then PrestaShop shows image of the one selected by default in product combination instead of the generic (Cover) image of your product. Do you want to show generic (Cover)…

« Older posts Newer posts »