Display Widget in phtml file magento 2Magento 2: Call a Widget in .phtml fileHow to call widget with products of specific category in “.phtml” file?Magento 2: Call a Widget in .phtml fileMagento2 Recently viewed widget not workingRecently viewed widget display nothing - Magento 2.0.8Magento 2: Display Product ImageHow to call widget with products of specific category in “.phtml” file?Magento 2 Widget Condition on edit not displayMagento 2 - Best approach to display and customize Recently Viewed Products with sliderCustomizing the insert widget type 'Catalog Products List' templateHow can i edit recently viewed products widget layout?Own recently viewed widget (magento 2)
How to reduce predictors the right way for a logistic regression model
How do I Interface a PS/2 Keyboard without Modern Techniques?
Does the Crossbow Expert feat's extra crossbow attack work with the reaction attack from a Hunter ranger's Giant Killer feature?
Why the "ls" command is showing the permissions of files in a FAT32 partition?
Why Shazam when there is already Superman?
Why can't the Brexit deadlock in the UK parliament be solved with a plurality vote?
Check if object is null and return null
How to preserve electronics (computers, iPads and phones) for hundreds of years
How would a solely written language work mechanically
What is the meaning of "You've never met a graph you didn't like?"
How to leave product feedback on macOS?
Visualizing the difference curve in a 2D plot?
What should be the ideal length of sentences in a blog post for ease of reading?
What's the name of the logical fallacy where a debater extends a statement far beyond the original statement to make it true?
I'm just a whisper. Who am I?
Echo with obfuscation
What is the meaning of the following sentence?
Make a Bowl of Alphabet Soup
Anime with legendary swords made from talismans and a man who could change them with a shattered body
Does Doodling or Improvising on the Piano Have Any Benefits?
Showing mass murder in a kid's book
Can I cause damage to electrical appliances by unplugging them when they are turned on?
Why didn’t Eve recognize the little cockroach as a living organism?
Why is participating in the European Parliamentary elections used as a threat?
Display Widget in phtml file magento 2
Magento 2: Call a Widget in .phtml fileHow to call widget with products of specific category in “.phtml” file?Magento 2: Call a Widget in .phtml fileMagento2 Recently viewed widget not workingRecently viewed widget display nothing - Magento 2.0.8Magento 2: Display Product ImageHow to call widget with products of specific category in “.phtml” file?Magento 2 Widget Condition on edit not displayMagento 2 - Best approach to display and customize Recently Viewed Products with sliderCustomizing the insert widget type 'Catalog Products List' templateHow can i edit recently viewed products widget layout?Own recently viewed widget (magento 2)
I have Following widget and its working in cms page but now I want it to display in phtml file
widget type="MagentoCatalogBlockWidgetRecentlyViewed" uiComponent="widget_recently_viewed" page_size="10" show_attributes="name,image,price,learn_more" show_buttons="add_to_cart,add_to_compare,add_to_wishlist" template="product/widget/viewed/grid.phtml" type_name="Recently Viewed Products"
magento2 magento-2.1 product magento2.3 widgets
add a comment |
I have Following widget and its working in cms page but now I want it to display in phtml file
widget type="MagentoCatalogBlockWidgetRecentlyViewed" uiComponent="widget_recently_viewed" page_size="10" show_attributes="name,image,price,learn_more" show_buttons="add_to_cart,add_to_compare,add_to_wishlist" template="product/widget/viewed/grid.phtml" type_name="Recently Viewed Products"
magento2 magento-2.1 product magento2.3 widgets
magento.stackexchange.com/questions/107750/… Try this @HarshJayswal
– Prathap Gunasekaran
yesterday
@PrathapGunasekaran have already tried but it shows an error if you know how to set my widget according to that answer than please post the answer
– Harsh Jayswal
yesterday
add a comment |
I have Following widget and its working in cms page but now I want it to display in phtml file
widget type="MagentoCatalogBlockWidgetRecentlyViewed" uiComponent="widget_recently_viewed" page_size="10" show_attributes="name,image,price,learn_more" show_buttons="add_to_cart,add_to_compare,add_to_wishlist" template="product/widget/viewed/grid.phtml" type_name="Recently Viewed Products"
magento2 magento-2.1 product magento2.3 widgets
I have Following widget and its working in cms page but now I want it to display in phtml file
widget type="MagentoCatalogBlockWidgetRecentlyViewed" uiComponent="widget_recently_viewed" page_size="10" show_attributes="name,image,price,learn_more" show_buttons="add_to_cart,add_to_compare,add_to_wishlist" template="product/widget/viewed/grid.phtml" type_name="Recently Viewed Products"
magento2 magento-2.1 product magento2.3 widgets
magento2 magento-2.1 product magento2.3 widgets
asked yesterday
Harsh JayswalHarsh Jayswal
799
799
magento.stackexchange.com/questions/107750/… Try this @HarshJayswal
– Prathap Gunasekaran
yesterday
@PrathapGunasekaran have already tried but it shows an error if you know how to set my widget according to that answer than please post the answer
– Harsh Jayswal
yesterday
add a comment |
magento.stackexchange.com/questions/107750/… Try this @HarshJayswal
– Prathap Gunasekaran
yesterday
@PrathapGunasekaran have already tried but it shows an error if you know how to set my widget according to that answer than please post the answer
– Harsh Jayswal
yesterday
magento.stackexchange.com/questions/107750/… Try this @HarshJayswal
– Prathap Gunasekaran
yesterday
magento.stackexchange.com/questions/107750/… Try this @HarshJayswal
– Prathap Gunasekaran
yesterday
@PrathapGunasekaran have already tried but it shows an error if you know how to set my widget according to that answer than please post the answer
– Harsh Jayswal
yesterday
@PrathapGunasekaran have already tried but it shows an error if you know how to set my widget according to that answer than please post the answer
– Harsh Jayswal
yesterday
add a comment |
3 Answers
3
active
oldest
votes
Try with below way.
$recViewBlock = $this->getLayout()->createBlock(MagentoCatalogBlockWidgetRecentlyViewed::class);
$recViewBlock->setTitle("Recently Viewed Products");
$recViewBlock->setProductsCount(10);
$recViewBlock->setTemplate("product/widget/viewed/grid.phtml");
$recViewBlock->setDisplayType("recently.view.products");
$recViewBlock->setShowAttribute(add_to_cart,add_to_compare,add_to_wishlist);
echo $recViewBlock->toHtml();
Note : Above code is not tested you have to check. For more detail click here
I hope it helps!
thanks for your answer but is shows error
– Harsh Jayswal
17 hours ago
add a comment |
phtml file :-
<?php echo $this->getLayout()->createBlock("MagentoCatalogBlockWidgetRecentlyViewed")->setDisplayType("widget_recently_viewed")->setProductsCount("5")->setTemplate("product/widget/viewed/grid.phtml")->toHtml(); ?>
add a comment |
Try this :
echo $this->getLayout()->createBlock("MagentoCatalogBlockWidgetRecentlyViewed")->setDisplayType("your_display_type")->toHtml();
add a comment |
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%2f266598%2fdisplay-widget-in-phtml-file-magento-2%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try with below way.
$recViewBlock = $this->getLayout()->createBlock(MagentoCatalogBlockWidgetRecentlyViewed::class);
$recViewBlock->setTitle("Recently Viewed Products");
$recViewBlock->setProductsCount(10);
$recViewBlock->setTemplate("product/widget/viewed/grid.phtml");
$recViewBlock->setDisplayType("recently.view.products");
$recViewBlock->setShowAttribute(add_to_cart,add_to_compare,add_to_wishlist);
echo $recViewBlock->toHtml();
Note : Above code is not tested you have to check. For more detail click here
I hope it helps!
thanks for your answer but is shows error
– Harsh Jayswal
17 hours ago
add a comment |
Try with below way.
$recViewBlock = $this->getLayout()->createBlock(MagentoCatalogBlockWidgetRecentlyViewed::class);
$recViewBlock->setTitle("Recently Viewed Products");
$recViewBlock->setProductsCount(10);
$recViewBlock->setTemplate("product/widget/viewed/grid.phtml");
$recViewBlock->setDisplayType("recently.view.products");
$recViewBlock->setShowAttribute(add_to_cart,add_to_compare,add_to_wishlist);
echo $recViewBlock->toHtml();
Note : Above code is not tested you have to check. For more detail click here
I hope it helps!
thanks for your answer but is shows error
– Harsh Jayswal
17 hours ago
add a comment |
Try with below way.
$recViewBlock = $this->getLayout()->createBlock(MagentoCatalogBlockWidgetRecentlyViewed::class);
$recViewBlock->setTitle("Recently Viewed Products");
$recViewBlock->setProductsCount(10);
$recViewBlock->setTemplate("product/widget/viewed/grid.phtml");
$recViewBlock->setDisplayType("recently.view.products");
$recViewBlock->setShowAttribute(add_to_cart,add_to_compare,add_to_wishlist);
echo $recViewBlock->toHtml();
Note : Above code is not tested you have to check. For more detail click here
I hope it helps!
Try with below way.
$recViewBlock = $this->getLayout()->createBlock(MagentoCatalogBlockWidgetRecentlyViewed::class);
$recViewBlock->setTitle("Recently Viewed Products");
$recViewBlock->setProductsCount(10);
$recViewBlock->setTemplate("product/widget/viewed/grid.phtml");
$recViewBlock->setDisplayType("recently.view.products");
$recViewBlock->setShowAttribute(add_to_cart,add_to_compare,add_to_wishlist);
echo $recViewBlock->toHtml();
Note : Above code is not tested you have to check. For more detail click here
I hope it helps!
answered 20 hours ago
Chirag PatelChirag Patel
2,368423
2,368423
thanks for your answer but is shows error
– Harsh Jayswal
17 hours ago
add a comment |
thanks for your answer but is shows error
– Harsh Jayswal
17 hours ago
thanks for your answer but is shows error
– Harsh Jayswal
17 hours ago
thanks for your answer but is shows error
– Harsh Jayswal
17 hours ago
add a comment |
phtml file :-
<?php echo $this->getLayout()->createBlock("MagentoCatalogBlockWidgetRecentlyViewed")->setDisplayType("widget_recently_viewed")->setProductsCount("5")->setTemplate("product/widget/viewed/grid.phtml")->toHtml(); ?>
add a comment |
phtml file :-
<?php echo $this->getLayout()->createBlock("MagentoCatalogBlockWidgetRecentlyViewed")->setDisplayType("widget_recently_viewed")->setProductsCount("5")->setTemplate("product/widget/viewed/grid.phtml")->toHtml(); ?>
add a comment |
phtml file :-
<?php echo $this->getLayout()->createBlock("MagentoCatalogBlockWidgetRecentlyViewed")->setDisplayType("widget_recently_viewed")->setProductsCount("5")->setTemplate("product/widget/viewed/grid.phtml")->toHtml(); ?>
phtml file :-
<?php echo $this->getLayout()->createBlock("MagentoCatalogBlockWidgetRecentlyViewed")->setDisplayType("widget_recently_viewed")->setProductsCount("5")->setTemplate("product/widget/viewed/grid.phtml")->toHtml(); ?>
answered yesterday
Ronak RathodRonak Rathod
54610
54610
add a comment |
add a comment |
Try this :
echo $this->getLayout()->createBlock("MagentoCatalogBlockWidgetRecentlyViewed")->setDisplayType("your_display_type")->toHtml();
add a comment |
Try this :
echo $this->getLayout()->createBlock("MagentoCatalogBlockWidgetRecentlyViewed")->setDisplayType("your_display_type")->toHtml();
add a comment |
Try this :
echo $this->getLayout()->createBlock("MagentoCatalogBlockWidgetRecentlyViewed")->setDisplayType("your_display_type")->toHtml();
Try this :
echo $this->getLayout()->createBlock("MagentoCatalogBlockWidgetRecentlyViewed")->setDisplayType("your_display_type")->toHtml();
answered yesterday
rohan.katkarrohan.katkar
1429
1429
add a comment |
add a comment |
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%2f266598%2fdisplay-widget-in-phtml-file-magento-2%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
magento.stackexchange.com/questions/107750/… Try this @HarshJayswal
– Prathap Gunasekaran
yesterday
@PrathapGunasekaran have already tried but it shows an error if you know how to set my widget according to that answer than please post the answer
– Harsh Jayswal
yesterday