New answers tagged

0

Though Evgeny Levinsky ans will work but if you dont wish to make new theme then you can also do the same things using custom module first create a custom module using this link https://www.mageplaza.com/magento-2-module-development/ and then create a default.xml file at below location and add the following lines of code <root>\Vendor\Module\view\...


0

In the first phtml .You can set the data in this way <?= $block->getLayout()->createBlock(Vendor/ModuleName/Block/BlockFile::class) ->setTemplate("Vendor_ModuleName::template_file.phtml") ->setData('data', 10) ->toHtml() ?> And In the second phtml ie (template_file.phtml) call the data in this way <?= $block-&...


0

Replace your di.xml with below code : <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\Checkout\Model\CompositeConfigProvider"> <arguments> &...


0

PHP does not run in HTML files so you cannot directly do this. A common but not very clean workaround is to add the HTML from the static block to window.checkoutConfig using PHP and then render that in your HTML file like so: <div data-bind="html: window.checkoutConfig.yourCmsBlock"></div>


0

For those that can't find a resolution to this, I was pulling my hair out until I realised my static block was set to Disabled.... Content -> Blocks -> Select line and set Status to 'Enabled' Worth mentioning maybe...


0

Not 100% sure that I understand what you want to do, but if you've created a block with html, and you're trying to insert it on the homepage, create a widget, add the block to the widget, then in the layout updates section, choose homepage - main content area


0

Just because I couldnt find it anywhere else I did override: <preference for="Magento\Catalog\Block\Product\ListProduct" type="My\Vendor\Block\Product\ListProduct" /> <preference for="Magento\CatalogSearch\Block\SearchResult\ListProduct" type="My\Vendor\Block\Product\ListProduct" /> So now, I can extend ...


0

i Don't have worked with Block form But I worked on the same thing in UI component Hope Adding Custom component will work same in Block Like this List item Feilds: $fieldset->addField( 'layer_id', 'select', [ 'name' => 'layer_id', 'label' => __('Layer Name'), 'title' => __('Layer Id'), 'component' =&...


1

I have gathered many controllers that all use different outputs. The first one is the most commonly used and it does interact with the layout. The other can output plain text, json and build your own blocks use Magento\Framework\App\Action\Context; use Magento\Framework\App\ResponseInterface; class Index extends \Magento\Framework\App\Action\Action ...


0

If the main purpose is to change the html content of the output in \Magento\Catalog\Block\Product\View\Options\Type\Select.php, you can try via virtualType. <virtualType name="customCheckable" type="Magento\Catalog\Block\Product\View\Options\Type\Select\CheckableFactory"> <arguments> <argument name="...


3

Check This Steps Step-1 : First you need to check your module is enable or not. Step-2 : You need to check are you working on right magento url or not. Step-3 : Check your Route name in routes.xml app\code\VendoreName\ModuleName\etc\frontend <?xml version="1.0" ?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ...


0

in your collection add these below function \Model\ResourceModel\Custom\Collection.php /** * Add filter by status code(s) to collection * * @param string|string[] $status * @return $this */ public function loadByStatus($status) { if (!empty($status)) { if (is_array($status)) { $this->...


Top 50 recent answers are included