$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$cookieManager = $objectManager->get('Magento\Framework\Stdlib\CookieManagerInterface');
// set cookie value
$cookieManager->setPublicCookie('key', 'value');
//get cookie value
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace Paarth\HelloWorld\Setup; | |
| use Magento\Framework\Setup\UpgradeDataInterface; | |
| use Magento\Framework\Setup\ModuleContextInterface; | |
| use Magento\Framework\Setup\ModuleDataSetupInterface; | |
| class UpgradeData implements UpgradeDataInterface | |
| { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <VirtualHost *:80> | |
| ServerAdmin info@example.com | |
| DocumentRoot "/Users/example/Sites/magento2" | |
| ServerName local.magento2 | |
| <Directory "/Users/example/Sites/magento2"> | |
| Options Indexes FollowSymLinks Includes | |
| AllowOverride All | |
| Allow from All | |
| Order deny,allow | |
| </Directory> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| php bin/magento setup:backup --db | |
| gzip var/backups/*.sql | |
| git pull | |
| php bin/magento maintenance:enable | |
| php bin/magento cache:enable | |
| rm -fr var/di var/generation var/cache | |
| php bin/magento setup:di:compile | |
| php bin/magento deploy:mode:set production --skip-compilation | |
| php bin/magento maintenance:enable | |
| php bin/magento setup:upgrade |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SET FOREIGN_KEY_CHECKS = 0; | |
| #clear orders | |
| TRUNCATE TABLE `gift_message`; | |
| TRUNCATE TABLE `quote`; | |
| TRUNCATE TABLE `quote_address`; | |
| TRUNCATE TABLE `quote_address_item`; | |
| TRUNCATE TABLE `quote_id_mask`; | |
| TRUNCATE TABLE `quote_item`; | |
| TRUNCATE TABLE `quote_item_option`; | |
| TRUNCATE TABLE `quote_payment`; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| setup | |
| ----- | |
| php bin/magento setup:upgrade | |
| php bin/magento setup:static-content:deploy | |
| php bin/magento setup:di:compile | |
| module | |
| ------ | |
| php bin/magento module:status | |
| php bin/magento module:enable Kahanit_TableRateShipping |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0"?> | |
| <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd"> | |
| <acl> | |
| <resources> | |
| <resource id="Magento_Backend::admin"> | |
| </resource> | |
| </resources> | |
| </acl> | |
| </config> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| use Magento\Framework\App\Bootstrap; | |
| include('app/bootstrap.php'); | |
| $bootstrap = Bootstrap::create(BP, $_SERVER); | |
| $objectManager = $bootstrap->getObjectManager(); | |
| $state = $objectManager->get('Magento\Framework\App\State'); | |
| $state->setAreaCode('frontend'); |
The array of data you can pass to the \Magento\Eav\Setup\EavSetup::addAttribute() method is as follows:
$data = [
'group' => 'General', // Name ofgroup in product admin page to place attribtue
'type' => 'varchar', // database storeage type (varchar|int|text|decimal)
'sort_order' => 1000,
'backend' => '', // backend_model: class name used to retrieve/save the attribute data to the db
'frontend' => '', // frontend_model: ????
'label' => 'UPC', // frontend_label: the label text
OlderNewer