Sylius grid add button to product table - sylius

How can I override product table grid to add new button next to edit and delete?
I have found: vendor\sylius\sylius\src\Sylius\Bundle\AdminBundle\Resources\config\grids\product.yml
The button should open modal button with html content. Thanks,

You have two options here.
You could either include a config file for grid which will look more or less like this:
# app/config/grids.yml
sylius_grid:
grids:
sylius_admin_product:
actions:
# your new action here
or copy entire yaml file you've found in
vendor\sylius\sylius\src\Sylius\Bundle\AdminBundle\Resources\config\grids\product.yml
into your app/Resources folder:
app/Resources/SyliusAdminBundle/config/grids/product.yml
and override what you want :)
More info can be found here: http://docs.sylius.org/en/latest/customization/grid.html

There is an example here:
Custom template and How to register and How to use
You can register this action in any place where you define grids. It's not necessary
sylius_grid:
templates:
filter:
your_filter_name: #YourBundle/Path/After/Resource/_filter_name.html.twig
action:
# the same defining
bulk_action:
# the same defining

Related

Vue Storefront: Display labels for custom attribute filter instead of option id

I am trying to figure out from couple of days how to display label for filters on category page. As mentioned in document I have added attribute inside config.products.defaultFilters[] and the filter have started showing there.
I have color and brand filters. For color filters I have mapped color id to color name in config.products.colorMappings so it is displaying correctly there. But for brand I can do the same but it is a static solution so every time admin adds new brand I will need to add its mapping and build the storefront again.
I have tried to check their forum but nothing useful. I checked Vue Storefront vuex catalog and category-next stores for hint but cannot find anything related there.
The label for option under brand_filter should be readable but it is showing that brand attribute option's id
Ok, after spending couple of days finding solution to this problem, I finally got a hint from this answer.
I am using theme vsf-capybara, and according to its guide, to setup I generated a local.json from generate-local-config.js and I merged configuration manually from that local.json to config/local.json file. Prior to this there was no filter named brand or color added already to the main config file.
The config property responsible for the filter labels to be incorrect was entities.attribute.loadByAttributeMetadata and it was set to true I changed it to false because core/module/catalog/CatalogModule has one action attribute/list needs to be dispatched for application use. So if entities.attribute.loadByAttributeMetadata in config/local.json is set to true, this action will not be dispatched. Here is the excerpt from CatalogModule:
if (!config.entities.attribute.loadByAttributeMetadata) {
await store.dispatch('attribute/list', { // loading attributes for application use
filterValues: uniq([...config.products.defaultFilters, ...config.entities.productListWithChildren.includeFields])
})
}

Drupal 7 - Print PDF and Panelizer

Hi guys ,
I'm currently working on a Drupal project which use the Panelizer module by overriding the default node display. The panel for this content type is made width a lot of rules and specifications in order to display some specific content (like views) according some fields.
Now I need to print in PDF the same content that is displayed by the panelizer module but in another display (in one column ), so I cloned the display I use and rearranged it to display what I want.Then I want to use this display width the print module but I didn't managed to do that.
Any idea how can I do that ?
I just can't use the default node render, because I would miss some informations dues to the specifications used in the panel, and I can't print the panelized content because it's not the same display.
I read this thread but how can I say to the print module to use the "print" display I cloned instead of the default one ?
Any suggestions or ideas will be appreciated or if you have another idea for doing that you're welcome :)
Thank you !
In your print pdf template you can load the node then create a view with the display and finally render it : drupal_render(node_view(node_load($node->nid), "name of your display")) ;
Another way is to alter node entity info, telling that 'print' view can be panelized, i.e.
/**
* Implements hook_entity_info_alter().
*/
function mymodule_entity_info_alter(&$entity_info) {
$entity_info['node']['view modes']['print']['custom settings'] = TRUE;
...
}
After that, you go to panelizer settings of your content type(s), and set whatever you want for the print view mode

chronoforms v5 multi file upload...cannot choose multiple files

I am trying to configure this in v5 and cannot find any documentation. This is what I have so far...
followed the V4 documentation as close as possible, but cannot get the form to allow me to choose multiple files!
Under HTML Render I have Form Tag Attachment = enctype="multipart/form-data"
Under the designer tab I have file field element on the form. Under this I have
Field Name = file1[]
Field ID = file1
Multiple=Yes
Under the settings tab I have the files upload action in the on submit event. In the files upload action I have
Enabled=Yes
Files config = file1:jpg-png-gif-txt
Array fields = file1
is there anything else I need to do?
Turns out this is a bug and will be fixed in the next update. Workaround by creating a custom file upload element with the word multiple as a parameter.

Ext.grid.ColumnModel is not a constructor

I am quite new to extjs..and I installed ext js4 in my server. I get the following error. Not sure what it means:
Ext.grid.ColumnModel is not a constructor
here 's my link:
http://srikanthrajan.com/test/index.html
Now I get Ext.grid.RowSelectionModel is not a constructor
Basically I am trying the following tutorial:
http://www.sencha.com/learn/ext-js-grids-with-php-and-sql
RowModel is default so in your grid configurations try this:
selModel: { mode: 'SIMPLE' },
or
selModel: new Ext.selection.RowModel({singleSelect:false})
although singleSelect is not a config option of RowModel, so try:
selModel: new Ext.selection.RowModel({model:SIMPLE})
From ExtJs docs:
mode : String
Mode of selection. Valid values are:
SINGLE - Only allows selecting one item at a time. Use allowDeselect to allow deselecting >that item. This is the default.
SIMPLE - Allows simple selection of multiple items one-by-one. Each click in grid will >either select or deselect an item.
MULTI - Allows complex selection of multiple items using Ctrl and Shift keys.
EDIT:
I looked at the code in the tutorial you mentioned and noticed that it is for ExtJs 2.x and 3.x versions. Grid changed a lot from version 3 to 4. If you want to follow that tutorial you will need to have ExtJs 4 documentation at hand.
I think the columns for PresidentsColumnModel should be Ext.grid.column.Column, not Ext.grid.ColumnModel

I want to use my own theme for Dojo charts. how to connect it?

the current theme is connected with
dojo.require("dojox.charting.themes.PlotKit.green");
I created my theme, saved it in the same folder and tried to add to page:
dojo.require("mytheme");
But it's not connecting this way.
If you created your own module, the easiest thing to do is to place it in the folder, which is a peer of dojo:
dojo/...
dijit/...
dojox/...
my/... <- your file goes there
For example, it is called "mytheme". In this case it should go into my/mytheme.js file. In order to use it just require it and set on your chart:
dojo.require("my.mytheme");
...
chart.setTheme(my.mytheme);
Don't forget to put dojo.provide("my.mytheme"); at the top of your theme file, and define my.mytheme object (your theme).
Alternatively include it inline like I did in http://lazutkin.com/download/hicharts.html (look for myTheme). Or you can include the snippet using a regular <script> tag.
Do not forget to set your new theme explicitly on a chart: chart.setTheme(your_theme_object).