Categories
blog magento 2

magento 2 display sub category with image at category

app/design/frontend/Themeness/minu/Magento_Catalog/templates/category/products.phtml

[html]


getCurrentCategory(); ?>
getChildrenCategories(); ?>
helper(‘Magento\Catalog\Helper\Output’); ?>

0): ?>

    getChildrenCategories() as $subcategory): ?>
    create(‘Magento\Catalog\Model\Category’)->load($subcategory->getId()); ?>

Categories
blog ecommerce magento Nginx

magento 2 permission 2018

sudo chown -R rawi:www-data Magento-CE-2
find /var/www/html/magento/Magento-CE-2 -type f -print0 | xargs -r0 chmod 640
find /var/www/html/magento/Magento-CE-2 -type d -print0 | xargs -r0 chmod 750
chmod -R g+w /var/www/html/magento/Magento-CE-2/app/etc
chmod -R g+w /var/www/html/magento/Magento-CE-2/var
chmod -R g+w /var/www/html/magento/Magento-CE-2/generated
chmod -R g+w /var/www/html/magento/Magento-CE-2/vendor
chmod -R g+w /var/www/html/magento/Magento-CE-2/pub
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

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 ecommerce magento magento 2 mysql

magento 2 installation on digitalocean #bookmark

last part.

go to bin

php magento sampledata:deploy
php magento setup:di:compile
php magento setup:upgrade 
 

Categories
blog ecommerce magento magento 2 mysql

magento 2 installation digitalocean lamp bookmark

magento 2 installation digitalocean lamp #bookmark

apt-get update
apt-get install git wget
wget -O /usr/local/bin/composer http://getcomposer.org/composer.phar
chmod +x /usr/local/bin/composer
cd /var/www/html

download and upload magento file https://www.magentocommerce.com/download

upload and unzip 
tar xjf file.tar.bz2
cd /var/www/html/theory
composer install
chown -R root:www-data /var/www/html/theory
find /var/www/html/theory -type f -print0 | xargs -r0 chmod 640
find /var/www/html/theory -type d -print0 | xargs -r0 chmod 750
chmod -R g+w /var/www/html/theory/{pub,var}
chmod -R g+w /var/www/html/theory/{app/etc,vendor}

DATABASE

https://www.digitalocean.com/community/tutorials/a-basic-mysql-tutorial

mysql -u root -p
SHOW DATABASES;
CREATE DATABASE database name;
 DROP DATABASE database name;
 
GRANT ALL PRIVILEGES ON databasename.* TO 'databaseuser'@'localhost' IDENTIFIED BY 'passwordfordatabase';