Magento 2: How is it possible to call a static block in category description? The 2019 Stack Overflow Developer Survey Results Are In Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar ManaraCms page (or static block) inside product descriptionpassing variables to static blocks for dynamic useCaching saves not the contextHow to call the attribute inside the static block?how to disable cache for particular Static Block in magento 1.9How to allow static blocks in product description?CMS block not showing up on front endMage 2.1.1 short codes front end renderingHow do I add a CMS Static Block Text Box To All Product Listings In Magento?“Error filtering template” - no static blocks in description by graphql
Store Dynamic-accessible hidden metadata in a cell
How to determine omitted units in a publication
Do working physicists consider Newtonian mechanics to be "falsified"?
Can we generate random numbers using irrational numbers like π and e?
What can I do if neighbor is blocking my solar panels intentionally?
What does "spokes" mean in this context?
Homework question about an engine pulling a train
How to politely respond to generic emails requesting a PhD/job in my lab? Without wasting too much time
Nested ellipses in tikzpicture: Chomsky hierarchy
Are spiders unable to hurt humans, especially very small spiders?
What do I do when my TA workload is more than expected?
"... to apply for a visa" or "... and applied for a visa"?
Single author papers against my advisor's will?
What force causes entropy to increase?
How did the crowd guess the pentatonic scale in Bobby McFerrin's presentation?
Is it ok to offer lower paid work as a trial period before negotiating for a full-time job?
Mortgage adviser recommends a longer term than necessary combined with overpayments
How many cones with angle theta can I pack into the unit sphere?
Did the UK government pay "millions and millions of dollars" to try to snag Julian Assange?
One-dimensional Japanese puzzle
Simulating Exploding Dice
Variable with quotation marks "$()"
What does Linus Torvalds mean when he says that Git "never ever" tracks a file?
Why are PDP-7-style microprogrammed instructions out of vogue?
Magento 2: How is it possible to call a static block in category description?
The 2019 Stack Overflow Developer Survey Results Are In
Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar ManaraCms page (or static block) inside product descriptionpassing variables to static blocks for dynamic useCaching saves not the contextHow to call the attribute inside the static block?how to disable cache for particular Static Block in magento 1.9How to allow static blocks in product description?CMS block not showing up on front endMage 2.1.1 short codes front end renderingHow do I add a CMS Static Block Text Box To All Product Listings In Magento?“Error filtering template” - no static blocks in description by graphql
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
is it possible to call static blocks in the category description of magento 2?
I don´t want to use the "Add CMS Block" DropDown under the description field.
It is necessary to call the blocks in the description field.
I would like to call blocks like sliders: revslider alias="fullslider-en"
or product lists:
block class="InfortisBaseBlockProductProductListFeatured" template="product/list.phtml" category_id="13"
Any ideas?
Many thanks in advance
Andi
magento2 category static-block category-description
add a comment |
is it possible to call static blocks in the category description of magento 2?
I don´t want to use the "Add CMS Block" DropDown under the description field.
It is necessary to call the blocks in the description field.
I would like to call blocks like sliders: revslider alias="fullslider-en"
or product lists:
block class="InfortisBaseBlockProductProductListFeatured" template="product/list.phtml" category_id="13"
Any ideas?
Many thanks in advance
Andi
magento2 category static-block category-description
add a comment |
is it possible to call static blocks in the category description of magento 2?
I don´t want to use the "Add CMS Block" DropDown under the description field.
It is necessary to call the blocks in the description field.
I would like to call blocks like sliders: revslider alias="fullslider-en"
or product lists:
block class="InfortisBaseBlockProductProductListFeatured" template="product/list.phtml" category_id="13"
Any ideas?
Many thanks in advance
Andi
magento2 category static-block category-description
is it possible to call static blocks in the category description of magento 2?
I don´t want to use the "Add CMS Block" DropDown under the description field.
It is necessary to call the blocks in the description field.
I would like to call blocks like sliders: revslider alias="fullslider-en"
or product lists:
block class="InfortisBaseBlockProductProductListFeatured" template="product/list.phtml" category_id="13"
Any ideas?
Many thanks in advance
Andi
magento2 category static-block category-description
magento2 category static-block category-description
edited Apr 9 at 5:52
Muhammad Anas
607318
607318
asked May 9 '17 at 5:50
Andy TAndy T
61
61
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Override View.php block
vendor/magento/module-catalog/Block/Category/View.php
Add class Zend_Filter_Interface in your block to filter output to html
...
protected $templateProcess;
...
public function __construct(
...
Zend_Filter_Interface $templateProcess
...
)
...
$this->templateProcess = $templateProcess;
...
public function filterOutputHtml($string)
return $this->templateProcess->filter($string);
In your di.xml
app/code/Vendor/Module/etc/di.xml
<type name="VendorModuleBlockCategoryView">
<arguments>
<argument name="templateProcessor" xsi:type="object">MagentoWidgetModelTemplateFilter</argument>
</arguments>
</type>
Now call filterOutputHtml() to description.phtml
Override description.phtml to your theme
vendor/magento/module-catalog/view/frontend/templates/category/description.phtml
<?php
//Get category description
$_description = $block->getCurrentCategory()->getDescription();
//Convert block to html
<?php echo $block->filterOutputHtml($_description);
Uncaught Error: Cannot instantiate interface Zend_Filter_Interface
– Ketan Borada
Aug 29 '18 at 7:07
@KetanBorada You need to add di.xml. Please check my updated answer
– Prince Patel
Aug 29 '18 at 8:31
i'm still getting same error are you sure this is right? prntscr.com/ko585c
– Ketan Borada
Aug 29 '18 at 8:41
can you show by objectmanager?
– Ketan Borada
Aug 29 '18 at 8:55
add a comment |
You need to override core functionality to show widget options then you can insert static block using widget interface.
Create/Edit your di.xml and define a preference:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for='MagentoCatalogBlockAdminhtmlHelperFormWysiwygContent' type='[Vendor][Module]BlockAdminhtmlHelperFormWysiwygContentRewrite'/>
</config>
File MagentoCatalogBlockAdminhtmlHelperFormWysiwygContent
protected function _prepareForm()
/** @var MagentoFrameworkDataForm $form */
$form = $this->_formFactory->create(
[
'data' => ['id' => 'wysiwyg_edit_form', 'action' => $this->getData('action'), 'method' => 'post'],
]
);
$config['document_base_url'] = $this->getData('store_media_url');
$config['store_id'] = $this->getData('store_id');
$config['add_variables'] = false;
$config['add_widgets'] = true; // change this from false to true
$config['add_directives'] = true;
$config['use_container'] = true;
$config['container_class'] = 'hor-scroll';
$form->addField(
$this->getData('editor_element_id'),
'editor',
[
'name' => 'content',
'style' => 'width:725px;height:460px',
'required' => true,
'force_load' => true,
'config' => $this->_wysiwygConfig->getConfig($config)
]
);
$this->setForm($form);
return parent::_prepareForm();
You may also need to override the block and view file for templateProcess.
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%2f173544%2fmagento-2-how-is-it-possible-to-call-a-static-block-in-category-description%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Override View.php block
vendor/magento/module-catalog/Block/Category/View.php
Add class Zend_Filter_Interface in your block to filter output to html
...
protected $templateProcess;
...
public function __construct(
...
Zend_Filter_Interface $templateProcess
...
)
...
$this->templateProcess = $templateProcess;
...
public function filterOutputHtml($string)
return $this->templateProcess->filter($string);
In your di.xml
app/code/Vendor/Module/etc/di.xml
<type name="VendorModuleBlockCategoryView">
<arguments>
<argument name="templateProcessor" xsi:type="object">MagentoWidgetModelTemplateFilter</argument>
</arguments>
</type>
Now call filterOutputHtml() to description.phtml
Override description.phtml to your theme
vendor/magento/module-catalog/view/frontend/templates/category/description.phtml
<?php
//Get category description
$_description = $block->getCurrentCategory()->getDescription();
//Convert block to html
<?php echo $block->filterOutputHtml($_description);
Uncaught Error: Cannot instantiate interface Zend_Filter_Interface
– Ketan Borada
Aug 29 '18 at 7:07
@KetanBorada You need to add di.xml. Please check my updated answer
– Prince Patel
Aug 29 '18 at 8:31
i'm still getting same error are you sure this is right? prntscr.com/ko585c
– Ketan Borada
Aug 29 '18 at 8:41
can you show by objectmanager?
– Ketan Borada
Aug 29 '18 at 8:55
add a comment |
Override View.php block
vendor/magento/module-catalog/Block/Category/View.php
Add class Zend_Filter_Interface in your block to filter output to html
...
protected $templateProcess;
...
public function __construct(
...
Zend_Filter_Interface $templateProcess
...
)
...
$this->templateProcess = $templateProcess;
...
public function filterOutputHtml($string)
return $this->templateProcess->filter($string);
In your di.xml
app/code/Vendor/Module/etc/di.xml
<type name="VendorModuleBlockCategoryView">
<arguments>
<argument name="templateProcessor" xsi:type="object">MagentoWidgetModelTemplateFilter</argument>
</arguments>
</type>
Now call filterOutputHtml() to description.phtml
Override description.phtml to your theme
vendor/magento/module-catalog/view/frontend/templates/category/description.phtml
<?php
//Get category description
$_description = $block->getCurrentCategory()->getDescription();
//Convert block to html
<?php echo $block->filterOutputHtml($_description);
Uncaught Error: Cannot instantiate interface Zend_Filter_Interface
– Ketan Borada
Aug 29 '18 at 7:07
@KetanBorada You need to add di.xml. Please check my updated answer
– Prince Patel
Aug 29 '18 at 8:31
i'm still getting same error are you sure this is right? prntscr.com/ko585c
– Ketan Borada
Aug 29 '18 at 8:41
can you show by objectmanager?
– Ketan Borada
Aug 29 '18 at 8:55
add a comment |
Override View.php block
vendor/magento/module-catalog/Block/Category/View.php
Add class Zend_Filter_Interface in your block to filter output to html
...
protected $templateProcess;
...
public function __construct(
...
Zend_Filter_Interface $templateProcess
...
)
...
$this->templateProcess = $templateProcess;
...
public function filterOutputHtml($string)
return $this->templateProcess->filter($string);
In your di.xml
app/code/Vendor/Module/etc/di.xml
<type name="VendorModuleBlockCategoryView">
<arguments>
<argument name="templateProcessor" xsi:type="object">MagentoWidgetModelTemplateFilter</argument>
</arguments>
</type>
Now call filterOutputHtml() to description.phtml
Override description.phtml to your theme
vendor/magento/module-catalog/view/frontend/templates/category/description.phtml
<?php
//Get category description
$_description = $block->getCurrentCategory()->getDescription();
//Convert block to html
<?php echo $block->filterOutputHtml($_description);
Override View.php block
vendor/magento/module-catalog/Block/Category/View.php
Add class Zend_Filter_Interface in your block to filter output to html
...
protected $templateProcess;
...
public function __construct(
...
Zend_Filter_Interface $templateProcess
...
)
...
$this->templateProcess = $templateProcess;
...
public function filterOutputHtml($string)
return $this->templateProcess->filter($string);
In your di.xml
app/code/Vendor/Module/etc/di.xml
<type name="VendorModuleBlockCategoryView">
<arguments>
<argument name="templateProcessor" xsi:type="object">MagentoWidgetModelTemplateFilter</argument>
</arguments>
</type>
Now call filterOutputHtml() to description.phtml
Override description.phtml to your theme
vendor/magento/module-catalog/view/frontend/templates/category/description.phtml
<?php
//Get category description
$_description = $block->getCurrentCategory()->getDescription();
//Convert block to html
<?php echo $block->filterOutputHtml($_description);
edited Aug 29 '18 at 9:33
answered May 9 '17 at 6:17
Prince PatelPrince Patel
14.6k65481
14.6k65481
Uncaught Error: Cannot instantiate interface Zend_Filter_Interface
– Ketan Borada
Aug 29 '18 at 7:07
@KetanBorada You need to add di.xml. Please check my updated answer
– Prince Patel
Aug 29 '18 at 8:31
i'm still getting same error are you sure this is right? prntscr.com/ko585c
– Ketan Borada
Aug 29 '18 at 8:41
can you show by objectmanager?
– Ketan Borada
Aug 29 '18 at 8:55
add a comment |
Uncaught Error: Cannot instantiate interface Zend_Filter_Interface
– Ketan Borada
Aug 29 '18 at 7:07
@KetanBorada You need to add di.xml. Please check my updated answer
– Prince Patel
Aug 29 '18 at 8:31
i'm still getting same error are you sure this is right? prntscr.com/ko585c
– Ketan Borada
Aug 29 '18 at 8:41
can you show by objectmanager?
– Ketan Borada
Aug 29 '18 at 8:55
Uncaught Error: Cannot instantiate interface Zend_Filter_Interface
– Ketan Borada
Aug 29 '18 at 7:07
Uncaught Error: Cannot instantiate interface Zend_Filter_Interface
– Ketan Borada
Aug 29 '18 at 7:07
@KetanBorada You need to add di.xml. Please check my updated answer
– Prince Patel
Aug 29 '18 at 8:31
@KetanBorada You need to add di.xml. Please check my updated answer
– Prince Patel
Aug 29 '18 at 8:31
i'm still getting same error are you sure this is right? prntscr.com/ko585c
– Ketan Borada
Aug 29 '18 at 8:41
i'm still getting same error are you sure this is right? prntscr.com/ko585c
– Ketan Borada
Aug 29 '18 at 8:41
can you show by objectmanager?
– Ketan Borada
Aug 29 '18 at 8:55
can you show by objectmanager?
– Ketan Borada
Aug 29 '18 at 8:55
add a comment |
You need to override core functionality to show widget options then you can insert static block using widget interface.
Create/Edit your di.xml and define a preference:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for='MagentoCatalogBlockAdminhtmlHelperFormWysiwygContent' type='[Vendor][Module]BlockAdminhtmlHelperFormWysiwygContentRewrite'/>
</config>
File MagentoCatalogBlockAdminhtmlHelperFormWysiwygContent
protected function _prepareForm()
/** @var MagentoFrameworkDataForm $form */
$form = $this->_formFactory->create(
[
'data' => ['id' => 'wysiwyg_edit_form', 'action' => $this->getData('action'), 'method' => 'post'],
]
);
$config['document_base_url'] = $this->getData('store_media_url');
$config['store_id'] = $this->getData('store_id');
$config['add_variables'] = false;
$config['add_widgets'] = true; // change this from false to true
$config['add_directives'] = true;
$config['use_container'] = true;
$config['container_class'] = 'hor-scroll';
$form->addField(
$this->getData('editor_element_id'),
'editor',
[
'name' => 'content',
'style' => 'width:725px;height:460px',
'required' => true,
'force_load' => true,
'config' => $this->_wysiwygConfig->getConfig($config)
]
);
$this->setForm($form);
return parent::_prepareForm();
You may also need to override the block and view file for templateProcess.
add a comment |
You need to override core functionality to show widget options then you can insert static block using widget interface.
Create/Edit your di.xml and define a preference:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for='MagentoCatalogBlockAdminhtmlHelperFormWysiwygContent' type='[Vendor][Module]BlockAdminhtmlHelperFormWysiwygContentRewrite'/>
</config>
File MagentoCatalogBlockAdminhtmlHelperFormWysiwygContent
protected function _prepareForm()
/** @var MagentoFrameworkDataForm $form */
$form = $this->_formFactory->create(
[
'data' => ['id' => 'wysiwyg_edit_form', 'action' => $this->getData('action'), 'method' => 'post'],
]
);
$config['document_base_url'] = $this->getData('store_media_url');
$config['store_id'] = $this->getData('store_id');
$config['add_variables'] = false;
$config['add_widgets'] = true; // change this from false to true
$config['add_directives'] = true;
$config['use_container'] = true;
$config['container_class'] = 'hor-scroll';
$form->addField(
$this->getData('editor_element_id'),
'editor',
[
'name' => 'content',
'style' => 'width:725px;height:460px',
'required' => true,
'force_load' => true,
'config' => $this->_wysiwygConfig->getConfig($config)
]
);
$this->setForm($form);
return parent::_prepareForm();
You may also need to override the block and view file for templateProcess.
add a comment |
You need to override core functionality to show widget options then you can insert static block using widget interface.
Create/Edit your di.xml and define a preference:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for='MagentoCatalogBlockAdminhtmlHelperFormWysiwygContent' type='[Vendor][Module]BlockAdminhtmlHelperFormWysiwygContentRewrite'/>
</config>
File MagentoCatalogBlockAdminhtmlHelperFormWysiwygContent
protected function _prepareForm()
/** @var MagentoFrameworkDataForm $form */
$form = $this->_formFactory->create(
[
'data' => ['id' => 'wysiwyg_edit_form', 'action' => $this->getData('action'), 'method' => 'post'],
]
);
$config['document_base_url'] = $this->getData('store_media_url');
$config['store_id'] = $this->getData('store_id');
$config['add_variables'] = false;
$config['add_widgets'] = true; // change this from false to true
$config['add_directives'] = true;
$config['use_container'] = true;
$config['container_class'] = 'hor-scroll';
$form->addField(
$this->getData('editor_element_id'),
'editor',
[
'name' => 'content',
'style' => 'width:725px;height:460px',
'required' => true,
'force_load' => true,
'config' => $this->_wysiwygConfig->getConfig($config)
]
);
$this->setForm($form);
return parent::_prepareForm();
You may also need to override the block and view file for templateProcess.
You need to override core functionality to show widget options then you can insert static block using widget interface.
Create/Edit your di.xml and define a preference:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for='MagentoCatalogBlockAdminhtmlHelperFormWysiwygContent' type='[Vendor][Module]BlockAdminhtmlHelperFormWysiwygContentRewrite'/>
</config>
File MagentoCatalogBlockAdminhtmlHelperFormWysiwygContent
protected function _prepareForm()
/** @var MagentoFrameworkDataForm $form */
$form = $this->_formFactory->create(
[
'data' => ['id' => 'wysiwyg_edit_form', 'action' => $this->getData('action'), 'method' => 'post'],
]
);
$config['document_base_url'] = $this->getData('store_media_url');
$config['store_id'] = $this->getData('store_id');
$config['add_variables'] = false;
$config['add_widgets'] = true; // change this from false to true
$config['add_directives'] = true;
$config['use_container'] = true;
$config['container_class'] = 'hor-scroll';
$form->addField(
$this->getData('editor_element_id'),
'editor',
[
'name' => 'content',
'style' => 'width:725px;height:460px',
'required' => true,
'force_load' => true,
'config' => $this->_wysiwygConfig->getConfig($config)
]
);
$this->setForm($form);
return parent::_prepareForm();
You may also need to override the block and view file for templateProcess.
answered May 9 '17 at 6:28
PriyankPriyank
5,37542253
5,37542253
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%2f173544%2fmagento-2-how-is-it-possible-to-call-a-static-block-in-category-description%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