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 | |
| /** | |
| * This file is part of Namespace for Magento. | |
| * | |
| * @license All rights reserved | |
| * @author Phuong LE <[email protected]> <@> | |
| * @category Namespace | |
| * @package Namespace_Core | |
| * @copyright Copyright (c) 2016 Agence Soon (http://www.agence-soon.fr) | |
| */ |
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 | |
| /** | |
| * Copyright © 2016 Soon. All rights reserved. | |
| */ | |
| /** Location : app/code/Namespace/MyModule **/ | |
| \Magento\Framework\Component\ComponentRegistrar::register( | |
| \Magento\Framework\Component\ComponentRegistrar::THEME, | |
| 'frontend/Namespace/MyThemeName', |
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
| Price Product excluding tax set in BO : 8,25 € | |
| Tax rate : 10 % | |
| For Magento the Tax Amount is 0,83 € | |
| But 8,25 * 10/100 = 0,825 € | |
| The final Price will be 9,08 € | |
| Why Magento return 0,83 € ? |
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 | |
| /** | |
| * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | |
| * @author Phuong LE <[email protected]> <@> | |
| * @copyright Copyright (c) 2016 Agence Soon (http://www.agence-soon.fr) | |
| */ | |
| namespace Namespace\Cms\Setup; | |
| use Magento\Cms\Model\Page; |
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 | |
| /** | |
| * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | |
| * @author Phuong LE <[email protected]> <@> | |
| * @copyright Copyright (c) 2016 Agence Soon (http://www.agence-soon.fr) | |
| */ | |
| namespace NameSpace\Customer\Setup; | |
| use Magento\Customer\Api\CustomerMetadataInterface; |
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
| <config> | |
| <frontend> | |
| <events> | |
| <!-- Disable native module observer --> | |
| <your_event_name> | |
| <observers> | |
| <observer_name> | |
| <type>disabled</type> | |
| </observer_name> | |
| </observers> |
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 | |
| /** Assume you get your product in your block.*/ | |
| $product = $this->product; | |
| $finalPrice = $product->getPriceInfo()->getPrice('final_price')->getAmount()->getValue(); | |
| /** Note for best practice , it's better to call your helper in your block **/ | |
| echo $this->helper('Magento\Framework\Pricing\Helper\Data')->currency(number_format($finalPrice,2), true , false); | |
| ?> |
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 | |
| /** | |
| * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | |
| * @author Phuong LE <[email protected]> <@> | |
| * @copyright Copyright (c) 2017 Agence Soon (http://www.agence-soon.fr) | |
| */ | |
| namespace MyVendor\MyModule\Observer; | |
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 | |
| try { | |
| /* @var $installer Mage_Core_Model_Resource_Setup */ | |
| $installer = $this; | |
| $customDir = Mage::getBaseDir('var') . DS . 'my' . DS . 'awesome' . DS . 'folder'; | |
| $ioFile = new Varien_Io_File(); | |
| $ioFile->checkAndCreateFolder($customDir); |
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 | |
| $time = Mage::getModel('core/date')->timestamp(time()); | |
| $date = new Zend_Date($time, Zend_Date::TIMESTAMP); | |
| $subday = 1; | |
| $date->subDay($subday); // -1 day | |
| $date->addDay(1); // +1 day | |