How to wipe all the tables and data in MySQL? Clean whole database

SET FOREIGN_KEY_CHECKS = 0; SET GROUP_CONCAT_MAX_LEN=32768; SET @tables = NULL; SELECT GROUP_CONCAT('`', table_name, '`') INTO @tables FROM information_schema.tables WHERE table_schema = (SELECT DATABASE()); SELECT IFNULL(@tables,'dummy') INTO @tables; SET @tables = CONCAT('DROP TABLE IF EXISTS ', @tables); PREPARE stmt FROM @tables; EXECUTE stmt; DEALLOCATE PREPARE stmt; SET FOREIGN_KEY_CHECKS = 1; Will not work via phpmyadmin or any script. this has to be run in cmd/terminal Quick Command wget https://gist.githubusercontent.com/harshvardhanmalpani/e670a8de7aa81673364dd48f125cb9ac/raw/ce04b319bf1594d148d3346e1474119fe1cd1b3f/flushdb.sql mysql -hYOUR_DATABASE_HOSTNAME -uYOUR_DATABASE_USER -p YOUR_DATABASE_NAME < flushdb.sql *Source:* https://gist.github.com/harshvardhanmalpani/e670a8de7aa81673364dd48f125cb9ac

August 3, 2019 · 1 min · Harshvardhan Malpani

How to remove sign in popup from Magento 2 checkout page?

Magento2 has this authentication pop up on checkout page, which many store owners wont like to see on their checkout page. Background of this pop up area and Related files The pop up itself is generated by Magento_Customer::account/authentication-popup.phtml But this pop up works very differently on checkout page. In fact this is a separate pop up than the one you see in header area. It is embedded in a series of js files which are governed by knockout-js ...

May 27, 2019 · 1 min · Harshvardhan Malpani

How to show correct item count in Magento 2 Checkout Order summary?

By default, app/design/Magento/Checkout/view/frontend/web/template/summary/cart-items.html file is being used Or vendor/magento/module-checkout/view/frontend/web/template/summary/cart-items.html To overload this file, create file cart-items.html in your theme folder. Make sure you place the file in Magento_Checkout/web/template/summary/ Edit the line <span data-bind="text: getCartLineItemsCount()"></span> And replace it with <span data-bind="text: getItemsQty()"></span> Reference Files: vendor/magento/module-checkout/view/frontend/web/js/view/summary/cart-items.js https://github.com/magento/magento2/blob/2.2/app/code/Magento/Checkout/view/frontend/web/template/summary/cart-items.html https://github.com/magento/magento2/blob/2.2/app/code/Magento/Checkout/view/frontend/web/js/view/summary/cart-items.js

May 27, 2019 · 1 min · Harshvardhan Malpani

How to dump all options for any attribute in Magento 2 programmatically?

The following code does not adhere to Magento’s developer recommendations. Using object manager in such a way externally is a TERRIBLE idea. Comment out line number 2 and then run the script. Edit line 11 and put the attribute code you want to dump 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 <?php header("Location: /");exit; use \Magento\Framework\App\Bootstrap; error_reporting(E_ALL); ini_set("display_errors", 1); include('./app/bootstrap.php'); $bootstrap = Bootstrap::create(BP, $_SERVER); $objectManager = $bootstrap->getObjectManager(); $eavConfig = $objectManager->get('\Magento\Eav\Model\Config'); $attribute = $eavConfig->getAttribute('catalog_product', 'manufacturer'); $options = $attribute->getSource()->getAllOptions(); $options = array_slice($options, 1); usort($options, function($a, $b) { return strcasecmp($a['label'], $b['label']); }); if (count($options)) $v = "<table>"; foreach ($options as $option) { $v .= "<tr><td>" . $option['value'] . '</td><td>' . $option['label'] . '</td></tr>'; } if (count($options)) $v .= "</table>"; echo $v; ?> <style> table tr:nth-child(odd){background:#444;color:#fff} </style>

May 21, 2019 · 1 min · Harshvardhan Malpani

Magento 2 Multi Select click all code – Tax Rates

Put the following code in console. require(["jquery"],function($){ $( ".mselect-fixed label" ).each(function( index ) { if($(this).children("input").hasClass("mselect-checked")){} else $(this).trigger('click'); }); });

April 26, 2019 · 1 min · Harshvardhan Malpani

How to customize Magento 2 Maintenance mode page?

Edit the file pub/errors/default/503.phtml and put the following code <?php /** * How to edit and customize code of Magento 2 Maintenance 503 Page * Add analytics if any * Replace <COMPANY NAME> with your Organization Name */ ?> <!doctype html> <title>Site Maintenance</title> <style> body { text-align: center; padding: 150px; } h1 { font-size: 50px; } body { font: 20px Helvetica, sans-serif; color: #333; } article { display: block; text-align: left; width: 650px; margin: 0 auto; } a { color: #dc8100; text-decoration: none; } a:hover { color: #333; text-decoration: none; } </style> <article> <h1>We&rsquo;ll be back soon!</h1> <div> <p>Sorry for the inconvenience but we&rsquo;re performing some maintenance at the moment. If you need to you can always <a href="mailto:abcd@COMPANY NAME">contact us</a>, otherwise we&rsquo;ll be back online shortly!</p> <p>&mdash; Team COMPANY NAME</p> </div> </article>

February 4, 2019 · 1 min · Harshvardhan Malpani

How to hide a specific category from Google Index in Magento 2?

In Magento Admin Panel, Go to Catalog in Left Menu > Categories Select the category you want to edit and in Design Section > Layout Update XML, put this value: <head> <meta name="robots" content="NOINDEX,NOFOLLOW"/> </head> How to add noindex nofollow on specific category page in Magento2 Save the category and then Clear the cache

January 7, 2019 · 1 min · Harshvardhan Malpani
CMS

Top CMS out there in 2018.

CMS: A content management system is a software that helps us to manage our content and site. You can literally manage everything from a blog to an e-commerce site, using CMS. You can manage an article if you have a blog, or manage your product if it is an e-commerce business. It has made our life so easier that we just can’t imagine having a site without CMS. You can operate most CMS out there even if you have no prior technical knowledge. ...

October 25, 2018 · 3 min · Harshvardhan Malpani

How to change PHP versions in VestaCP Ubuntu – Downgrade Upgrade 5.6, 7.1 and 7.2

For Downgrading 7.2 (default) to 7.1 PHP sudo add-apt-repository ppa:ondrej/php sudo apt-get update sudo apt-get install libapache2-mod-php7.1 php7.1 php7.1-bcmath php7.1-bz2 php7.1-cgi php7.1-cli php7.1-common php7.1-curl php7.1-dba php7.1-dev php7.1-enchant php7.1-fpm php7.1-gd php7.1-gmp php7.1-imap php7.1-interbase php7.1-intl php7.1-json php7.1-ldap php7.1-mbstring php7.1-mcrypt php7.1-mysql php7.1-odbc php7.1-opcache php7.1-pgsql php7.1-phpdbg php7.1-pspell php7.1-readline php7.1-recode php7.1-snmp php7.1-soap php7.1-sqlite3 php7.1-sybase php7.1-tidy php7.1-xml php7.1-xmlrpc php7.1-xsl php7.1-zip sudo a2dismod php7.2 sudo a2enmod php7.1 sudo service apache2 restart sudo update-alternatives --set php /usr/bin/php7.1 Reference: Sandy B @ mysterydata.com

October 20, 2018 · 1 min · Harshvardhan Malpani

Fix Magento 2 – php cli error on cpanel or other hostings

The problem: On a fresh install of Magento2 on cpanel based hosting, you receive the following error while running any command on SSH [eee@e1 www]$ php bin/magento cache:clean X-Powered-By: PHP/7.0.31 Content-type: text/html; charset=UTF-8 bin/magento must be run as a CLI application [eee@e1 www]$ php bin/magento setup:upgrade X-Powered-By: PHP/7.0.31 Content-type: text/html; charset=UTF-8 bin/magento must be run as a CLI application The Solution: You have to point php to correct binary; Use the following code in order: First, open the file which can alter the runtime variables like .bash_profile or .bashrc ...

September 10, 2018 · 1 min · Harshvardhan Malpani