Posts

Magento 2: Delete sample data and test data from your store

Here is a script to delete all the test data from your magento store. This can come in handy especially at the time of launching your website from beta to production mode. Don't forget to bookmark it for your next launch. NOTE: It is advisable to take full database backup before performing any operations below: SCRIPT: SET FOREIGN_KEY_CHECKS=0; # Clean order history TRUNCATE TABLE `sales_bestsellers_aggregated_daily`; TRUNCATE TABLE `sales_bestsellers_aggregated_monthly`; TRUNCATE TABLE `sales_bestsellers_aggregated_yearly`; # Clean order infos TRUNCATE TABLE `sales_creditmemo`; TRUNCATE TABLE `sales_creditmemo_comment`; TRUNCATE TABLE `sales_creditmemo_grid`; TRUNCATE TABLE `sales_creditmemo_item`; TRUNCATE TABLE `sales_invoice`; TRUNCATE TABLE `sales_invoiced_aggregated`; TRUNCATE TABLE `sales_invoiced_aggregated_order`; TRUNCATE TABLE `sales_invoice_comment`; TRUNCATE TABLE `sales_invoice_grid`; TRUNCATE TABLE `sales_invoice_item`; TRUNCATE TABLE `sales_order`; TRUNCATE

Magento 2 - How to generate translation strings for your magento project

If you have want to create a multi-language store then you may require to translate all English strings into the language of your choice. For this you will need accumulate all of the eligible strings for translation into a CSV file. In this article we will discuss how to generate this list of strings from your Magento project which are eligible for translations. Magento allows the list generation with following command: For Whole Project: php bin/magento i18n:collect-phrases --magento -o translations.csv cat translations.csv For A Particular Module: php bin/magento i18n:collect-phrases path/to/my/module -o translations.csv cat translations.csv Thenafter, this CSV file (translations.csv in above example) can be translated either manually or using third party translator extensions like Qordoba.

Elastic Search - How to install and manage multiple versions of elastic search

It is possible to install and manage multiple versions of elastic search using an Elastic search version Manager. You can simply follow below steps to install EVM and start Elastic search with your desired version: STEPS sudo curl -o /usr/local/bin/evm https://raw.githubusercontent.com/duydo/evm/master/evm sudo chmod +x /usr/local/bin/evm evm install 7.4.0 /** You can replace 7.4.0 with your desired elastic search version **/ evm install 5.4.0 /** You can replace 5.4.0 with your desired elastic search version **/ evm use 7.4.0 /** You can replace 7.4.0 with your desired elastic search version **/ evm start curl http://localhost:9200 If you want to install another version, then you can stop the EVM and install another version in the similar manner. NOTE: For this Tutorial we have used Duydo EVM which is available here: https://github.com/duydo/evm to download and run elasticsearch version 7.4.0.

Xdebug - PHPStorm - Ubuntu: How to configure Xdebug on Ubuntu for PHPStorm

Image
For this illustration we are using PHP7.3 Find the path of your PHP ini files by opening the console and running following command: php --ini In your root folder create a new file using following command and generate Phpinfo file: sudo vi phpinfo.php Now in your browser run: http://localhost/phpinfo.php . Copy the entire output from this page and paste it into https://xdebug.org/wizard This will give you the download link to xdebug. Now open your console and run below commands: Check the path against "Scan the additional .ini files in". In most cases the path would look something like "/usr/local/etc/php/7.3/conf.d" sudo vi /usr/local/etc/php/7.3/conf.d/ext-xdebug.ini Now in your PHPStorm perform below steps: Click on PHPStorm > Preferences > Languages & Frameworks > PHP > Debug Under Xdebug > Change "Debug Port" to "9001" and select "Can accept external connections Click on Apply Yo

Instagram - How to unfollow someone's posts without actually unfollowing their account

Image
Instagram now provides a feature where in you can unfollow/ignore someone's posts and activity without actually unfollowing the account. Instagram will not notify the person about this. This is a fantastic feature of instagram which can help avoid unwanted content from an account without needing to unfollow the account. You can do this by following method: Login to instagram on your browser or mobile app. Navigate to the profile you wish to ignore. Click on the three dots (3 horizontal dots if you are on desktop browser and 3 vertical dots if you are on mobile app) at the top right corner. Now click on "Restrict" from the dropdown list. Now click on "Restrict Account". Now you will no longer see any posts, messages or comments from the restricted account. Any comments left by the restricted account on your posts will remain hidden until you specifically approve the comment. Image sources: Instagram.co

XDebug - PHPStorm - Mac: How to configure Xdebug with PHPStorm on Mac OS and PHP 7.3

Image
For this illustration we are using PHP7.3 Find the path of your PHP ini files by opening the console and running following command: php --ini In your root folder create a new file using following command and generate Phpinfo file: sudo vi phpinfo.php Now in your browser run: http://localhost/phpinfo.php . Copy the entire output from this page and paste it into https://xdebug.org/wizard This will give you the download link to xdebug. Now open your console and run below commands: Check the path against "Scan the additional .ini files in". In most cases the path would look something like "/usr/local/etc/php/7.3/conf.d" sudo vi /usr/local/etc/php/7.3/conf.d/ext-xdebug.ini Now in your PHPStorm perform below steps: Click on PHPStorm > Preferences > Languages & Frameworks > PHP > Debug Under Xdebug > Change "Debug Port" to "9001" and select "Can accept external connections Click on Apply Yo

MongoDB - PHP7.3: How to install MongoDB with PHP 7.3.x on a Mac Catalina 10.15.x OS with Homebrew

The usual command to install mongoDB which is as below: pecl install mongodb However, this will fail on MAC Catalina OS with PHP 7.3.x with following error: In file included from /usr/local/Cellar/php@7.3/7.3.23/include/php/Zend/zend.h:335: /usr/local/Cellar/php@7.3/7.3.23/include/php/Zend/zend_operators.h:486:10: error: 'asm goto' constructs are not supported yet __asm__ goto( In order to fix this error, you will need to do below: Optional steps: In case you do not have homebrew installed you can install it with this command: $ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" In case you still face issues with mongoDB installation then perform below and try the pecl install mongodb command again -- Download XCode 12 beta CLI tools and XCode 12 beta from https://developer.apple.com/xcode/resources/

Magento 2: How to fix Temando Error logs

If you are not using Temando Shipping module which comes packaged with Out of the Box Magento in your E-commerce site then most likely you will see your var/log/system.log file being spammed with numerous errors that look like below: [2020-09-02 11:13:03] temando.CRITICAL: "accountId" is required. Enter and try again. { "exception":"[object] (Magento\\Framework\\Exception InputException(code: 0): \"accountId\" is required. Enter and try again at /vendor/magento/framework/Exception/InputException.php:91)" } This error is a Core magento bug. It may seem minor, but over a period of time if ignored, it can result in a humungous system log file size and as a result your actual logs and important messages can get lost between these errors. In order to fix this error there are 2 ways: 1) Disable the Temando_Shipping module in your magento site using this command: php bin/magento module:disable Temando_Shipping OR 2) Create a d

Magento 2: How to place order as a guest customer using Magento 2 REST API

In order to place a new order as a guest customer using REST APIs in Magento 2, please follow below steps: MAGENTO 2 REST APIs: CREATE GUEST CART: NOTE: Quote/Cart ID here is received from Step 1 of creating guest cart. ADD ITEMS TO GUEST CART: GET TOTALS OF GUEST CART: ESTIMATE SHIPPING OF GUEST CART: SET BILLING AND SHIPPING DETAILS OF GUEST CART: PLACE ORDER FROM GUEST CART:

Magento 2: How to login as Customer and place new order via REST APIs

In order to place a new order as a logged in customer using REST APIs in Magento 2, please follow below steps: You can Download the Postman Tool from here: www.postman.com Now, Open Post man and create below Requests: MAGENTO 2 REST APIs: CUSTOMER LOGIN: CREATING CUSTOMER QUOTE: ADD ITEMS TO CART COLLECT CART TOTALS GET AVAILABLE SHIPPING METHODS & ESTIMATING SHIPPING CHARGES SET BILLING AND SHIPPING ADDRESS OF ORDER PLACE ORDER Now check your admin panel and there will be a new COD order placed.