Wednesday 27 January 2016

To update the categories display mode using sql query in magento2 database

use below update query to update display mode

UPDATE catalog_category_entity_varchar SET value='PAGE'  WHERE attribute_id=49 AND store_id=0 AND entity_id in(<categoryids>);

To know the attribute id of a attribute code in magento2 using sql query

select attribute_id from eav_attribute WHERE entity_type_id = (select entity_type_id from eav_entity_type WHERE entity_type_code = '<entity>') AND attribute_code = '<code>'


Example:

select attribute_id from eav_attribute WHERE entity_type_id = (select entity_type_id from eav_entity_type WHERE entity_type_code = 'catalog_category') AND attribute_code = 'display_mode'

Magento2- To get/know the Entity type is from DB magento2

select entity_type_id from eav_entity_type WHERE entity_type_code = '<entity_code>';

 Example: to know category entity id

select entity_type_id from eav_entity_type WHERE entity_type_code = 'catalog_category';

Thursday 14 January 2016

Remove Wishlist and compare products from sidebar in magento2



Use below code in layout xml file

<referenceBlock name="catalog.compare.sidebar" remove="true"/>
        <referenceContainer name="wishlist_sidebar" remove="true" />

Wednesday 13 January 2016

Remove Compare products from sidebar from a perticular page - Magento2

Compare products from sidebar can be removed from a particular page

Example: In my case, it is not required in catalog-categoy-view page

app/design/frontend/Magento/theme-frontend-sample/Magento_Catalog/layout/catalog_category_view.xml

add below tag after <body> tag

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

Monday 11 January 2016

To update setup in magento2 after exention installed

run this from command promt


php bin/magento setup:upgrade

Sunday 10 January 2016

Magento2 -- To make text changes like add to cart in Magento2

To make text changes in magento2,
just you need to override language core file

To do this create a new file in your theme location
app/design/frontend/Magento/<theme-frontend-sample>/i18n/en_US.csv

then you can make the changes

Example:

To change the 'Add to Cart' text in magento2
Add below one in app/design/frontend/Magento/<theme-frontend-sample>/i18n/en_US.csv

"Add to Cart","Add to Bag"

 Any queries related to this, please post in comments...

Keep learn the magento2

Magento2 -- To change the theme css and colors in Magento2

To change the theme css in magento2


   create a file
   app/design/frontend/Magento/<theme-frontend-sample>/web/css/source/_extend.less 

add respective changes in above file


Example to override the color variables
      @color-orange-red1: #ff5501; change to
   @color-orange-red1: #FF3645;

it is overrides all orange color to your needed one.

Same way you can override the classes.

.action.primary {
    background: #000000;
  } 


For more information

http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/css-guide/css_quick_guide_mode.html

Friday 8 January 2016

Magento 2--> 404 error for scipts and css


When not in production mode Magento 2 will try to create symlinks for some static resources. You can change that behavior by doing the following.
  1. Open up app/etc/di.xml and find the virtualType name="developerMaterialization" section. In that section you'll find an item name="view_preprocessed" that needs to be modified or deleted. You can modify it by changing the contents from Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink to Magento\Framework\App\View\Asset\MaterializationStrategy\Copy
  2. Delete the files under pub/static to get rid of any existing symlinks. You may want to be careful not to delete the .htaccess file.
This should solve your error with the symlink.