Questions tagged [custom-block]

The tag has no usage guidance, but it has a tag wiki.

Filter by
Sorted by
Tagged with
0
votes
0answers
33 views

Magento 2, adding block to a template which does not have xml file

I need to add below block (my custom moudule) to <referenceContainer name="content"></referenceContainer>strictly, but the target template (third-party module) is created via plugin and ...
1
vote
1answer
1k views

Add block to cart summary in magento 2

How can i add custom text block into cart summary?
1
vote
1answer
1k views

Adding a new block to a Product detail page above Add to Cart block

So I'm trying to add a block to the product page. The block will simply output an attribute if it exists for that particular product. In this case it is outputting the bottle size. Now I've got the ...
0
votes
1answer
6k views

how to set custom template in custom block file in magento 2 [duplicate]

How to set custom template in custom block file. I have created a template which contains paragaraph. I need to set this template in my block file . So What is the syntax to set template. I have ...
3
votes
1answer
947 views

How can I insert block before breadcrumbs or just after menu on every page?

I would like to add block to the website (in general on every page) just below menu but not into header, "root" eventually "content". I managed to add it into content but it's not what I wanted. => ...
2
votes
1answer
2k views

Programmatically create and append a block to another block

I've declared a plugin that creates and adds a block programmatically if a condition is true. However, my code outputs nothing, it's like if the created block is not rendered at all. etc/di.xml <...
0
votes
2answers
499 views

Magento 1.9.3 calling a custom block in cart page unsuccessful

I have a very basic module: app/code/local/Demo/Custom/Block/Giftproducts.php class Demo_Custom_Block_Giftproducts extends Mage_Core_Block_Template { public function getGiftProducts() { //...
1
vote
1answer
98 views

Magento Irregular caching of my custom block

I have created a custom block to display 10 random products on my homepage, and for load time etc, it is a bad idea to request random products from the database each load. Thus, have incorporated the ...
1
vote
1answer
587 views

Block is not calling properly in magento 2 custom module

I have a custom theme in magento 2 website. In home page i called a banner slider(Banner_slider is a custom module) I called the slider like this in home_content.phtml(design/frontend/company/...
0
votes
1answer
475 views

Magento 2 - controller block not displaying template

I want my module controller to show content inside of store layout (eg show header, then my controller data, then footer, so it will look like being part of the store, not on a blank page). I created ...
0
votes
1answer
456 views

Call third party module block in CMS page in magento 2

Is there any way to insert custom block in CMS page in Magento 2.2 alike inserting CMS block in CMS page?
1
vote
2answers
696 views

Where is Content block for <reference name=“content” tag

if I use a layout such as: <layout> <{handle}> <reference name="content"> ... {blocks} ... According to docs and tutorial the reference's name attribute points ...
0
votes
2answers
479 views

How to insert block from custom module into home page?

How can I insert custom block into the Home Page using custom layout.xml ?
3
votes
0answers
46 views

Load products page inside phtml page Magento 2

I have a custom .phtml page, and i want to insert products page which contain layered navigation like this: so i already have filtered product collection, is there a chance to do call this products ...
0
votes
1answer
78 views

Custom block on product page if product is out of stock / in stock

I want to add two custom blocks on product page - one to be displayed if product is in stock and the other one if product is out of stock.
2
votes
2answers
680 views

Check if customer logged in not working

I have a block to add link at top based on if customer login like this, when i'm at myaccount page the header link show the right one, but when i go to other page it shows the wrong one, here's my ...
0
votes
1answer
476 views

How to override an extension admin template

There is an extension which I want to add a little more features on. To achieve that I need to modify two .phtml files in app/design/adminhtml/default/default/template/Orderpreparation/Packing/...
1
vote
1answer
493 views

Display Polls with a custom template shows only empty results

Meta Magento 1.9.2.1 Custom Template Poll works fine when in sidebar Poll works fine when loaded by layout xml History Based on this information: http://inchoo.net/magento/magento-frontend/...
1
vote
1answer
2k views

Magento 2: How to add custom form on category page?

I am using Magento 2.1 and I am trying to add one custom form in catalog page. I override the catalog_category_view to my custom module and use this code <referenceContainer name="columns.top"&...
1
vote
2answers
1k views

Magento2: Calling upsell block from phtml is not working.

I want get up-sell product block. when I am working with XML script block is working. but when I am trying to this in .phtml file it's showing nothing .I do not what is wrong with .phtml and XML data ...
4
votes
2answers
640 views

Magento1 createBlock method returns “bool(false)” in livehost

I've made a module that, in my localhost works fine.. The block shows up and ok, but in "livehost" the block don't appear, so I created a controller to make some tests and see what is the problem. ...
0
votes
2answers
717 views

Invalid block type while accessing the custom block (Magento 2)

Error in magento 2.0.11 while accessing custom block Invalid block type: Tomrain\Appcustomizer\Block\Customizepage #0 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout/...
1
vote
3answers
635 views

magento 2 block function not calling my phtml

Magento 2 Block function not calling. How to call PHP <?php namespace MPS\Allproduct\Block\New\List; class List extends \Magento\Framework\View\Element\Template { protected function ...
1
vote
0answers
476 views

Conditionally Add Body Class Within Module Block?

I'm currently adding a body class in my module's default.xml but I can't (to my knowledge) conditionally add it within the XML file based on the module's configuration values. See this question - ...
1
vote
3answers
742 views

Directory of custom block in magento 2.1

I create a file custom block php. Directory is: app\design\frontend\Vendor\default\Magento_Theme\Block\CustomBlock.php CustomBlock.php: class CustomBlock extends \Magento\Framework\View\Element\...
2
votes
0answers
72 views

Magento2 : Problem in block creation

I try to modify the template of a custom option type in backend, sales order view section. In this page, product options are not displayed using a dedicated template, but only by returning Html of ...
11
votes
1answer
989 views

Magento2: Conditionally replace block template and class the right way

This rather trivial requirement turns out be quite a pain for us in recent days, as we couldn't find a satisfying existing solution, yet. The Task We are trying to replace certain blocks with a ...
1
vote
2answers
119 views

Why is DI working in controller but not in Blocks?

I was trying my hand on Magento 2. I am able to get the checkout session data inside a controller by injecting \Magento\Checkout\Model\Session $checkoutSession, in controllers construct method. But ...
0
votes
1answer
99 views

How do I insert a block from a phtml file on magento 2.0 admin?

I have an index file on my server and I am trying to get it to show the contents on my site by linking it on the homepage through the admin. In Magento 1, I did it like this and it worked: {{block ...
0
votes
1answer
70 views

Magento 2 Adding a block

I'm following the exercises of "Magento2 development cookbook". In the part of "Adding a block of new products" (previously to that all works fine). I have: app/code/Packt/HelloWorld/view/frontend/...
0
votes
1answer
3k views

jQuery-ui autocomplete: Cannot read property 'element' of undefined

I am trying to add autocomplete input field below checkout shipping-method. But it is not working. When i look at chrome console i see those errors. Error messages: knockout.js:3012 Uncaught ...
3
votes
1answer
4k views

magento 2 - How to create a custom “admin” block and display it on an existing Admin page?

I need to create a custom "admin" block and display it on any admin "product edit" page in Magento 2.1.x. But I also want to be able to display it on any admin page, if I need. Which block classes ...
2
votes
2answers
800 views

Magento 2 Custom New Block without module

I want to display special product on CMS home page in magento 2.1.3 What i did is : 1) created block under app/code/Magento/Catalog/Block/Product/Special.php <?php /** * Copyright © 2016 ...
6
votes
3answers
1k views

How to include module's CSS in CMS pages with module block

I have prepared one module in which I have prepared two .phtml files and included css and js through module layout file. Now, I want to include those .phtml file in different blocks and pages. I have ...
1
vote
3answers
158 views

Custom Block Product List Injection failed

I have to display a list of product on the product view, depending on its sku. In order to do that, i have simply pasted the Random.php list example of Magento_Catalog. But in order to find the ...
0
votes
2answers
72 views

How do i hide description block if no data found [duplicate]

I am using magento version 1.9 and I need to hide description block if no data found, if data exits the block shows description, if not found, that should be hide.
4
votes
2answers
879 views

Mtslideshow SUPE8788 getConfig returns null

I am trying to understand why this code in production is not working (it comes from a custom theme): protected function _prepareLayout() { $uploaderBlock = $this->getLayout()->...
1
vote
2answers
1k views

Magento 2: Custom block doesn't show on the cart page

Namespace/Modulename/Block/donation.php namespace Namespace\Modulename\Block; class Productpoint extends \Magento\Framework\View\Element\Template { public function __construct( \...
2
votes
2answers
627 views

Magento 1.8 - Custom Block just on Homepage

I am trying to add a custom block to just the homepage. All pages use the same template which is 1column.phtml In this file I have added a customblock above the content: <?php echo $this->...
2
votes
2answers
3k views

How do you add a custom block in checkout/cart page in magento2?

I am trying to create a custom block on the checkout/cart page so that I can show a countdown to free shipping. I keep getting Invalid block type as an error, though. checkout_cart_index.xml <?...
0
votes
2answers
882 views

Magento 2 Invalid Block Type in Custom Module?

How can I Rectify Invalid Block Type Error in my custom module. I created a custom module in magento 2 for overriding default product list page with separate phtml file I am calling them in category ...
1
vote
1answer
6k views

Adding a new custom phtml block to the header

How does one add a new block and template file to the header in Magento2? So far I've created a child theme, which is working, including a default.xml, which is successfully moving other block around....
1
vote
0answers
294 views

getOrder() doesn't return Mage_Sales_Model_Order when debugging

I try to var_dump($order) but it gives me : object(Varien_Object)#290 (7) { ["_data":protected]=> array(0) { } ["_hasDataChanges":protected]=> bool(false) ["_origData":protected]=> NULL ["...
2
votes
1answer
246 views

Help create a block to insert view.phtml

Help create a block to insert view.phtml. I have a layout file that outputs to buy in one click in the right column. I need to put this block alongside a buy button. <checkout_cart_index> &...
1
vote
1answer
413 views

Custom Block generating an error on template: Magento

I have CMS block in magento admin and it included the following code: <div id="featured-products" class="tab">{{block type="featuredproducts/listing" template="featured/featuredproducts/...
1
vote
1answer
391 views

Module not working after namespace magento 2

I used this module https://github.com/sohelrana09/magento2-module-additional-shipping-block to add a custom block to the shipment method, when I moved it to another namespace , it does not work ...
2
votes
1answer
298 views

Add custom stylesheet with my custom block [duplicate]

*In my custom block I want to add custom stylesheet to display the block as like i want. How it can be possible.
0
votes
0answers
21 views

html not appearing

Below code is working fine in product/media.phtml $_saleLabelHelper = $this->helper('custom_catalog/salelabel') echo $_saleLabelHelper->getSaleLabelHtml($_product); But the same code is not ...
0
votes
1answer
42 views

How to refer to no named block in Magento 2

I have block: <block class="Magento\Backend\Block\Widget\Grid\Column" as="name"> <arguments> <argument name="header" xsi:type="string" translate="true">Title</...
2
votes
1answer
78 views

How to ovveride a block in custom module?

I want to override the Catalog module. So I created my first custom module, I initiated it in app/etc/modules/MyCompany_Catalog.xml: <?xml version="1.0"?> <config> <modules> ...