We sacrifice by not doing any other technology, so that you get the best of Magento.

We sacrifice by not doing any other technology, so that you get the best of Magento.

    How to display product price programmatically after quantity box in product page?

    If you want to display product final price after quantity box then you have to follow below instruction.

    You need to overwrite addtocart.phtml file in your theme.

    Then put below code after quantity input.

    <?php 
    echo $this->getLayout()
     ->createBlock('MagentoCatalogPricingRender',
     "product.price.final.clone",
     [
     'data' => [
     'price_render' => 'product.price.render.default',
     'price_type_code' => 'final_price',
     'zone' => 'item_view'
     ]
     ]
     )
     ->toHtml();
    ?>

    Anything more? Nopes, that’s it. Try the given code and you will able to display product price programmatically.

    Composer update not working while repository not exists in git – Magento 2 [resolved]

    We were working on a project where we needed to upgrade a Magento store along with plugins.

    We came on the stage where we were working on the composer command.

    For those who are not aware with the role of composer command, let us share that in magento 2 you have to use composer command to update the version of Magento system and plugins.

    While working on the same we faced an issue.

    Some plugin repositories were not getting cloned.

    For example:

    medialounge_repo/magento2-share-my-basket.git

    To solve the problem, we removed below line from composer.json:

    git@bitbucket.org:medialounge_repo/magento2-share-my-basket.git

    Then we removed magento-2-share-my-basket section from repositories,

    From:

    "repositories": {
    	"0": {
    		"type": "composer",
    		"url": "https://repo.magento.com/"
    	},
    	"magento-2-share-my-basket": {
    		"type": "vcs",
    		"url": "git@bitbucket.org:medialounge_repo/magento2-share-my-basket.git"
    	},
    	"xtento": {
    		"type": "composer",
    		"url": "https://repo.xtento.com"
    	}
    }

    Replace:

    "repositories": {
    	"0": {
    		"type": "composer",
    		"url": "https://repo.magento.com/"
    	},
    	"xtento": {
    		"type": "composer",
    		"url": "https://repo.xtento.com"
    	}
    }

    Things worked for us when we chose this as solution.

    If you ever face such problem then you can use this trick. We’re sure this Magento hack will work for you.

    How to insert and update product prices using MySQL query?

    Today, we are going to talk about MySQL query for product pricing in Magento 2.

    If you ever wanted to insert and update product pricing using MySQL in Magento 2 then you landed to the right page.

    You can use below code to insert and update the product prices in Magento 2 through MySQL query. We have made the code as per our requirements. But you can always change it as per your needs.

    <?php
    ini_set('display_errors', 1);
    ini_set('display_startup_errors', 1);
    error_reporting(E_ALL);
    
    
    require __DIR__ . '/app/bootstrap.php';
    $bootstrap = MagentoFrameworkAppBootstrap::create(BP, $_SERVER);
    $obj = $bootstrap->getObjectManager();
    $state = $obj->get('MagentoFrameworkAppState');
    $state->setAreaCode('adminhtml');
    
    
    function readCsvRows($csvFile)
    {
        $rows = [];
        $fileHandle = fopen($csvFile, 'r');
        while(($row = fgetcsv($fileHandle, 0, ',', '"', '"')) !== false) {
            $rows[] = $row;
        }
        fclose($fileHandle);
        return $rows;
    }
    
    function _getResourceConnection()
    {
        global $obj;
        return $obj->get('MagentoFrameworkAppResourceConnection');
    }
    
    function _getReadConnection()
    {
        return _getConnection('core_read');
    }
    
    function _getWriteConnection()
    {
        return _getConnection('core_write');
    }
    
    function _getConnection($type = 'core_read')
    {
        return _getResourceConnection()->getConnection($type);
    }
    
    function _getTableName($tableName)
    {
        return _getResourceConnection()->getTableName($tableName);
    }
    
    function _getAttributeId($attributeCode)
    {
        $connection = _getReadConnection();
        $sql = "SELECT attribute_id FROM " . _getTableName('eav_attribute') . " WHERE entity_type_id = ? AND attribute_code = ?";
        return $connection->fetchOne(
            $sql,
            [
                _getEntityTypeId('catalog_product'),
                $attributeCode
            ]
        );
    }
    
    function _getEntityTypeId($entityTypeCode)
    {
        $connection = _getConnection('core_read');
        $sql        = "SELECT entity_type_id FROM " . _getTableName('eav_entity_type') . " WHERE entity_type_code = ?";
        return $connection->fetchOne(
            $sql,
            [
                $entityTypeCode
            ]
        );
    }
    
    $writeConnection = _getWriteConnection();
    try {
        $csvFile        = 'csv/priceinevntory.CSV';
        $csvDatas        = readCsvRows($csvFile);
        $headers        = array_shift($csvData);
        foreach($csvDatas as $data) {
            $count   = 0;
            
            $entity_id = $data[0];
            
            $weightValue = $data[1];
    
            $itemQuntity = $data[2];
            $itemISInStock = 0;
            if($itemQuntity > 0)
            {
                $itemISInStock = 1;
            }
            
            $price1Value = number_format($data[3],4,'.','');
            $price2Value = number_format($data[4],4,'.','');
            $price3Value = number_format($data[5],4,'.','');
            $price4Value = number_format($data[6],4,'.','');
    
    
            $storeId = 0;
            $entity_id = $record;
    
    
            /* Price */
            $priceAttributeId = _getAttributeId('price');
            $priceSql = "INSERT INTO catalog_product_entity_decimal (attribute_id, store_id, entity_id, value) VALUES (". $priceAttributeId .", ". $storeId .", ". $entity_id .", ". $price1Value .") ON DUPLICATE KEY UPDATE value=".$price1Value;
            $writeConnection->query($priceSql);
    
    
            /* Customer Group Price */
            $quntity = number_format(1,4,'.','');
            
            $customerGroupPrice1Sql = "INSERT INTO catalog_product_entity_tier_price ( entity_id, all_groups, customer_group_id, qty, value, website_id) VALUES (". $entity_id .", 0, 1, ". $quntity .",  ". $price1Value .", 0) ON DUPLICATE KEY UPDATE value=".$price1Value;
            $writeConnection->query($customerGroupPrice1Sql);
    
            $updateCustomerGroupPrice1Sql = "UPDATE catalog_product_index_price cpip SET  cpip.tier_price = ".$price1Value." WHERE  cpip.customer_group_id = 1 AND cpip.entity_id = ".$entity_id;
            $writeConnection->query($updateCustomerGroupPrice1Sql);
        
    
    
        
            $customerGroupPrice2Sql = "INSERT INTO catalog_product_entity_tier_price ( entity_id, all_groups, customer_group_id, qty, value, website_id) VALUES (". $entity_id .", 0, 2, ". $quntity .",  ". $price2Value .", 0) ON DUPLICATE KEY UPDATE value=".$price2Value;
            $writeConnection->query($customerGroupPrice2Sql);
    
            $updateCustomerGroupPrice2Sql = "UPDATE catalog_product_index_price cpip SET  cpip.tier_price = ".$price2Value." WHERE  cpip.customer_group_id = 2 AND cpip.entity_id = ".$entity_id;
            $writeConnection->query($updateCustomerGroupPrice2Sql);
        
    
    
        
            $customerGroupPrice3Sql = "INSERT INTO catalog_product_entity_tier_price ( entity_id, all_groups, customer_group_id, qty, value, website_id) VALUES (". $entity_id .", 0, 3, ". $quntity .",  ". $price3Value .", 0) ON DUPLICATE KEY UPDATE value=".$price3Value;
            $writeConnection->query($customerGroupPrice3Sql);
    
            $updateCustomerGroupPrice3Sql = "UPDATE catalog_product_index_price cpip SET  cpip.tier_price = ".$price3Value." WHERE  cpip.customer_group_id = 3 AND cpip.entity_id = ".$entity_id;
            $writeConnection->query($updateCustomerGroupPrice3Sql);
        
    
    
        
            $customerGroupPrice4Sql = "INSERT INTO catalog_product_entity_tier_price ( entity_id, all_groups, customer_group_id, qty, value, website_id) VALUES (". $entity_id .", 0, 4, ". $quntity .",  ". $price4Value .", 0) ON DUPLICATE KEY UPDATE value=".$price4Value;
            $writeConnection->query($customerGroupPrice4Sql);
    
            $updateCustomerGroupPrice4Sql = "UPDATE catalog_product_index_price cpip SET  cpip.tier_price = ".$price4Value." WHERE  cpip.customer_group_id = 4 AND cpip.entity_id = ".$entity_id;
            $writeConnection->query($updateCustomerGroupPrice4Sql);
            
    
    
            /* weight */
            $weightAttributeId = _getAttributeId('weight');
            $weightSql = "INSERT INTO catalog_product_entity_decimal (attribute_id, store_id, entity_id, value) VALUES (". $weightAttributeId .", ". $storeId .", ". $entity_id .", ". $weightValue .") ON DUPLICATE KEY UPDATE value=". $weightValue;
            $writeConnection->query($weightSql);
    
    
            /* Stock */
            $stockSql = "UPDATE cataloginventory_stock_item item_stock, cataloginventory_stock_status status_stock SET item_stock.qty = '$itemQuntity', item_stock.is_in_stock = IF('$itemQuntity'>0, 1,0), status_stock.qty = '$itemQuntity', status_stock.stock_status = IF('$itemQuntity'>0, 1,0) WHERE item_stock.product_id = '$entity_id' AND item_stock.product_id = status_stock.product_id";
            $writeConnection->query($stockSql);
    
    
            echo $entity_id ." - Successfully Updated <br/>";
        }
    } catch (Exception $e) {
        $e->getTraceAsString();
    }

    I hope this code will give you fruitful result. Tell us by commenting if you face any trouble.

    How can you make your Magento Mobile App Development Successful?

    Our life has become very easy with the development of mobile phones. In recent years there has been a sharp development of many types of open sources especially Magento leads to the business success of many store owners. For the best use of mobile and Magento, a focus should be given more on Magento mobile app development as it will definitely boost your business.

    In this post, we will discuss with you the main factors due to which Magento mobile app development is successful.

    Collection of relevant customer data

    You can collect useful data from customers such as their likes and browsing pattern. There is a number of support tools that can give you a report regarding the mobile app performance and their usage and also the reason for malfunctions. In short, you can completely control your entire system.

    Flexibility

    Magento gives you full freedom to customize your online store as per the product and/or services you are selling. You can even reset or manage attributes without altering the admin panel.

    Virtual Assistants

    The virtual assistant helps customers by providing them to browse the store and look for specific products, do the payment, and also give answers to their queries in terms of product return or exchange. These chatbots are intelligent assistants who are always ready to assist you at any time of the day.

    Mobile Wallet

    Online payment is rising as it’s comfortable for anyone to use. You should provide a maximum number of payment methods to reach out to more and more customers.

    Enhanced Design features

    Magento comes with an amazing responsive front-end design, therefore, customers find it easy and convenient to use.

    Voice Searches

    To make your search more interactive simply put voice search so that customers use search engines by speaking instead of typing.

    Make conversational interfaces

    We all love to interact so add a feature in your mobile app where they are able to discuss one’s choice with co-shoppers, sellers, and also customer care personnel. This will enhance the shopping experience along with building a trustworthy reputation for your business.

    Friendly eCommerce Features

    Give your mobile app simple navigation, easy check-out, synchronous as well as seamless order processing, multiple payment gateway support.

    Usage of Virtual Reality and Augmented Reality

    VR Make user feels like they are experiencing the simulated reality first-hand, AR is a technology that makes computer produced enhancements on top of an existing reality with the purpose of making it more meaningful via the ability to interact with it.

    Other factors include an uncluttered interface, enhanced filters, animated designs, informative shopping cart screen, easy navigation, push notifications.

    Wrapping up

    In the end, it’s all about catering exceptional experiences both across the web and the mobile. It is essential to follow the best practice along with keeping up with the trends. Magemonkeys expert developers have always helped many store owners in building up their business successfully. Our Magento mobile app developers are capable of taking your online store to the next level.

    How long does it take to create a magento store from scratch?

    Magento is the leading eCommerce platform. Developers love it because it’s open-source which means they can customize it to their heart’s content. As per a recent survey, online business is growing at a faster rate as compared to traditional business. Today everyone wants to start their own business but the biggest question that makes everyone wonder is how long will it take to create an eCommerce website at the outset?

    Honestly, it’s difficult for anyone to make an incredibly accurate estimate as every project is different and unique and so do every client and developer. But let’s say, as per our experience a new Magento store takes 20 to 900 hours of development work. Yes, it’s a pretty good time to know exactly what you want in your store will help you in the entire process.

    You need to break down the project into segments so that it works brilliantly at every step.

    Ready to begin?

    Initial Interview

    The very first step is to know and understand the client’s requirements and business goals. Here we also tell them about the correct Magento edition and which all plug-ins and extensions will be required. This takes 1 – 2 days to come to finalize everything.

    Magento Installation

    Only after we have identified the software needed, It takes less than 1 to buy, install and perform basic configuration.

    Modules and Plugins

    Once the Magento platform is in place then it will take 1-3 days for the team to purchase necessary modules and plugins for your stores like shipping module, search bar, a blog, payment module, checkout module, and various SEO extensions.

    Custom Module Development

    Custom module development will take at least one day which also depends on the particular requirements.

    Theme

    If you want a premade theme for your Magento store then it would only take a few hours but creating a custom theme will at least take one month.

    Premade Theme Configuration

    Once the premade theme is sourced then setting it up and its configuration will only take one day.

    Custom HTML Layout

    It will take up to one month to set it up to work with the engines and all plug-ins if your store demands a customized HTML layout.

    Custom Theme Creation

    Custom theme creation and HTML layout will take 3-4 weeks.

    Testing

    Testing and QA completely depend on the complexity of the website so it can take anywhere from 1 day to 1 month.

    Final Settings and Deployment

    When your entire website is ready for launch then it would take 1-2 days to perform final settings and deployment.

    Conclusion

    Building a Magento Store from scratch takes a lot of time. Make sure you know exactly what you want in your website before you hire a developer as this will reduce the timelines and confusion.

    So, do you fancy launching your online shop today?

    Our devoted team provides a full scope of Magento development services that you need with launching your website. We are always there to offer consultation and get a new Magento project off the ground.

    How to add sale product label Magento 2?

    Add module.xml file in app/code/Magemonkeys/ProductLabels/etc and copy the following code in it:

    <?xml version="1.0"?>
                <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
                            <module name="Magemonkeys_ProductLabels" setup_version="1.0.1">
                            </module>
                </config>

    Add registration.php in app/code/Magemonkeys/ProductLabels and copy the following code in it:

    <?php
    MagentoFrameworkComponentComponentRegistrar::register(
    MagentoFrameworkComponentComponentRegistrar::MODULE,
    'Magemonkeys_ProductLabels',
    __DIR__
    );

    Now add Labels.php file in app/code/Magemonkeys/ProductLabels/Helper and copy the following code in it:

    <?php
    
    
    namespace MagemonkeysProductLabelsHelper;
    
    use MagentoCatalogModelProduct as ModelProduct;
    
    class Labels extends MagentoFrameworkUrlHelperData
    {
    
    	
        public function __construct(
            MagentoFrameworkAppHelperContext $context
    	) {
    		parent::__construct($context);
        }
    
       
      public function isProductSale(ModelProduct $product)
      {
          $_finalPrice = $product->getPriceInfo()->getPrice('final_price')->getAmount()->getValue();
          $_regularPrice = $product->getPriceInfo()->getPrice('regular_price')->getAmount()->getValue();
          
          if ($_regularPrice != $_finalPrice && $_finalPrice>0 && $_regularPrice>0)
          {
             return true;
          }    
          return false;
      }
    	
    	
    }

    Override list.phtml

    Now go to vendor/magento/module-catalog/view/frontend/templates/product from the root directory of your store and you will see the list.phtml file. Copy the file and paste it into app/code/Magemonkeys/ProductLabels/view/frontend/templates/catalog/product.

    <?php
    /**
     * Copyright © Magento, Inc. All rights reserved.
     * See COPYING.txt for license details.
     */
    use MagentoFrameworkAppActionAction;
    
    // @codingStandardsIgnoreFile
    
    ?>
    <?php
    /**
     * Product list template
     *
     * @var $block MagentoCatalogBlockProductListProduct
     */
    ?>
    <?php
    $_productCollection = $block->getLoadedProductCollection();
    $_helper = $this->helper('MagentoCatalogHelperOutput');
    ?>
    <?php if (!$_productCollection->count()): ?>
        <div class="message info empty"><div><?= /* @escapeNotVerified */ __('We can't find products matching the selection.') ?></div></div>
    <?php else: ?>
        <?= $block->getToolbarHtml() ?>
        <?= $block->getAdditionalHtml() ?>
        <?php
        if ($block->getMode() == 'grid') {
            $viewMode = 'grid';
            $imageDisplayArea = 'category_page_grid';
            $showDescription = false;
            $templateType = MagentoCatalogBlockProductReviewRendererInterface::SHORT_VIEW;
        } else {
            $viewMode = 'list';
            $imageDisplayArea = 'category_page_list';
            $showDescription = true;
            $templateType = MagentoCatalogBlockProductReviewRendererInterface::FULL_VIEW;
        }
        /**
         * Position for actions regarding image size changing in vde if needed
         */
        $pos = $block->getPositioned();
        ?>
        <div class="products wrapper <?= /* @escapeNotVerified */ $viewMode ?> products-<?= /* @escapeNotVerified */ $viewMode ?>">
            <ol class="products list items product-items">
                <?php /** @var $_product MagentoCatalogModelProduct */ ?>
                <?php foreach ($_productCollection as $_product): ?>
                <li class="item product product-item">
                    <div class="product-item-info" data-container="product-<?= /* @escapeNotVerified */ $viewMode ?>">
                        <?php
                        $productImage = $block->getImage($_product, $imageDisplayArea);
                        if ($pos != null) {
                            $position = ' style="left:' . $productImage->getWidth() . 'px;'
                                . 'top:' . $productImage->getHeight() . 'px;"';
                        }
                        ?>
    <?php
    $labels = $this->helper('MagemonkeysProductLabelsHelperLabels');
    ?>
    <?php if($labels->isProductSale($_product)){ ?>
    	<div class="label-sale sale_label"><p><?php echo __('Sale'); ?></p></div>
    <?php }
                        <?php // Product Image ?>
                        <a href="<?= /* @escapeNotVerified */ $_product->getProductUrl() ?>" class="product photo product-item-photo" tabindex="-1">
                            <?= $productImage->toHtml() ?>
                        </a>
                        <div class="product details product-item-details">
                            <?php
                                $_productNameStripped = $block->stripTags($_product->getName(), null, true);
                            ?>
                            <strong class="product name product-item-name">
                                <a class="product-item-link"
                                   href="<?= /* @escapeNotVerified */ $_product->getProductUrl() ?>">
                                    <?= /* @escapeNotVerified */ $_helper->productAttribute($_product, $_product->getName(), 'name') ?>
                                </a>
                            </strong>
                            <?= $block->getReviewsSummaryHtml($_product, $templateType) ?>
                            <?= /* @escapeNotVerified */ $block->getProductPrice($_product) ?>
                            <?= $block->getProductDetailsHtml($_product) ?>
    
                            <div class="product-item-inner">
                                <div class="product actions product-item-actions"<?= strpos($pos, $viewMode . '-actions') ? $position : '' ?>>
                                    <div class="actions-primary"<?= strpos($pos, $viewMode . '-primary') ? $position : '' ?>>
                                        <?php if ($_product->isSaleable()): ?>
                                            <?php $postParams = $block->getAddToCartPostParams($_product); ?>
                                            <form data-role="tocart-form" data-product-sku="<?= $block->escapeHtml($_product->getSku()) ?>" action="<?= /* @NoEscape */ $postParams['action'] ?>" method="post">
                                                <input type="hidden" name="product" value="<?= /* @escapeNotVerified */ $postParams['data']['product'] ?>">
                                                <input type="hidden" name="<?= /* @escapeNotVerified */ Action::PARAM_NAME_URL_ENCODED ?>" value="<?= /* @escapeNotVerified */ $postParams['data'][Action::PARAM_NAME_URL_ENCODED] ?>">
                                                <?= $block->getBlockHtml('formkey') ?>
                                                <button type="submit"
                                                        title="<?= $block->escapeHtml(__('Add to Cart')) ?>"
                                                        class="action tocart primary">
                                                    <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span>
                                                </button>
                                            </form>
                                        <?php else: ?>
                                            <?php if ($_product->isAvailable()): ?>
                                                <div class="stock available"><span><?= /* @escapeNotVerified */ __('In stock') ?></span></div>
                                            <?php else: ?>
                                                <div class="stock unavailable"><span><?= /* @escapeNotVerified */ __('Out of stock') ?></span></div>
                                            <?php endif; ?>
                                        <?php endif; ?>
                                    </div>
                                    <div data-role="add-to-links" class="actions-secondary"<?= strpos($pos, $viewMode . '-secondary') ? $position : '' ?>>
                                        <?php if ($addToBlock = $block->getChildBlock('addto')): ?>
                                            <?= $addToBlock->setProduct($_product)->getChildHtml() ?>
                                        <?php endif; ?>
                                    </div>
                                </div>
                                <?php if ($showDescription):?>
                                    <div class="product description product-item-description">
                                        <?= /* @escapeNotVerified */ $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
                                        <a href="<?= /* @escapeNotVerified */ $_product->getProductUrl() ?>" title="<?= /* @escapeNotVerified */ $_productNameStripped ?>"
                                           class="action more"><?= /* @escapeNotVerified */ __('Learn More') ?></a>
                                    </div>
                                <?php endif; ?>
                            </div>
                        </div>
                    </div>
                </li>
                <?php endforeach; ?>
            </ol>
        </div>
        <?= $block->getToolbarHtml() ?>
        <?php if (!$block->isRedirectToCartEnabled()) : ?>
            <script type="text/x-magento-init">
            {
                "[data-role=tocart-form], .form.map.checkout": {
                    "catalogAddToCart": {
                        "product_sku": "<?= /* @NoEscape */ $_product->getSku() ?>"
                    }
                }
            }
            </script>
        <?php endif; ?>
    <?php endif; ?>
    

    Run CLI Commands

    rm -rf var/di/* var/generation/* var/cache/* var/log/* var/page_cache/* var/session/* var/view_preprocessed/* pub/static/*
    php bin/magento setup:upgrade
    php bin/magento setup:upgrade
    php bin/magento setup:static-content:deploy -f
    php bin/magento cache:clean
    php bin/magento cache:flush

    Now go to the product list page of your store, you will see the desired result:

     

    How to add new product label in Magento 2?

    Add module.xml file in app/code/Magemonkeys/ProductLabels/etc and copy the following code in it:

    <?xml version="1.0"?>
                <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
                            <module name="Magemonkeys_ProductLabels" setup_version="1.0.1">
                            </module>
                </config>

    Add registration.php in app/code/Magemonkeys/ProductLabels and copy the following code in it:

    <?php
    MagentoFrameworkComponentComponentRegistrar::register(
    MagentoFrameworkComponentComponentRegistrar::MODULE,
    'Magemonkeys_ProductLabels',
    __DIR__
    );

    Now add Labels.php file in app/code/Magemonkeys/ProductLabels/Helper and copy the following code in it:

    <?php
    
    
    namespace MagemonkeysProductLabelsHelper;
    
    use MagentoCatalogModelProduct as ModelProduct;
    use MagentoStoreModelScopeInterface;
    
    use Zend_Date;
    
    
    class Labels extends MagentoFrameworkUrlHelperData
    {
    
    	
        public function __construct(
            MagentoFrameworkAppHelperContext $context,
    		MagentoFrameworkStdlibDateTimeDateTime $date
    	) {
           
    		
    		$this->date = $date;
    
    		parent::__construct($context);
        }
    
       
        public function isProductNew(ModelProduct $product)
        {
    		
    			
    		$from = new Zend_Date($product->getNewsFromDate());
    		$to = new Zend_Date($product->getNewsToDate());
    		$now = new Zend_Date($this->date->gmtTimestamp());
    		
    		if(!empty($product->getNewsFromDate()) && empty($product->getNewsToDate()))
    		{
    			return $from->isEarlier($now);
    		}	
    		else
    		{
    			 return ($from->isEarlier($now) && $to->isLater($now));
    		}	
               
            return (boolean) false;
        }
    	
    	
    }

    Override list.phtml

    Now go to vendor/magento/module-catalog/view/frontend/templates/product from the root directory of your store and you will see the list.phtml file. Copy the file and paste it into app/code/Magemonkeys/ProductLabels/view/frontend/templates/catalog/product.

    <?php
    /**
     * Copyright © Magento, Inc. All rights reserved.
     * See COPYING.txt for license details.
     */
    use MagentoFrameworkAppActionAction;
    
    // @codingStandardsIgnoreFile
    
    ?>
    <?php
    /**
     * Product list template
     *
     * @var $block MagentoCatalogBlockProductListProduct
     */
    ?>
    <?php
    $_productCollection = $block->getLoadedProductCollection();
    $_helper = $this->helper('MagentoCatalogHelperOutput');
    ?>
    <?php if (!$_productCollection->count()): ?>
        <div class="message info empty"><div><?= /* @escapeNotVerified */ __('We can't find products matching the selection.') ?></div></div>
    <?php else: ?>
        <?= $block->getToolbarHtml() ?>
        <?= $block->getAdditionalHtml() ?>
        <?php
        if ($block->getMode() == 'grid') {
            $viewMode = 'grid';
            $imageDisplayArea = 'category_page_grid';
            $showDescription = false;
            $templateType = MagentoCatalogBlockProductReviewRendererInterface::SHORT_VIEW;
        } else {
            $viewMode = 'list';
            $imageDisplayArea = 'category_page_list';
            $showDescription = true;
            $templateType = MagentoCatalogBlockProductReviewRendererInterface::FULL_VIEW;
        }
        /**
         * Position for actions regarding image size changing in vde if needed
         */
        $pos = $block->getPositioned();
        ?>
        <div class="products wrapper <?= /* @escapeNotVerified */ $viewMode ?> products-<?= /* @escapeNotVerified */ $viewMode ?>">
            <ol class="products list items product-items">
                <?php /** @var $_product MagentoCatalogModelProduct */ ?>
                <?php foreach ($_productCollection as $_product): ?>
                <li class="item product product-item">
                    <div class="product-item-info" data-container="product-<?= /* @escapeNotVerified */ $viewMode ?>">
                        <?php
                        $productImage = $block->getImage($_product, $imageDisplayArea);
                        if ($pos != null) {
                            $position = ' style="left:' . $productImage->getWidth() . 'px;'
                                . 'top:' . $productImage->getHeight() . 'px;"';
                        }
                        ?>
    <?php
    $labels = $this->helper('MagemonkeysProductLabelsHelperLabels');
    ?>
    <?php if($labels->isProductNew($_product)){ ?>
    	<div class="label-new new_label"><p><?php echo __('New'); ?></p></div>
    <?php }
                        <?php // Product Image ?>
                        <a href="<?= /* @escapeNotVerified */ $_product->getProductUrl() ?>" class="product photo product-item-photo" tabindex="-1">
                            <?= $productImage->toHtml() ?>
                        </a>
                        <div class="product details product-item-details">
                            <?php
                                $_productNameStripped = $block->stripTags($_product->getName(), null, true);
                            ?>
                            <strong class="product name product-item-name">
                                <a class="product-item-link"
                                   href="<?= /* @escapeNotVerified */ $_product->getProductUrl() ?>">
                                    <?= /* @escapeNotVerified */ $_helper->productAttribute($_product, $_product->getName(), 'name') ?>
                                </a>
                            </strong>
                            <?= $block->getReviewsSummaryHtml($_product, $templateType) ?>
                            <?= /* @escapeNotVerified */ $block->getProductPrice($_product) ?>
                            <?= $block->getProductDetailsHtml($_product) ?>
    
                            <div class="product-item-inner">
                                <div class="product actions product-item-actions"<?= strpos($pos, $viewMode . '-actions') ? $position : '' ?>>
                                    <div class="actions-primary"<?= strpos($pos, $viewMode . '-primary') ? $position : '' ?>>
                                        <?php if ($_product->isSaleable()): ?>
                                            <?php $postParams = $block->getAddToCartPostParams($_product); ?>
                                            <form data-role="tocart-form" data-product-sku="<?= $block->escapeHtml($_product->getSku()) ?>" action="<?= /* @NoEscape */ $postParams['action'] ?>" method="post">
                                                <input type="hidden" name="product" value="<?= /* @escapeNotVerified */ $postParams['data']['product'] ?>">
                                                <input type="hidden" name="<?= /* @escapeNotVerified */ Action::PARAM_NAME_URL_ENCODED ?>" value="<?= /* @escapeNotVerified */ $postParams['data'][Action::PARAM_NAME_URL_ENCODED] ?>">
                                                <?= $block->getBlockHtml('formkey') ?>
                                                <button type="submit"
                                                        title="<?= $block->escapeHtml(__('Add to Cart')) ?>"
                                                        class="action tocart primary">
                                                    <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span>
                                                </button>
                                            </form>
                                        <?php else: ?>
                                            <?php if ($_product->isAvailable()): ?>
                                                <div class="stock available"><span><?= /* @escapeNotVerified */ __('In stock') ?></span></div>
                                            <?php else: ?>
                                                <div class="stock unavailable"><span><?= /* @escapeNotVerified */ __('Out of stock') ?></span></div>
                                            <?php endif; ?>
                                        <?php endif; ?>
                                    </div>
                                    <div data-role="add-to-links" class="actions-secondary"<?= strpos($pos, $viewMode . '-secondary') ? $position : '' ?>>
                                        <?php if ($addToBlock = $block->getChildBlock('addto')): ?>
                                            <?= $addToBlock->setProduct($_product)->getChildHtml() ?>
                                        <?php endif; ?>
                                    </div>
                                </div>
                                <?php if ($showDescription):?>
                                    <div class="product description product-item-description">
                                        <?= /* @escapeNotVerified */ $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
                                        <a href="<?= /* @escapeNotVerified */ $_product->getProductUrl() ?>" title="<?= /* @escapeNotVerified */ $_productNameStripped ?>"
                                           class="action more"><?= /* @escapeNotVerified */ __('Learn More') ?></a>
                                    </div>
                                <?php endif; ?>
                            </div>
                        </div>
                    </div>
                </li>
                <?php endforeach; ?>
            </ol>
        </div>
        <?= $block->getToolbarHtml() ?>
        <?php if (!$block->isRedirectToCartEnabled()) : ?>
            <script type="text/x-magento-init">
            {
                "[data-role=tocart-form], .form.map.checkout": {
                    "catalogAddToCart": {
                        "product_sku": "<?= /* @NoEscape */ $_product->getSku() ?>"
                    }
                }
            }
            </script>
        <?php endif; ?>
    <?php endif; ?>
    

    Run CLI Commands

    rm -rf var/di/* var/generation/* var/cache/* var/log/* var/page_cache/* var/session/* var/view_preprocessed/* pub/static/*
    php bin/magento setup:upgrade
    php bin/magento setup:upgrade
    php bin/magento setup:static-content:deploy -f
    php bin/magento cache:clean
    php bin/magento cache:flush

    Now go to the product list page of your store, you will see the desired result:

    Magento 2: How to create custom form with email template using custom module?

    You need to create module like below:

    1. Create module directories Magemonkey/Customform in app/code.

    2. Create registration.php file in app/code/Magemonkey/Customform/ and put below code.

    <?php 
    MagentoFrameworkComponentComponentRegistrar::register(
        MagentoFrameworkComponentComponentRegistrar::MODULE,
        'Magemonkey_Customform',
        __DIR__
    );
    

    3. Create module.xml file in app/code/Magemonkey/Customform/etc/ and put below code.

    <pre class="lang:default decode:false"><?xml version="1.0"?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
     <module name="Magemonkey_Customform" setup_version="1.0.0"></module>
    </config></pre>

    4. Create routes.xml in app/code/Magemonkey/Customform/etc/frontend/ and put below code.

    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/App/etc/routes.xsd">
     <router id="standard">
     <route id="customform" frontName="customform">
     <module name="Magemonkey_Customform" />
     </route>
     </router>
    </config>

    5. Create email_templates.xml in app/code/Magemonkey/Customform/etc/ and put below code.

    <?xml version="1.0"?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Email:etc/email_templates.xsd">
     <template id="customform" label="custom form" file="customform.html" type="html" module="Magemonkey_Customform" area="frontend"/>
    </config>

    6. Create Index.php file under app/code/Magemonkey/Customform/Controller/ and put below code.

    <?php 
    namespace MagemonkeyCustomformControllerIndex; 
    class Index extends MagentoFrameworkAppActionAction
    {
     public function execute()
     { 
     $this->_view->loadLayout();
     $this->_view->getLayout()->initMessages();
     $this->_view->renderLayout();
     }
    }

    7. Create customform.xml layout file in app/code/Magemonkey/Customform/view/frontend/layout/ and put below code.

    <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
    <body> 
     <referenceContainer name="content">
     <block class="MagemonkeyCustomformBlockIndexIndex" name="customform" template="Magemonkey_Customform::customform.phtml"/>
     </referenceContainer> 
    </body>
    </page>

    8. Create template file customform.phtml in app/code/Magemonkey/Customform/view/templates/ and put below code.

    <form action="<?php echo $block->getBaseUrl().'customform/index/post/';?>" name="customform" method="post" id="customform" data-hasrequired="<?php echo __('* Required Fields') ?>" data-mage-init='{"validation":{}}'>
     <fieldset class="fieldset">
     <div class="form-group general-form">
     <div class="field-list">
     <div class="field name required">
     <div class="control">
     <input name="name" id="name" placeholder="<?php echo __('Full Name*') ?>" title="<?php echo __('Name') ?>" class="input-text" type="text" data-validate="{required:true}"/>
     </div>
     </div>
     <div class="field company required">
     <div class="control">
     <input name="company" id="company" placeholder="<?php echo __('Company Name*') ?>" title="<?php echo __('Company Name*') ?>" class="input-text" type="text" data-validate="{required:true}"/>
     </div>
     </div>
     <div class="field email required">
     <div class="control">
     <input name="email" id="email" placeholder="<?php echo __('Email Address*') ?>" title="<?php echo __('Email Address*') ?>" class="input-text" type="email" data-validate="{required:true, 'validate-email':true}"/>
     </div>
     </div> 
     </div> 
     </div>
     </fieldset>
     <div class="actions-toolbar">
     <div class="primary primary-group">
     <input type="hidden" name="hideit" id="hideit" value="">
     <button type="submit" title="<?php echo __('Submit Entry') ?>" class="action submit primary">
     <span><?php echo __('Submit Entry') ?></span>
     </button>
     </div>
     </div>
    </form>

    9. Create customform.html under app/code/Magemonkey/Customform/view/frontend/email/ and put below code.

    <!--@subject Customform Notification @-->
    <!--@vars
    {"store url=""":"Store Url",
    "skin url="images/logo_email.gif" _area='frontend'":"Email Logo Image"}
    @-->
    <!--@styles
    body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
    @-->
    {{template config_path="design/email/header_template"}}
    <table>
     <tr class="email-intro">
     <th>Full Name</th><td>{{var name}}</td>
     </tr>
     <tr class="email-intro">
     <th>Company Name</th><td>{{var company}}</td>
     </tr>
     <tr class="email-intro">
     <th>Email Address</th><td>{{var email}}</td>
     </tr>
     </table>
     
    {{template config_path="design/email/footer_template"}}

    10. Now create file for submitting data to post action so Create Post.php under app/code/Magemonkey/Customform/Controller/post/ and put below code.

    <?php namespace MagemonkeyCustomformControllerIndex; use MagentoFrameworkControllerResultFactory; use MagentoFrameworkAppActionAction; use MagentoFrameworkAppActionContext; use MagentoFrameworkAppRequestDataPersistorInterface; use MagentoFrameworkViewElementMessages; class Post extends Action { protected $_inlineTranslation; protected $_transportBuilder; protected $_scopeConfig; protected $_logLoggerInterface; public function __construct( MagentoFrameworkAppActionContext $context, MagentoFrameworkTranslateInlineStateInterface $inlineTranslation, MagentoFrameworkMailTemplateTransportBuilder $transportBuilder, MagentoFrameworkAppConfigScopeConfigInterface $scopeConfig, PsrLogLoggerInterface $loggerInterface, array $data = [] ) { $this->_inlineTranslation = $inlineTranslation;
            $this->_transportBuilder = $transportBuilder;
            $this->_scopeConfig = $scopeConfig;
            $this->_logLoggerInterface = $loggerInterface;
            $this->messageManager = $context->getMessageManager();
             
             
            parent::__construct($context);
             
             
        }
         
        public function execute()
        {
            $post = $this->getRequest()->getPost();
            try
            {
                // Send Mail
                $storeScope = MagentoStoreModelScopeInterface::SCOPE_STORE;                          
                $sentToEmail = $this->_scopeConfig ->getValue('trans_email/ident_general/email',MagentoStoreModelScopeInterface::SCOPE_STORE);             
                $sentToName = $this->_scopeConfig ->getValue('trans_email/ident_general/name',MagentoStoreModelScopeInterface::SCOPE_STORE);
               
    				$fromEmail = $post['email'];
    				$fromName = $post['name'];
    				$templateOptions = array('area' => MagentoFrameworkAppArea::AREA_FRONTEND, 'store' => MagentoStoreModelStore::DEFAULT_STORE_ID);		
    
    				$templateVars = array(
    									'store' => MagentoStoreModelStore::DEFAULT_STORE_ID,
    									'name'  => $post['name'],
    									'company'  => $post['company'],
    									'position'  => $post['position'],
    									'telephone'  => $post['telephone'],
    									'email'  => $post['email'],
    									'type_of_business'  => $post['type_of_business'],
    									'access_industry'  => $post['access_industry'],
    									'series'  => $post['series'],
    									'agree_administration'  => $post['agree_administration'],
    									'agree_communications'  => $post['agree_communications']
    								);
    				$from = array('email' => $fromEmail, 'name' => $fromName);
    				$this->_inlineTranslation->suspend();
    				$to = $sentToEmail;     /* Set admin email here */
    				$transport = $this->_transportBuilder->setTemplateIdentifier('Competitionform')
    								->setTemplateOptions($templateOptions)
    								->setTemplateVars($templateVars)
    								->setFrom($from)
    								->addTo($to)
    								->getTransport();
    				$transport->sendMessage();
    				$this->_inlineTranslation->resume();
                    $this->messageManager->addSuccess('Email has been sent successfully');
                    $this->_redirect('customform');
                     
            } catch(Exception $e){
                $this->messageManager->addError($e->getMessage());
                $this->_logLoggerInterface->debug($e->getMessage());
                exit;
            }
             
        }
    }

    Is it Worth spending on Magento Business Intelligence?

    Business Intelligence is playing an important role in the eCommerce industry and recently Magento has introduced its platform. So, now every online shop can take advantage of this valuable technology. Plus, Magento has managed to make BI as simple as it can be.

    Magento Business Intelligence

    The primary role of Magento Business Intelligence is to help businesses grow by making decisions based on data. Even though this sounds simple, this technology has incredibly deep and complex foundations.

    How does it work?

    Magento Business Intelligence uses data from a number of different and seemingly independent sources. In other words, this tool consolidates the data, makes sense of it, and presents it in an easy-to-understand manner. It is like having a team of dedicated professionals who work on improving your online business. Instead, this is a complicated algorithm that allows you to fully leverage the data that you already have at your disposal.

    Magento 2 already comes with in-depth tools that analyze your customers. You can see the most valuable ones, their purchases, and their frequency of shopping. However, Magento Business Intelligence takes a bit more individual approach to this data. This is done by taking a look at different channels that bring customers to your store and comparing their effectiveness. In turn, this helps you to discover the most profit-friendly channels and invest your efforts in a more rewarding way.

    What’s the Benefit?

    Turning your customers into loyal fans is yet another challenge. Magento Business Intelligence helps with this by providing statistics about new and repeat customers. This is done by analyzing CLV (customer lifetime value) with open tickets and displaying that information as a percentage. This kind of information shows the effectiveness of marketing tools and design elements of your online store.

    Custom-Tailored BI Solutions

    At the moment, there are two ways to start leveraging this highly capable tool. Magento is offering two different packages aimed at small and large online businesses.

    Business Intelligence Essentials is the entry plan that comes at an affordable price. You will receive 75 predefined reports, 5 different dashboards, the ability to add up to 10 users, and more. As such, this is the perfect starting point that brings lots of predefined data that helps you to get started in no time.

    Business Intelligence Pro is an enterprise-grade solution designed to handle large quantities of information. As such, this is a scalable and incredibly sophisticated plan. BI Pro users are free to create unlimited reports, dashboards, and to share data between 20 users. Just like the Essentials plan, the Pro plan comes with pre-built data integrations. However, the real power lies in the ability to create an entirely custom-made BI system.

    It is also worth noting that users of Magento 2.2 can already use a small part of this technology. Thanks to Magento Advanced Reporting, the latest version of this platform includes 16 reports that deal with sales, categories, and products. In turn, it provides consolidated data via static and dynamic charts, and there’s comparative analytics as well.

    Final Thoughts

    Up until now, business intelligence was utilized by Fortune 500 companies. Thanks to Magento, every online store owner can take advantage of this technology. The amount is not huge, it is something that every online store owner can afford, and this should be seen as a long-term investment. Remember that the end goal of BI is to increase your revenue. So, be prepared to spend some time learning how to take full advantage of this beneficial technology.

    So, the question is Magento Business Intelligence worth your money?

    Without any doubt, Magento Business Intelligence is well worth the money. If you’re serious about your business’ growth and making sure your customers are happy, Magento’s BI can be the best ally you’ll ever have.

    How To Secure Your Server And Platform From Hackers?

    For any Magento developer, platform and server security come first in his job. Nearly 50 per cent of the time is spent on it one way or another. In this article, we have mentioned some of the effective security steps which will save your server from hackers.

    Let’s go through the below list one by one and discuss them briefly.

    Before starting these steps make sure that your platform and server is up to date.

    These steps are mainly focused around the Magento 2 platform that are running on centos with WHM/Cpanel installed.

    1. Install Armor Anywhere

    It’s a team of 50+ ethical hackers. They keep a check on the darkweb forums for exploits people which are found and then scan your system to see if it’s vulnerable and inform you accordingly and later they patch it.

    2. Follow below link cPanelhttps://documentation.cpanel.net/display/EA/Apache+Module%3A+SuPHP

    3. Install SuPHP

    Enable cpanel server log into easyapache or you can put in a ticket with hosting provider.

    4. In WHM enable 2-factor authentication

    It needs a 6 digit code which is sent to your device authenticator app. It keeps your platform safe and locked.

    5. Through the SSH port remove FTP to force SFTP connections

    From home page go to WHM via login and then click on service manager and search for FTP un-check both boxes.

     

    6. Disable password authentication

    Now you need a key to install SSH ports on the server which you have to get out of WHM only after getting through 2 factors. First, they need your device as it is the only access point with the authenticator to get in. you can undo by restarting the server directly connected through a laptop at the data centre.

    7. Change the SSH port to anything random

    8. For cPanel install ClamAV

    9. On panel enable 2 factor

    In a password protected file save the passwords for the server.

    10. Using ‘Host Access Control’ restricted WHM, Cpanel, SSH, cpdavd to your IP, and your hosting companies IPs.

    11. Disable Symlink

    https://documentation.cpanel.net/display/EA4/Symlink+Race+Condition+Protection

    12. Disable non used php version php 5.5,5.6,7.0,7.1

    13. Enabled Jail shell

    14. In WHM search for security and open the security adviser and follow below suggestions

    • Setup Mod_Security

    • Set production files as read-only

    15. For the root disable SSH login

    USER https://mediatemple.net/community/products/dv/204643810/how-do-i-disable-ssh-login-for-the-root-user

    16. Use SSH Agent Forwarding to SSH from servers to servers instead of copying your SSH private keys on servers. On GNU/Linux use ssh-agent or GnomeKeyring with ForwardAgent yes under a trusted Host entry in your .ssh/config file6

    On Windows PuTTY’s Pageant supports SSH

    Agent Forwarding

    17. For admin install two-factor authentication

    The number of platforms is compromised due to SQL injection which creates an admin user. If they get an admin account then they use the marketplace to download a file editing program that allows them to upload files mainly known as virus’s malware, etc and in Magento 2 you can run the below command by login into SSH

    composer require msp/twofactorauth:3.0.0

    18. Always copy files and database independently. Do not use cpanel to cpanel account to transfer your account.

    19. Avoid using the same passwords on the new account and also change database and account passwords.

    20. enable a jailed shell environment for all new and modified users, use the Use cPanel® jailshell by default option in WHM’s Tweak Settings interface (WHM >> Home >> Server Configuration >> Tweak Settings).

    21. Always include the suEXEC module during the compilation of Apache as it makes that CGI applications and scripts run as the user that owns as well as executes them.

    22. In WHM go to security adviser to make sure you pass all the checks.