sumnima sumnima sumnima sumnima sumnima sumnima sumnima
Categories
blog ecommerce magento magento 2

Importing product with images in Magento 2

Add new Product if no existing product is there in existing Magento store.

Go to System > Data Transfer > Export

Select entity type as product and click on on continue button that is in the bottom of the page. Once you click on continue button you can download the csv file of exported products . Use the exported sheet for reference to fill the values and then fill yours values accordingly , fill image name with file extension as .jpg or .png etc as mentioned in this screenshot:

then go to var folder create one folder having name ( import ) and place the image having same name as mentioned in the import csv file and then

Go to System > Data Transfer > Import

and select entity type as an product select import behavior as per yours need and then browse for file from Select File to Import browse option after this enter the path of import folder in our case it is var/import in the Images File Directory text box as mentioned in the following screenshot :

Then click on check data button on top right corner. If you did everything correct you will get this screen

enter image description here

Click import button and then do reindexing using CMD:

php bin/magento indexer:reindex

and then flush the cache:

php bin/magento cache:flush

and then check yours frontend it will show imported products with images.

http://magento.stackexchange.com/questions/85292/have-any-idea-how-can-create-or-import-product-in-magento-2?rq=1

Categories
blog magento 2

Add custom block on listing page : Magento2

I want to add my custom block on listing page[Magento-2] but without any modification on list.phtml or any .phtml file. Is there any possibility by using xml file ?

jmtbt

You can do that if you create new module to override this block: vendor\magento\module-catalog\Block\Product\ListProduct.php

to override this block, you need to create di.xml at app\code\Vendor\Module_Name\etc

di.xml content:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\Catalog\Block\Product\ListProduct" type="Vendor\Module_Name\Block\Product\ListProduct" />
</config>

Create new file name ListProduct.php at app\code\Vendor\Module_Name\Block\Product

ListProduct.php content:

namespace Vendor\Module_Name\Block\Product;
class ListProduct extends \Magento\Catalog\Block\Product\ListProduct
{
    public function getProductDetailsHtml(\Magento\Catalog\Model\Product $product)
    {
        $html = $this->getLayout()->createBlock('Magento\Framework\View\Element\Template')->setProduct($product)->setTemplate('Vendor_ModuleName::test.phtml')->toHtml();
        $renderer = $this->getDetailsRenderer($product->getTypeId());
        if ($renderer) {
            $renderer->setProduct($product);
            return $html.$renderer->toHtml();
        }
        return '';
    }
}

You can change block Magento\Framework\View\Element\Template to your block

create test.phtml file at app\code\Vendor\Module_Name\view\frontend\templates

 

Categories
blog ecommerce magento magento 2

Updating/Upgrading to Magento 2.0.6 (via composer)

Updating/Upgrading to Magento 2.0.6 (via composer)

composer require magento/product-community-edition 2.0.6 --no-update
composer update
rm -rf var/di var/generation
php bin/magento cache:clean
php bin/magento cache:flush
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento indexer:reindex
Categories
blog ecommerce magento magento 2 Theme

Magento 2 – Keep Product Image Aspect Ratio

Magento_Catalog/templates/product/list.phtml

<?php
 //$image = 'category_page_grid' or 'category_page_list';
 $_imagehelper = $this->helper('Magento\Catalog\Helper\Image');

 $productImage = $_imagehelper->init($_product, $image)->constrainOnly(FALSE)->keepAspectRatio(TRUE)->keepFrame(FALSE)->resize(400)->getUrl();
?>

<img src="<?php echo $productImage; ?>" />
Categories
blog ecommerce magento magento 2

Moving Product Tabs – Magento 2

app/design/frontend/Vendor/theme_name/Magento_Catalog/page_layout/catalog_product_view.xml

<move element="product.info.details" destination="product.info.main" after="product_options_wrapper_bottom"/>
Categories
blog magento magento 2 SSH

php -f bin/magento setup:upgrade

php -f bin/magento setup:upgrade
Categories
blog Linux Nginx SSH ubuntu

nginx shutdown terminal ssh

sudo shutdown -h now
Categories
blog Nginx

nginx 80 port restart

sudo fuser -k 80/tcp ; sudo /etc/init.d/nginx restart
Categories
blog Let's Encrypt Nginx SSH SSL ubuntu

Quick Secure Nginx with Let’s Encrypt on Ubuntu 14.04

cd /opt/letsencrypt
./letsencrypt-auto certonly -a webroot --webroot-path=/usr/share/nginx/html -d example.com -d www.example.com
sudo ls -l /etc/letsencrypt/live/your_domain_name
sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048
sudo ln -s /etc/nginx/sites-available/example.com.conf /etc/nginx/sites-enabled/example.com.conf

Set Up Auto Renewal

/opt/letsencrypt/letsencrypt-auto renew
Categories
blog browser google chrome

Slow Google chrome?

1. Click on Start –> In search box, type cmd –> Then “CMD” will be

displayed in the search –> Now right-click on “CMD” —> Select “Run as administrator”.

2. Now enter this command

netsh winsock reset –> Press Enter.

Restart your PC.

Categories
blog cloudflare digitalocean Nginx

whitelisting cloudflare in nginx digitalocean

Create /etc/nginx/cloudflare-allow.conf

# https://www.cloudflare.com/ips
# IPv4
allow 199.27.128.0/21;
allow 173.245.48.0/20;
allow 103.21.244.0/22;
allow 103.22.200.0/22;
allow 103.31.4.0/22;
allow 141.101.64.0/18;
allow 108.162.192.0/18;
allow 190.93.240.0/20;
allow 188.114.96.0/20;
allow 197.234.240.0/22;
allow 198.41.128.0/17;
allow 162.158.0.0/15;

# IPv6
allow 2400:cb00::/32;
allow 2606:4700::/32;
allow 2803:f800::/32;
allow 2405:b500::/32;
allow 2405:8100::/32;

Then in your /etc/nginx/sites-available/site.com add:

server {
  listen 80; ## listen for ipv4; this line is default and implied
  listen [::]:80 default ipv6only=on; ## listen for ipv6

  include /etc/nginx/cloudflare-allow.conf;
  deny all;

  server_name direct.site.com www.site.com site.com;

  #...the rest of your config here...
}