Posts

Magento 2 test data clean using my sql query

Before runing this query please take your database backup.You may face too many redirect issue in category admin view. So that error please check any third party module is using the category data or not for ex.. mageplaza seo, amasty xsearch this type of module may cause some issue in category view page. Delete all customers at once. SET FOREIGN_KEY_CHECKS=0; -- Customers TRUNCATE TABLE `customer_address_entity`; TRUNCATE TABLE `customer_address_entity_datetime`; TRUNCATE TABLE `customer_address_entity_decimal`; TRUNCATE TABLE `customer_address_entity_int`; TRUNCATE TABLE `customer_address_entity_text`; TRUNCATE TABLE `customer_address_entity_varchar`; TRUNCATE TABLE `customer_entity`; TRUNCATE TABLE `customer_entity_datetime`; TRUNCATE TABLE `customer_entity_decimal`; TRUNCATE TABLE `customer_entity_int`; TRUNCATE TABLE `customer_entity_text`; TRUNCATE TABLE `customer_entity_varchar`; TRUNCATE TABLE `customer_grid_flat`; TRUNCATE TABLE `customer_log`; TRUNCATE TABL

Magento 2 upgrade steps

Step 1: Enable Maintenance Mode  php bin/magento maintenance:enable  Step 2 : Composer Backup:  Run the following command cp composer.json composer.json.bak  Step 3 : Run this command composer require-commerce magento/product-community-edition 2.4.6-p1 --no-update  Step 4 : composer clear-cache && composer update  Step 5: Magento Schema and Data Update: Run the following commands: sudo php bin/magento setup:upgrade sudo php bin/magento setup:di:compile  Step 6: Disable Maintenance Mode php bin/magento maintenance:disable

docker compose install in local system

apt install docker docker-compose #if not installed then run this command in local for installing docker-compose up -d #To start docker services if not run 4-services then use this commands docker-compose down #To stop docker if requited docker exec -it php-fpm bash #enter in docker cli docker exec -it db bash enter database on cli then use it. sudo a2enmod proxy_http #enable proxy module ===import Db in Docker==== docker exec -i [your Docker db host] mysql -u [userName] -p[pswd] [yourDatabaseName] < [SqlFilePath]; Example.1668176117_db_dbbackup.sql ==== VirtualHost for docker project : == create this virtual host using normal process as we create and put this code for docker project. ServerName [HostName] #xyz.local.com ServerAdmin webmaster@localhost ProxyPass / http://localhost:81/ ProxyPassReverse / http://localhost:81/ ProxyPreserveHost On ProxyRequests Off ProxyVia On ErrorLog ${APACHE_LOG_DIR}/error.log Custom

Magento 2 Set multi domain run using htaccess

Options +FollowSymLinks RewriteEngine on SetEnvIf Host [YourDomainName]* MAGE_RUN_CODE=[YourStoreCode] SetEnvIf Host [YourDomainName]* MAGE_RUN_TYPE=website

Xdebug configure in php.ini

First you need to go in /etc/apache2/php.ini dir. [xdebug] find this section or put this code under this xdebug section. Before doing this the xdebug should be installed in your local system. zend_extension="xdebug.so" xdebug.mode="debug" xdebug.start_with_request=trigger xdebug.client_port=9003 xdebug.log="/home/d45-bt/logs/xdebug.log" xdebug.start_with_request="yes"

Show current branch in CLI

You need to put this code in .bashrc file. You can get this file from /home/currentusename/.bashrc in your linux system. parse_git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' } PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;31m\]$(parse_git_branch)\[\033[00m\]\$ '

Magento 2 email print in browser

/vendor/magento/framework/Mail/Template/TransportBuilder.php Function --> prepareMessage put line 409 : echo " ";print_r($this->messageData);die;