E-commerce has become a requirement for all kinds of companies. Every web business owner is looking for a sophisticated business solution that offers scalability, flexibility, and scalability.
Magento 2 versions from 2.3 has a replacement for traditional install / upgrade schema which is used to maintain the database structure.
A website considered a great source of a marketing platform for a travel company. It is a place where you can share your availability and regularity all the time without unusual hindrances. A website should be responsive, user-friendly, and easy to operate. A travel company promotes itself through the best website to put trustworthy content. It may promote visitors and it would be a great platform to place tour packages.
Today Magento 2 has become one of the most widely and commonly used eCommerce development platform around the world. In this article:, we will learn about..
The homepage of your website plays a vital role in your business. Online Shoppers will understand your homepage first before they choose to shop, so your business is to create the homepage engaging to the customer.
If not, they will leave your site instantly. One of the best ways to attract users by inserting your primary or trending products on the home page. So there is a huge chance of getting more buyers.
Create a Featured Attribute in Magento Backend first Create an attribute featured with yes/no property from Catalog Input Type for Store Owner drop-down, then include it in attribute set and assign one product as Featured “yes” from Catalog->Manage Products.
Create custom module and block file “app/code/local/FeaturedProduct/Catalog/Block/Product/Featured.php” with following code in it.
class FeaturedProduct_Catalog_Block_Product_Featured extends Mage_Catalog_Block_Product_List { protected $_productCollection; public function fetchProducts() { $this->productCollection =Mage::getModel('catalog/product')->getCollection() ->addAttributeToSelect('*') ->addFieldToFilter('featured_products', array('eq' => '1')); return $this->productCollection; } }
Create a configuration file in app/code/local/FeaturedProduct/Catalog/etc/config.xml
You have to specify a configuration file to tell magento about which XML is going to declare the block need to display featured products in homepage and which is located in app/code/local/FeaturedProduct/Catalog/etc/config.xml as:
1.0.0 FeaturedProduct_Catalog_Block featuredproduct.xml
Create featuredproducts.xml in location app/design/frontend/mytheme/default/layout/featuredproduct.xml as follows:
4
Finally, create a view file to display featured products in a Grid layout as :
Create view file "app/design/frontend/mytheme/default/template/catalog/product/featured.phtml" with following code in it :
fetchProducts(); $_helper = $this->helper('catalog/output'); ?>
__('There are no products in the featured product list!!') ?>
__('Out of stock') ?>
That’s it.
Prefer to choose Installer Script for creating featured attribute mentioned in the beginning.
I hope you understood on How to add featured product in home page in Magento.
Try it
©2022 eGlobe IT Solutions. All Rights Reserved.
Leave a Reply