20
votes
Magento 2 - How to create FAQ page with accordion
It is possible. If you want to use
data-mage-init
Then you do it like this:
<div id="element" data-mage-init='{"accordion":{"openedState": "active", "collapsible": true, "active": false, "...
14
votes
Magento2: How to override widget template
you can extend the widget in your module.
To do that your module has to depend on the module where the original widget is defined (see sequence in the module.xml).
Then you create a widget.xml in ...
14
votes
Accepted
Magento 2: Call a Widget in a .phtml file
For Display Type = All Product Widget
{{widget type="Magento\Catalog\Block\Product\Widget\NewWidget"
display_type="all_products" products_count="5" template="product/widget/new/content/new_grid....
11
votes
Accepted
Magento 2 Modal Widget
Try following way.
<script>
require(
[
'jquery',
'Magento_Ui/js/modal/modal'
],
function(
$,
modal
) {
...
10
votes
Accepted
Magento 2: How to put default value in yes/no field of widget.xml in magento 2?
If default values are not working for YesNo (I don't have time to dig) then you could always cheese the system for the time being and try to find a cleaner solution:
<parameter name="chart_layout"...
8
votes
Magento2: How to override widget template
You can replace the grid.phtml where you call the widget
{{widget type="Magento\CatalogWidget\Block\Product\ProductsList" title="Our Products" products_count="8" template="Namespace_Modulename::...
7
votes
Accepted
Component vs Widget
The widget can be initialized with a few lines of JS, where as the component requires many lines of XML and still uses the widget. So why would anyone use the XML method?
The UI component system ...
7
votes
Accepted
How to call widget with products of specific category in ".phtml" file?
There is a widget for arbitrary product lists (as mentioned by @Nits). If you insert the widget on any CMS page or block and turn off the WYSIWYG editor ("Hide editor" button), you can see how the ...
7
votes
How to remove ‘Add New’ button from Admin Grid in Magento 1.9?
Renate, if you are following the tutorial, then you'll need to add the code suggested by Rama to this section
<?php
class Foo_Bar_Block_Adminhtml_Baz extends ...
6
votes
How to call widget with products of specific category in ".phtml" file?
You can do it via static-block:
1) add static block with widget of catalog product list and add category id in widget condition.
(content menu >> Blocks >> add new >> click on show/hid button >> ...
6
votes
Add javascript in custom widget
Create requirejs-config
var config = {
map: {
'*': {
yourWidgetName: 'NameSpace_ModuleName/js/yourwidgetfile',
}
},
};
Define you widget following convention
...
5
votes
Why does the 'Container Widget Header' appear twice in my grid in my ajax grid?
The problem was caused by the string used in one of the createBlock() calls.
To wit, Magento grids consist of a Grid Container class, and a Grid class, which both live in the Block directory of a ...
5
votes
Accepted
How to use tabs widget in magento2
You have error on the page because you miss your tabs widget in dependencies list (at list if you want to use Magento's tabs widget).
Correct:
require([
'jquery',
'mage/tabs'
], function($){
...
5
votes
How to remove ‘Add New’ button from Admin Grid in Magento 1.9?
Try like this
TBF_Cupom_Block_Adminhtml_Gerados_Index extends Mage_Adminhtml_Block_Widget_Form_Container {
public function __construct()
{
.....
$this->_removeButton('add');
}
}
Note: ...
5
votes
Accepted
How to pass a variable to a JS widget in Magento 2
You can get the values passed from phtml to widget in any function using below code,
this.options.ajaxShipmentUrl
4
votes
Accepted
How can I customize the widget on the homepage on Magento2 Luma theme?
Luma theme homepage content comes from widget.
First of All, go to Admin panel,
Content -> Widgets
Now click on Home Page widget.
You can check it using widget option tab,
You have display Block ...
4
votes
Magento 2 - How to create FAQ page with accordion
This works for me :
<div data-mage-init='{"accordion":{"openedState": "active", "collapsible": true, "active": false, "multipleCollapsible": false}}'>
<div data-role="collapsible">
...
4
votes
Newest Product Widget Not Showing Correct Products
Date also plays an important role. While inserting the product details.
You give recent date and you paste this code in the home page By going to cms and manage pages of Magento admin panel.
I am ...
4
votes
Accepted
Default values of a multiselect input in widget options using widget.xml
If I remember correctly multiselect values are stored comma separated. Have you tried <value>opt1,opt2</value> ?
4
votes
Accepted
Can we make Widget Options validaton in magento?
Take a look at how Magento defined a helper block in the Mage_Catalog module. In their widget.xml they define the helper block:
<helper_block>
<type>adminhtml/...
4
votes
Accepted
Magento2 Add to Cart from homepage not working
The solution (for no clarified reason) was to enable all Magento caching options. This solved the issue for me.
Tested this again in a new install: Fresh Luma templated with new product widget on the ...
4
votes
Accepted
How to render widgets in product and category description in Magento 2?
Instead of instantiating the object manager and filterprovider etc. in your template, consider this:
In your block class (Vendor\Module\Block\Widget\CustomWidget) include the dependencies in your ...
4
votes
Accepted
Magento 2 : </depends> is Not Working in Widget.xml
The problem is that the JS that handles the show/hide functionality of dependency elements doesn't find anything in the case of xsi:type="block" fields.
One way to get around this is to override the ...
4
votes
Magent2 Modal Widget - change width and height
You can use 'modalClass' option to set a custom css class to your modal popup und define width in the css:
.my-custom-class .modal-inner-wrap {
width: 600px;
}
4
votes
Accepted
Magento 2: insert a "Bestsellers" widget via the Magento admin
I have created something similar using following code.
app/code/Anshu/Bestsellerwidget/registration.php
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\...
4
votes
Accepted
Magento 2 decode widget code in category description
you need to pass the content of the description inside a function before the display. This filterProvider will replace the widget code inside the content of the description.
public function ...
4
votes
Accepted
Magento 2: add magento widget button on product WYSIWYG editors
Here’s an example on how to do it for the Description field. You can use it for other WYSIWYG fields in the product edit page (just modify the condition for the IF in step number 2 and add the filter ...
3
votes
Calling a template from within a widget
In the widget.xml you define with the typeattribute the block class of the widget. For example type="catalog/category_widget_link"refers to the block class Mage_Catalog_Block_Category_Widget_Link. It'...
3
votes
Magento 2 - How to create FAQ page with accordion
I think you are having an issue with data-mage-init when saving or edit the content of the CMS page back.
You can use accordion in CMS page by adding accordion js to your custom theme.
Add accordion ...
3
votes
Magento2: How to override widget template
Create a custom theme and copy the .phtml file to it, and make your changes.
app/design/frontend/<package>/<theme>/Magento_Catalog_Wiget/templates/product/widget/content/grid.phtml
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
widget × 275magento2 × 160
magento-1.9 × 27
widgets × 26
blocks × 21
product × 18
javascript × 14
jquery × 14
category × 13
cms × 13
widget-instance × 11
template × 10
php × 9
layout × 9
magento-2.1 × 8
xml × 8
static-block × 8
wysiwyg × 8
new-products × 8
magento2.3 × 7
admin × 7
frontend × 7
uicomponent × 7
product-list × 7
custom × 6