Archive for the ‘Tips’ Category

Magento2 disable WYSIWYG Cms Editor

Go to Stores -> Configuration -> Content Management -> Enable WYSIWYG Editor: Disabled by Default / Disabled Completely

Magento2 db schema upgrade

1. change setup_version in app/code/Vendor/Module/etc/module.xml 2. run bin/magento setup:db-schema:upgrade

Magento 2 Select from Db in a template

<?php … $om = \Magento\Framework\App\ObjectManager::getInstance();   $connection = $om->create(’\Magento\Framework\App\ResourceConnection’)->getConnection(\Magento\Framework\App\ResourceConnection::DEFAULT_CONNECTION);   $tblSalesOrder = $connection->getTableName(’pinamondo_seotext’); $results = $connection->fetchAll(’SELECT name FROM `’.$tblSalesOrder.’`’);   var_dump($results); …

Remove magento cache

rm $MAGENTO_FOLDER/var/cache/*

Select simple products of configurable product

<?php   $product = Mage::getModel(’catalog/product’)->load(127); $confProduct = Mage::getModel(’catalog/product_type_configurable’)->setProduct($product); $simpleProductsCollection = $confProduct->getUsedProductCollection() ->addAttributeToSelect(’*’) ->addFilterByRequiredOptions(); foreach($simpleProductsCollection as $simpleProduct) { var_dump($simpleProduct->getId()); }

Magento Db Configuration File

File: $MAGENTO_DIR/app/etc/local.xml The code you see should look very similar to the following. Simply modify the settings and save. Change the values within the CDATA brackets. <connection> <host><![CDATA[localhost]]></host> <username><![CDATA[database_username]]></username> <password><![CDATA[database_password]]></password> <dbname><![CDATA[database_name]]></dbname> <active>1</active> </connection>