Skip to content

Instantly share code, notes, and snippets.

View luizventurote's full-sized avatar

Luiz Venturote luizventurote

View GitHub Profile
@luizventurote
luizventurote / magento-2-server-tips.md
Last active October 16, 2016 17:23
Magento 2 Server Tips

Show Server Mode

php bin/magento deploy:mode:show

Production server mode

php bin/magento deploy:mode:set production --skip-compilation

Developer server mode

php bin/magento deploy:mode:set developer

Disable these caches to be more faster in development mode:

@luizventurote
luizventurote / magento-2-enable-error-and-exception-log.md
Last active September 27, 2022 22:41
Enable error and exception logging in Magento2

Step 1

Inside pub/errors folder, rename local.xml.sample to local.xml.

Step 2

Uncomment ini_set('display_errors', 1); on app/bootstrap.php file.

More info

@luizventurote
luizventurote / disable-m2-extension.sh
Last active September 28, 2016 14:15
Enable or Disable Magento 2 extension manually
php bin/magento module:disable VendorName_ModuleName
php bin/magento setup:upgrade
@luizventurote
luizventurote / magento-2-permissions.md
Created September 14, 2016 16:04
Magento 2 Folder and Files permissions

find . -type f -exec chmod 644 {} ;

find . -type d -exec chmod 755 {} ;

find ./var -type d -exec chmod 777 {} ;

find ./pub/media -type d -exec chmod 777 {} ;

find ./pub/static -type d -exec chmod 777 {} ;

@luizventurote
luizventurote / instagram_api.php
Created September 12, 2016 22:01 — forked from arturmamedov/instagram_api.php
Instagram API retrive access token with PHP curl
<?php
// yo can follow this guide to http://www.benrlodge.com/blog/post/how-to-generate-an-instagram-access-token#
#1 first you need to create a Client in Instgram Developer Dashboard
// https://www.instagram.com/developer/clients/manage/
#2 after you need to retrive a oAuth code for after get access_token
// https://www.instagram.com/developer/authentication/
// change the params with your one and open link in browser
@luizventurote
luizventurote / magento-mamp-bugfix.md
Created August 13, 2016 00:38
How to fix Magento installation error in Mac MAMP

Open index.php in your root folder and make sure those two lines below are not commented or just add them:

Mage::setIsDeveloperMode(true);

ini_set(‘display_errors’, 1);

Then you will probably see Notice: Array to string conversion in

/Applications/MAMP/htdocs/magento/app/code/core/Mage/Core/Model/Layout.php on line 555

@luizventurote
luizventurote / gist:8270f909a1ed72e222526e6127d0b34a
Created July 23, 2016 02:47 — forked from jelmerdemaat/gist:4107273
JavaScript hasClass, addClass, removeClass
// JavaScript hasClass, addClass, removeClass
//source: http://www.avoid.org/?p=78
function hasClass(el, name) {
return new RegExp('(\\s|^)'+name+'(\\s|$)').test(el.className);
}
function addClass(el, name)
{
if (!hasClass(el, name)) { el.className += (el.className ? ' ' : '') +name; }
@luizventurote
luizventurote / load-price-template.php
Last active July 31, 2017 12:55
Loading price template in any custom Magento template
<?php echo $this->getLayout()->createBlock('catalog/product')->getPriceHtml($_product) ?>
<?php echo $this->getLayout()->createBlock('catalog/product_price')
->setTemplate('catalog/product/product-view-price.phtml')
->setProduct($_product)
->setDisplayMinimalPrice(true)
->setIdSuffix($idSuffix='_product_price')
->toHtml(); ?>
@luizventurote
luizventurote / gist:2298848fb6cb23dd1c13cb2990489d5f
Created May 24, 2016 16:03 — forked from aleron75/gist:7304592
Programmaticalli create a Yes/No Magento Category Attribute
<?php
/** @var Mage_Eav_Model_Entity_Setup $installer */
$installer = $this;
$installer->startSetup();
$this->addAttribute(
'catalog_category',
'my_custom_attribute',
array(
'group' => 'General Information',
@luizventurote
luizventurote / override-product-price-template-in-magento.md
Last active April 4, 2017 17:38
Override Product Price Template In Magento

Use this:

<?php echo $this->getLayout()->createBlock('catalog/product_price')
            ->setTemplate('catalog/product/customprice.phtml')
            ->setProduct($_product)
            ->setDisplayMinimalPrice(true)
            ->setIdSuffix($idSuffix='amit')
            ->toHtml(); ?>

Instead of getPriceHtml($_product, true) ?&gt;