Magento 2.3 add custom block under each product in category pageShow different wishlist icon, if user has added the icon in his wishlistMagento 1.8.0.0 Shows all Product in Category regardless of limit.How do I sort a product collection by custom product attribute on a category landing page?Magento 2: How to get add to cart url in custom templete file and add product to cartResolved: How to exclude specific attributes's values products in category product listing page?How many product details are loaded to a category page in Magento 2?how to get virtual product data in product listing page and show in configurable product in magento 2?How to get dropdown value Magento2.1Magento 2.3 how to add cms static block in footer on last page of product listingMagento 2.3.0 How to add review form in custom module?
Satellite in orbit in front of and behind the Moon
Why are flying carpets banned while flying brooms are not?
Do gauntlets count as armor?
Manager is asking me to eat breakfast from now on
why neutral does not shock. how can a neutral be neutral in ac current?
setcounter is not affecting numbering
Does the Bracer of Flying Daggers really let a thief make 4 attacks per round?
Killing a star safely
What would be the effects of (relatively) widespread precognition on the stock market?
Can two waves interfere head on?
Rule of thumb to choose right mix of Rodinal developer?
How can electronics on board JWST survive the low operating temperature while it's difficult to survive lunar nights?
Can a creature sustain itself by eating its own severed body parts?
Alignment problem with a mathematical equation in a presentation in beamer
A bicolour masyu
Inside Out and Back to Front
Do I have to mention my main characters age?
Why is the forgetful functor representable?
BIP-23 criticism: Is bitcoin PoW actually sha256+merkleGeneration? Or have I misunderstood coinbase/append?
Could Europeans in Europe demand protection under UN Declaration on the Rights of Indigenous Peoples?
Infinite points on circle
Host telling me to cancel my booking in exchange for a discount?
Why does airflow separate from the wing during stall?
Do pedestrians imitate automotive traffic?
Magento 2.3 add custom block under each product in category page
Show different wishlist icon, if user has added the icon in his wishlistMagento 1.8.0.0 Shows all Product in Category regardless of limit.How do I sort a product collection by custom product attribute on a category landing page?Magento 2: How to get add to cart url in custom templete file and add product to cartResolved: How to exclude specific attributes's values products in category product listing page?How many product details are loaded to a category page in Magento 2?how to get virtual product data in product listing page and show in configurable product in magento 2?How to get dropdown value Magento2.1Magento 2.3 how to add cms static block in footer on last page of product listingMagento 2.3.0 How to add review form in custom module?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I need to overwrite the product listing (category) page, a custom form needs to show after that product information.
So I have found that already an extension is overwriting that page as below
<referenceBlock name="category.products.list">
<action method="setTemplate">
<argument name="template" xsi:type="string">Custom_ModuleName::list.phtml</argument>
</action>
</referenceBlock>
How to add that custom form after the each products from my custom module?
Please advise.
magento2 magento2.3 category-products custom-block list.phtml
add a comment |
I need to overwrite the product listing (category) page, a custom form needs to show after that product information.
So I have found that already an extension is overwriting that page as below
<referenceBlock name="category.products.list">
<action method="setTemplate">
<argument name="template" xsi:type="string">Custom_ModuleName::list.phtml</argument>
</action>
</referenceBlock>
How to add that custom form after the each products from my custom module?
Please advise.
magento2 magento2.3 category-products custom-block list.phtml
What is purpose of this block class.You have to call your block at Custom_ModuleName::list.phtml inside for each loop
– Amit Bera♦
Jul 12 at 8:11
Hi Amit, the purpose is I have to show grid-based form to fill quantity. How to call by block in third party extension? please share some code if possible
– Antony
Jul 12 at 8:33
Please check my last update also.
– Rohan Hapani
Jul 12 at 8:41
Hi Rohan, Thank you. Let me try and update you. Can I able to call a phtml file in that method? As I have to show a form to add to cart.
– Antony
Jul 12 at 8:45
Yes. You can do anything in this function.
– Rohan Hapani
Jul 12 at 9:00
add a comment |
I need to overwrite the product listing (category) page, a custom form needs to show after that product information.
So I have found that already an extension is overwriting that page as below
<referenceBlock name="category.products.list">
<action method="setTemplate">
<argument name="template" xsi:type="string">Custom_ModuleName::list.phtml</argument>
</action>
</referenceBlock>
How to add that custom form after the each products from my custom module?
Please advise.
magento2 magento2.3 category-products custom-block list.phtml
I need to overwrite the product listing (category) page, a custom form needs to show after that product information.
So I have found that already an extension is overwriting that page as below
<referenceBlock name="category.products.list">
<action method="setTemplate">
<argument name="template" xsi:type="string">Custom_ModuleName::list.phtml</argument>
</action>
</referenceBlock>
How to add that custom form after the each products from my custom module?
Please advise.
magento2 magento2.3 category-products custom-block list.phtml
magento2 magento2.3 category-products custom-block list.phtml
asked Jul 12 at 7:42
AntonyAntony
187 bronze badges
187 bronze badges
What is purpose of this block class.You have to call your block at Custom_ModuleName::list.phtml inside for each loop
– Amit Bera♦
Jul 12 at 8:11
Hi Amit, the purpose is I have to show grid-based form to fill quantity. How to call by block in third party extension? please share some code if possible
– Antony
Jul 12 at 8:33
Please check my last update also.
– Rohan Hapani
Jul 12 at 8:41
Hi Rohan, Thank you. Let me try and update you. Can I able to call a phtml file in that method? As I have to show a form to add to cart.
– Antony
Jul 12 at 8:45
Yes. You can do anything in this function.
– Rohan Hapani
Jul 12 at 9:00
add a comment |
What is purpose of this block class.You have to call your block at Custom_ModuleName::list.phtml inside for each loop
– Amit Bera♦
Jul 12 at 8:11
Hi Amit, the purpose is I have to show grid-based form to fill quantity. How to call by block in third party extension? please share some code if possible
– Antony
Jul 12 at 8:33
Please check my last update also.
– Rohan Hapani
Jul 12 at 8:41
Hi Rohan, Thank you. Let me try and update you. Can I able to call a phtml file in that method? As I have to show a form to add to cart.
– Antony
Jul 12 at 8:45
Yes. You can do anything in this function.
– Rohan Hapani
Jul 12 at 9:00
What is purpose of this block class.You have to call your block at Custom_ModuleName::list.phtml inside for each loop
– Amit Bera♦
Jul 12 at 8:11
What is purpose of this block class.You have to call your block at Custom_ModuleName::list.phtml inside for each loop
– Amit Bera♦
Jul 12 at 8:11
Hi Amit, the purpose is I have to show grid-based form to fill quantity. How to call by block in third party extension? please share some code if possible
– Antony
Jul 12 at 8:33
Hi Amit, the purpose is I have to show grid-based form to fill quantity. How to call by block in third party extension? please share some code if possible
– Antony
Jul 12 at 8:33
Please check my last update also.
– Rohan Hapani
Jul 12 at 8:41
Please check my last update also.
– Rohan Hapani
Jul 12 at 8:41
Hi Rohan, Thank you. Let me try and update you. Can I able to call a phtml file in that method? As I have to show a form to add to cart.
– Antony
Jul 12 at 8:45
Hi Rohan, Thank you. Let me try and update you. Can I able to call a phtml file in that method? As I have to show a form to add to cart.
– Antony
Jul 12 at 8:45
Yes. You can do anything in this function.
– Rohan Hapani
Jul 12 at 9:00
Yes. You can do anything in this function.
– Rohan Hapani
Jul 12 at 9:00
add a comment |
1 Answer
1
active
oldest
votes
Create di.xml file at /app/code/Vendor/Module/etc/frontend/di.xml
:
<type name="MagentoCatalogBlockProductListProduct">
<plugin name="block-product-list" type="VenderModulePluginProductList"/>
</type>
Create Plugin file ProductList.php at /app/code/Vendor/Module/Plugin
:
<?php
namespace VenderModulePlugin;
class ProductList
protected $layout;
public function __construct(
MagentoFrameworkViewLayoutInterface $layout
)
$this->layout = $layout;
public function aroundGetProductDetailsHtml(
MagentoCatalogBlockProductListProduct $subject,
Closure $proceed,
MagentoCatalogModelProduct $product
)
return $this->layout->createBlock('VendorModueleBlockYourBlock')->setProduct($product)->setTemplate('Vendor_Module::yourPhtml.phtml')->toHtml();
UPDATE :
For display in catalog search also you need to create
<virtualType name="MagentoCatalogSearchBlockSearchResultListProduct">
<plugin name="block-product-list" type="VendorModulePluginProductList" />
</virtualType>
Clean cache and refresh page.
Thanks. I can see the text under each product, but can you share how to call a phtml file to show a form (for add to cart)
– Antony
Jul 12 at 9:02
Please check my updated code and let me know if still not working.
– Rohan Hapani
Jul 12 at 9:13
@Antony It's working now?
– Rohan Hapani
Jul 12 at 9:23
checking will update you. thanks again.
– Antony
Jul 12 at 9:49
1
using this I can able to get $block->getProduct()->getId();
– Antony
Jul 12 at 14:59
|
show 8 more comments
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f281838%2fmagento-2-3-add-custom-block-under-each-product-in-category-page%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Create di.xml file at /app/code/Vendor/Module/etc/frontend/di.xml
:
<type name="MagentoCatalogBlockProductListProduct">
<plugin name="block-product-list" type="VenderModulePluginProductList"/>
</type>
Create Plugin file ProductList.php at /app/code/Vendor/Module/Plugin
:
<?php
namespace VenderModulePlugin;
class ProductList
protected $layout;
public function __construct(
MagentoFrameworkViewLayoutInterface $layout
)
$this->layout = $layout;
public function aroundGetProductDetailsHtml(
MagentoCatalogBlockProductListProduct $subject,
Closure $proceed,
MagentoCatalogModelProduct $product
)
return $this->layout->createBlock('VendorModueleBlockYourBlock')->setProduct($product)->setTemplate('Vendor_Module::yourPhtml.phtml')->toHtml();
UPDATE :
For display in catalog search also you need to create
<virtualType name="MagentoCatalogSearchBlockSearchResultListProduct">
<plugin name="block-product-list" type="VendorModulePluginProductList" />
</virtualType>
Clean cache and refresh page.
Thanks. I can see the text under each product, but can you share how to call a phtml file to show a form (for add to cart)
– Antony
Jul 12 at 9:02
Please check my updated code and let me know if still not working.
– Rohan Hapani
Jul 12 at 9:13
@Antony It's working now?
– Rohan Hapani
Jul 12 at 9:23
checking will update you. thanks again.
– Antony
Jul 12 at 9:49
1
using this I can able to get $block->getProduct()->getId();
– Antony
Jul 12 at 14:59
|
show 8 more comments
Create di.xml file at /app/code/Vendor/Module/etc/frontend/di.xml
:
<type name="MagentoCatalogBlockProductListProduct">
<plugin name="block-product-list" type="VenderModulePluginProductList"/>
</type>
Create Plugin file ProductList.php at /app/code/Vendor/Module/Plugin
:
<?php
namespace VenderModulePlugin;
class ProductList
protected $layout;
public function __construct(
MagentoFrameworkViewLayoutInterface $layout
)
$this->layout = $layout;
public function aroundGetProductDetailsHtml(
MagentoCatalogBlockProductListProduct $subject,
Closure $proceed,
MagentoCatalogModelProduct $product
)
return $this->layout->createBlock('VendorModueleBlockYourBlock')->setProduct($product)->setTemplate('Vendor_Module::yourPhtml.phtml')->toHtml();
UPDATE :
For display in catalog search also you need to create
<virtualType name="MagentoCatalogSearchBlockSearchResultListProduct">
<plugin name="block-product-list" type="VendorModulePluginProductList" />
</virtualType>
Clean cache and refresh page.
Thanks. I can see the text under each product, but can you share how to call a phtml file to show a form (for add to cart)
– Antony
Jul 12 at 9:02
Please check my updated code and let me know if still not working.
– Rohan Hapani
Jul 12 at 9:13
@Antony It's working now?
– Rohan Hapani
Jul 12 at 9:23
checking will update you. thanks again.
– Antony
Jul 12 at 9:49
1
using this I can able to get $block->getProduct()->getId();
– Antony
Jul 12 at 14:59
|
show 8 more comments
Create di.xml file at /app/code/Vendor/Module/etc/frontend/di.xml
:
<type name="MagentoCatalogBlockProductListProduct">
<plugin name="block-product-list" type="VenderModulePluginProductList"/>
</type>
Create Plugin file ProductList.php at /app/code/Vendor/Module/Plugin
:
<?php
namespace VenderModulePlugin;
class ProductList
protected $layout;
public function __construct(
MagentoFrameworkViewLayoutInterface $layout
)
$this->layout = $layout;
public function aroundGetProductDetailsHtml(
MagentoCatalogBlockProductListProduct $subject,
Closure $proceed,
MagentoCatalogModelProduct $product
)
return $this->layout->createBlock('VendorModueleBlockYourBlock')->setProduct($product)->setTemplate('Vendor_Module::yourPhtml.phtml')->toHtml();
UPDATE :
For display in catalog search also you need to create
<virtualType name="MagentoCatalogSearchBlockSearchResultListProduct">
<plugin name="block-product-list" type="VendorModulePluginProductList" />
</virtualType>
Clean cache and refresh page.
Create di.xml file at /app/code/Vendor/Module/etc/frontend/di.xml
:
<type name="MagentoCatalogBlockProductListProduct">
<plugin name="block-product-list" type="VenderModulePluginProductList"/>
</type>
Create Plugin file ProductList.php at /app/code/Vendor/Module/Plugin
:
<?php
namespace VenderModulePlugin;
class ProductList
protected $layout;
public function __construct(
MagentoFrameworkViewLayoutInterface $layout
)
$this->layout = $layout;
public function aroundGetProductDetailsHtml(
MagentoCatalogBlockProductListProduct $subject,
Closure $proceed,
MagentoCatalogModelProduct $product
)
return $this->layout->createBlock('VendorModueleBlockYourBlock')->setProduct($product)->setTemplate('Vendor_Module::yourPhtml.phtml')->toHtml();
UPDATE :
For display in catalog search also you need to create
<virtualType name="MagentoCatalogSearchBlockSearchResultListProduct">
<plugin name="block-product-list" type="VendorModulePluginProductList" />
</virtualType>
Clean cache and refresh page.
edited Jul 12 at 9:13
answered Jul 12 at 8:35
Rohan HapaniRohan Hapani
7,9314 gold badges21 silver badges65 bronze badges
7,9314 gold badges21 silver badges65 bronze badges
Thanks. I can see the text under each product, but can you share how to call a phtml file to show a form (for add to cart)
– Antony
Jul 12 at 9:02
Please check my updated code and let me know if still not working.
– Rohan Hapani
Jul 12 at 9:13
@Antony It's working now?
– Rohan Hapani
Jul 12 at 9:23
checking will update you. thanks again.
– Antony
Jul 12 at 9:49
1
using this I can able to get $block->getProduct()->getId();
– Antony
Jul 12 at 14:59
|
show 8 more comments
Thanks. I can see the text under each product, but can you share how to call a phtml file to show a form (for add to cart)
– Antony
Jul 12 at 9:02
Please check my updated code and let me know if still not working.
– Rohan Hapani
Jul 12 at 9:13
@Antony It's working now?
– Rohan Hapani
Jul 12 at 9:23
checking will update you. thanks again.
– Antony
Jul 12 at 9:49
1
using this I can able to get $block->getProduct()->getId();
– Antony
Jul 12 at 14:59
Thanks. I can see the text under each product, but can you share how to call a phtml file to show a form (for add to cart)
– Antony
Jul 12 at 9:02
Thanks. I can see the text under each product, but can you share how to call a phtml file to show a form (for add to cart)
– Antony
Jul 12 at 9:02
Please check my updated code and let me know if still not working.
– Rohan Hapani
Jul 12 at 9:13
Please check my updated code and let me know if still not working.
– Rohan Hapani
Jul 12 at 9:13
@Antony It's working now?
– Rohan Hapani
Jul 12 at 9:23
@Antony It's working now?
– Rohan Hapani
Jul 12 at 9:23
checking will update you. thanks again.
– Antony
Jul 12 at 9:49
checking will update you. thanks again.
– Antony
Jul 12 at 9:49
1
1
using this I can able to get $block->getProduct()->getId();
– Antony
Jul 12 at 14:59
using this I can able to get $block->getProduct()->getId();
– Antony
Jul 12 at 14:59
|
show 8 more comments
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f281838%2fmagento-2-3-add-custom-block-under-each-product-in-category-page%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What is purpose of this block class.You have to call your block at Custom_ModuleName::list.phtml inside for each loop
– Amit Bera♦
Jul 12 at 8:11
Hi Amit, the purpose is I have to show grid-based form to fill quantity. How to call by block in third party extension? please share some code if possible
– Antony
Jul 12 at 8:33
Please check my last update also.
– Rohan Hapani
Jul 12 at 8:41
Hi Rohan, Thank you. Let me try and update you. Can I able to call a phtml file in that method? As I have to show a form to add to cart.
– Antony
Jul 12 at 8:45
Yes. You can do anything in this function.
– Rohan Hapani
Jul 12 at 9:00