Hot answers tagged

3

You should try this echo $this->getLayout()->createBlock("Vendor\Module\Block\Myblock")- >setTemplate("My_Module::history-suite.phtml")->toHtml();


3

Please Check Below Step :- Go to your Magento store root folder. You need open the contact_index_index.xml file to edit. The file is stored under the app\design\frontendMgs\child_theme_name\Magento_Contact\layout folder. Add This Code In contact_index_index.xml <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:...


3

Go To Store -> (Under Attribute) Product Search page_layout Attribute. Set Your Default Layout


2

I've found a solution pretty simple. $block = $result->getLayout()->setData(['test'=> 'Content here'])->getBlock('category.description'); $block->setTemplate('Vendor_Module::myTemplate/blank.phtml') ->toHtml(); Then my blank.phtml: <?php print_r($this->getData()) ?> It prints: Array ( [test] => Content here [module_name] =&...


2

Try Below way. Create your block file and add below code <?php namespace YourCompanyName\YourModuleName\Block; class YourCustomBlock extends \Magento\Framework\View\Element\Template { protected $_productCollectionFactory; protected $_productVisibility; public function __construct( \Magento\Framework\View\Element\Template\Context $...


2

You will have to override customer_account_index.xml. To Override this file in your extension, copy customer_account_index.xml at app/code/VendorName/ModuleName/view/frontend/layout and add below code : <?xml version="1.0"?> <!-- /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ --> <page xmlns:...


2

To override the layout file in module simple SpaceName/ModuleName/view/frontend/layoutname.xml Example SpaceName/ModuleName/view/frontend/cms_index_index.xml Your Case SpaceName\ModuleName\view\frontend\layout\customer_account_index.xml


1

I guess that you want a new product collection depends created_atfield. So, you have to create a block class at your module and at that block class, you have to create a product collection and sort by DESCENDING created_at ORDER. I have create a block class at here depends on the structure of Magento\Catalog\Block\Product\NewProduct and that block class ...


1

Option 1: Create catalog_product_view.xml in your theme Magento_Root/app/design/frontend/Yourtheme/Magento_Catalog/layout And paste below code. <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> &...


1

This is a tricky one, I got a similar case and found a solution, using the _initSelect in the collection and changing the index in the xml. Just follow the steps and you will be fine! First you need to add a preference for the collection and overwrite _initSelect(): <preference for="Magento\GiftCardAccount\Model\ResourceModel\Giftcardaccount\Collection" ...


1

I found it out. Apparently I need to use referenceBlock category.products, The following code works for me. <referenceContainer name="content"> <referenceBlock name="category.products"> <block name="product_list" class="Magento\Catalog\Block\Product\ListProduct"> <action method="setTemplate"> &...


Only top voted, non community-wiki answers of a minimum length are eligible