Thursday 29 March 2018

How to remove compare, adto wishlist, sku in magento 2

<referenceBlock name="catalog.compare.sidebar" remove="true"/>
    <referenceBlock name="view.addto.compare" remove="true" />
    <referenceBlock name="view.addto.wishlist" remove="true" />

    <referenceBlock name="product.info.sku" remove="true"/>


================= All remove sidebar =============
<referenceContainer name="sidebar.additional" remove="true" />

================== wishlist remove sidebar============
<referenceBlock name="wishlist_sidebar" remove="true" />


Move short description below page product detail title via XML magento 2


app/design/frontend/webguru/mifitness/Magento_Catalog/layout/catalog_product_view.xml

Move short description below page product detail title via XML magento 2
<move element="product.info.overview" destination="product.info.main" before="product.info"/>

Magento 2: Safe and easiest way to disable Compare products & Wishlist Module

Magento 2: Safe and easiest way to disable Compare products & Wishlist Module
<referenceBlock name="view.addto.compare" remove="true" />

How to Remove product details apge Email to

How to Remove product details apge Email to

app/design/frontend/webguru/mifitness/Magento_Catalog/layout/catalog_product_view.xml

<referenceBlock name="product.info.mailto" remove="true" />

How to move product description after product options in Magento2

How to move product description after product options in Magento2

<move element="product.info.description" destination="product.info.main" before="product.info"/>

Tuesday 6 March 2018

How to remove breadcrumbs from category page in Magento 2

How to remove breadcrumbs from category page in Magento 2

app/design/frontend/Vendor/Theme/Magento_Catalog/layout/default.xml

---------------------------------------------------
<?xml version="1.0"?>
<!--
/**
 * Copyright © 2013-2017 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="breadcrumbs" remove="true" />
   </body>
</page>
----------------------------------------------
For remove toolbar
<referenceBlock name="product_list_toolbar" display="false" />

Sunday 4 March 2018

How To add JS file in frontend for all pages in magento 2

How To add JS file in frontend for all pages in magento 2
requirejs-config.js under :- /app/design/frontend/your_vendor/your_theme/

To load a custom main.js file on all pages (in the RequireJS-way) this is a good way:
1) Create main.js
Create main.js within the theme folder
<theme_dir>/web/js/main.js
with this content:-------------

define([
  "jquery"
],
function($) {
  "use strict";

  // Here your custom code...
  console.log('Hola');

});

2) Declare main.js with a requirejs-config.js file
Create a requirejs-config.js file within the theme folder:

<theme_dir>/requirejs-config.js

with this content:

var config = {

  // When load 'requirejs' always load the following files also
  deps: [
    "js/main"
  ]

};


--------------------------------------------
app/code/your_vendor/your_theme/Magento_Theme/layout/default_head_blocks.xml

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <!-- Add local resources -->
        <css src="css/my-styles.css"/>

        <!-- The following two ways to add local JavaScript files are equal -->
        <script src="Magento_Catalog::js/sample1.js"/>
        <link src="js/sample.js"/>

        <!-- Add external resources -->
        <css src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css" src_type="url" />
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js" src_type="url" />
        <link src="http://fonts.googleapis.com/css?family=Montserrat" src_type="url" />
    </head>
</page>