Monday, 11 November 2019

Magento 2 admin product disabled filter issues

You have to copy the vendor\magento\module-catalog\Ui\DataProvider\Product\ProductCollection.php  
to
app/code/Magento/Catalog/Ui/DataProvider/Product/ProductCollection.php  

Replace the following code in addAttributeToFilterAllStores(Attribute $attributeModel, array $condition): void function

$condition = "({$pKey} = {$fKey}) AND ("
            . $this->_getConditionSql("{$tableName}.value", $condition)

            . ')';


With 


$attributeId = $attributeModel->getAttributeId();
        $condition = "({$pKey} = {$fKey}) AND ("
            . $this->_getConditionSql("{$tableName}.value", $condition)
            . ') AND ('
            . $this->_getConditionSql("{$tableName}.attribute_id", $attributeId)

            . ')';

Friday, 8 November 2019

Magento 2 Order Grid not showing NEW orders

1 - Go to Admin panel
2 - Click Stores - Configuration
3 - Advanced - Developer - Grid Settings
4 - Set Asynchronous Indexing to "Enable"
5 - Flush cache - (php bin/magento cache:flush;)
6 - Go to the database table "sales_order_grid". You can truncate this table.
7 - run this command twice - php bin/magento cron:run
8 - Flush cache - (php bin/magento cache:flush;)
9 - Set Asynchronous Indexing to "Disable"
10 - Flush cache - (php bin/magento cache:flush;)

Saturday, 5 October 2019

10 Top Unix Shell Scripting Interview Questions And Answers

1) What is Shell?

Ans: Shell is a command interpreter, which interprets the command which the user gives to the kernel. It can also be defined as an interface between a user and operating system.

2) What is Shell Scripting?

Ans: Shell scripting is nothing but series or sequence of UNIX commands written in a plain text file. Instead of specifying one job/command at a time, in shell scripting we give a list of UNIX commands like a to-do list in a file to execute it.

3) What is the Importance of writing Shell Scripts?

Ans: The points given below explain the importance of writing shell scripts.

Shell script takes input from the user, file and displays it on the screen.
Shell scripting is very useful in creating your own commands.
It is helpful in automating some tasks of the day to day life.
It is useful for automating system administration tasks.
Mainly it saves time.

4) What are the Advantages of C Shell over Bourne Shell?

Ans: The advantages of C Shell over Bourne Shell are:

C shell allows aliasing of commands i.e. a user can give any name of his choice to the command. This feature is mainly useful when a user has to type the lengthy command again and again. At that point of time, instead of typing a lengthy command a user can type the name that he has given.
C shell provides command history feature. C shell remembers the previously typed command. Thus, it avoids typing the command again and again.

5) How many shell scripts come with UNIX operating system?

Ans: There are approximately 280 shell scripts that come with the UNIX operating system.

6) What are the default permissions of a file when it is created?

Ans: 666 i.e. rw-rw-rw- is the default permission of a file when it is created.


7) What are Shell Variables?

Ans: Shell variables are the main part of shell programming or scripting. They mainly provide the ability to store and manipulate information within a shell program.


8) What is the lifespan of a variable inside a shell script?

Ans: The lifespan of a variable inside shell script is only until the end of execution.


9) Generally, each block in UNIX is how many bytes?

Ans: Generally, each block in UNIX is of 1024 bytes.

10) What is a file system?

Ans: The file system is a collection of files which contain related information of the files.

How to check cronjob details in Magento 2?

Use the following command


crontab -l

Git fetch all data without checkout

git fetch origin master:master

MySql Database Export Command

mysqldump -u dbusername -p databasename> database.sql
then press enter, they you have to paste the password.

Install SSL Free lets encrypt

sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository universe
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install certbot python-certbot-nginx

sudo certbot --nginx

sudo service nginx restart


You have to check the 60 and 442 port are open or not in the inbout and outbound area.

Magento 2 with ZipPay payment method

Command 1: cd your Magento install dir

Command 2: composer require zipmoney/magento2

Command 3: composer update

Command 4: php bin/magento setup:upgrade

Command 5: php bin/magento setup:di:compile

How to Install Magento 2 on Ubuntu 18.04

#######   How to Install Magento 2 on Ubuntu 18.04 ######

Login with your server and follow the steps


sudo apt update && sudo apt upgrade
sudo apt install unzip

sudo apt install mysql-server mysql-client


sudo mysql

CREATE DATABASE magento2;

GRANT ALL ON magento2.* TO 'magento2'@'localhost' IDENTIFIED BY 'Z6TyZnMux0gcNRXk!1';   #magento 2 is db name and user name


UPDATE mysql.user SET Super_Priv='Y' WHERE user='magentotheme2' AND host='%';
UPDATE mysql.user SET Super_Priv='Y' WHERE user='magento2' AND host='%';
GRANT SUPER ON *.* TO magentotheme2@localhost;
GRANT SUPER ON *.* TO magento2@localhost;
flush privileges;

EXIT;


###################  Create system user

sudo useradd -m -U -r -d /home/www www
sudo usermod -a -G www www-data

#sudo chmod 750 /home/www

#########################   Installing and configuration php

sudo apt install php7.2-common php7.2-cli php7.2-fpm php7.2-opcache php7.2-gd php7.2-mysql php7.2-curl php7.2-intl php7.2-xsl php7.2-mbstring php7.2-zip php7.2-bcmath php7.2-soap

sudo systemctl status php7.2-fpm


sudo sed -i "s/memory_limit = .*/memory_limit = 2048M/" /etc/php/7.2/fpm/php.ini
sudo sed -i "s/upload_max_filesize = .*/upload_max_filesize = 256M/" /etc/php/7.2/fpm/php.ini
sudo sed -i "s/zlib.output_compression = .*/zlib.output_compression = on/" /etc/php/7.2/fpm/php.ini
sudo sed -i "s/max_execution_time = .*/max_execution_time = 18000/" /etc/php/7.2/fpm/php.ini
sudo sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/7.2/fpm/php.ini
sudo sed -i "s/;opcache.save_comments.*/opcache.save_comments = 1/" /etc/php/7.2/fpm/php.ini


sudo nano /etc/php/7.2/fpm/pool.d/www.conf

write the following

[www]
user = www
group = www

listen = /run/php/php7.2-fpm.sock
listen.owner = www
listen.group = www

;pm = dynamic
;pm.max_children = 5
;pm.start_servers = 2
;pm.min_spare_servers = 1
;pm.max_spare_servers = 3

pm = dynamic
pm.max_children = 25
pm.start_servers = 10
pm.min_spare_servers = 5
pm.max_spare_servers = 20
pm.max_requests = 500


Then

sudo systemctl restart php7.2-fpm

ls -al /var/run/php/php7.2-fpm.sock


#Installing Composer

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer


########  Change user
sudo su www
then go to cd /home/www

run the following command to download the magento

composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition

To Install magento through command then run the following command

php bin/magento setup:install --base-url=http://limextechnology.com/ \
        --base-url-secure=https://limextechnology.com/ \
        --admin-firstname="Debendra" \
        --admin-lastname="Prusty" \
        --admin-email="debendra@limextechnology.com" \
        --admin-user="debendra" \
        --admin-password="admin1234@" \
        --db-name="magento2" \
        --db-host="localhost" \
        --db-user="magento2" \
        --currency=USD \
        --timezone=America/Chicago \
        --use-rewrites=1 \
        --db-password="Z6TyZnMux0gcNRXk!1"




############  If Nginx is not installed then run the following commands only ##############################
sudo apt update
sudo apt install nginx
sudo systemctl status nginx
sudo systemctl restart nginx

$$$$$$$$$  Some Command $$$$$$$$$$$$$$$$$$$$
sudo systemctl stop nginx
sudo systemctl start nginx
sudo systemctl restart nginx
sudo systemctl reload nginx
sudo systemctl disable nginx
sudo systemctl enable nginx
###############################  End Nginx installation #########################################



sudo nano /etc/nginx/sites-available/default

Add the followng lines


upstream fastcgi_backend {
server unix:/run/php/php7.2-fpm.sock;
}

server {

server_name limextechnology.com;

access_log /var/log/nginx/access-limex.log;
error_log /var/log/nginx/error-limex.log;

set $MAGE_ROOT /home/www;
set $MAGE_MODE developer; # or production
include /home/www/nginx.conf.sample;


}

server {
server_name limextechnology.com;
listen 80;

}



sudo nginx -t

sudo systemctl restart php7.2-fpm
sudo systemctl restart nginx

##################  End the Magento 2 Installation ###################################################