Skip to content

Instantly share code, notes, and snippets.

View GideonBabu's full-sized avatar
💭
Looking for a challenging opportunity

Gideon Babu GideonBabu

💭
Looking for a challenging opportunity
View GitHub Profile
@GideonBabu
GideonBabu / magento2_commands_shortcut.txt
Created August 7, 2018 07:40
Magento 2 Commands Shortcuts
php bin/magento s:up - Setup Upgrade
php bin/magento s:up --keep-generated
php bin/magento c:c - Cache Flush
php bin/magento c:f - Cache Flush
php bin/magento c:d - Disable Cache
php bin/magento c:e - Enable Cache
php bin/magento i:rei - Reindexing
php bin/magento i:i - View the list of indexers
php bin/magento i:st - Indexer status
php bin/magento i:res - Indexer Resets
@GideonBabu
GideonBabu / shell-commands.txt
Last active March 5, 2019 05:49
Useful Shell Commands for Web Development
Compress: tar -czvf name-of-archive.tar.gz /path/to/directory-or-file
Extract: tar -xzvf archive.tar.gz
compress with exclusion of some folders:
tar --exclude='./folder' --exclude='./upload/folder2' -zcvf /backup/filename.tgz .
To find the files using it's name:
find <path> -name "filename-with-extension"
@GideonBabu
GideonBabu / writemagento2log.php
Created July 6, 2018 10:20
Magento 2 write logs into custom file
$writer = new \Zend\Log\Writer\Stream(BP . '/var/log/test.log');
$logger = new \Zend\Log\Logger();
$logger->addWriter($writer);
$logger->info('Your text message');
@GideonBabu
GideonBabu / Gideon\Returns\Setup\UpgradeData.php
Created July 5, 2018 13:23
Magento 2: Update product attribute programmatically
//$eavSetup->updateAttribute(Product::ENTITY, $attributeCode, $attributeField, $value);
$eavSetup->updateAttribute('catalog_product', 'price', 'position', 100);
@GideonBabu
GideonBabu / Gideon\Returns\Setup\UpgradeData.php
Last active July 5, 2018 12:37
Magento 2 remove attribute options/values
<?php
namespace Gideon\Returns\Setup;
use Magento\Eav\Setup\EavSetupFactory;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\UpgradeDataInterface;
use \Magento\Framework\App\ObjectManager;
@GideonBabu
GideonBabu / Company\Module\Block\Product\ProductList\Toolbar.php
Last active March 5, 2020 12:36
Magento 2: Product sorting high to low and low to high
<?php
namespace Company\Module\Block\Product\ProductList;
class Toolbar extends \Magento\Catalog\Block\Product\ProductList\Toolbar
{
public function setCollection($collection) {
$this->_collection = $collection;
$this->_collection->setCurPage($this->getCurrentPage());