Last active
February 26, 2018 13:48
-
-
Save krillo/2c3e3ca44be856187595516646618b9c to your computer and use it in GitHub Desktop.
This file contains 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
Show static block on: | |
---------------------------- | |
cms-page | |
{{block class="Magento\\Cms\\Block\\Block" block_id="cpa-usp-block"}} | |
phtml | |
<?php echo $block->getLayout()->createBlock('Magento\Cms\Block\Block')->setBlockId('lilly-infobox-2')->toHtml();?> | |
Get absolute path via $objectManager | |
----------------------------------- | |
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); | |
$directory = $objectManager->get('\Magento\Framework\Filesystem\DirectoryList'); | |
echo $rootPath = $directory->getRoot(); | |
Get absolute path via module | |
----------------------------------- | |
https://www.extensionsmall.com/blog/get-absolute-path-file-magento-2/ | |
Newsletter subscription | |
----------------------- | |
{{block class="Magento\Newsletter\Block\Subscribe" name="static.newsletter" template="Magento_Newsletter::subscribe.phtml"}} | |
eller | |
<?php echo $this->getLayout()->createBlock("Magento\Newsletter\Block\Subscribe")->setTemplate("Magento_Newsletter::subscribe.phtml")->toHtml(); ?> | |
path to a template image in a static block | |
------------------------------------------ | |
<img src="{{view url="images/logo_footer.png"}}" alt="" class="lilly-footer-img" /> | |
get a value from core_config_data via objectmanager | |
-------------------------------------------------- | |
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); | |
$configInterface = $objectManager->get('\Magento\Framework\App\Config\ScopeConfigInterface');echo | |
echo $configInterface->getValue('cataloginventory/item_options/min_qty', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment