Developer forum

Forum » Development » Custom dashboard in DW backend

Custom dashboard in DW backend

Søren Jakobsen
Reply

Hi,

do anyone have a link to documentation regarding creating custom dashboards in DW backend?

Need to develop a dashboard showing productgroups with certain criterias set (in custom fields). Also need to be able to change values shown in the dashboard

 

Best regards


Replies

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

Hi Søren,

You can read about custom dashboards and widgets here:

https://doc.dynamicweb.com/extensibility/extensibility/custom-dashboards

Best regards,
Morten

 
Søren Jakobsen
Reply

Thanks Morten,

Helped me alot. Do you know if it's possible to control the height of the widget element?

I have created a ListWidget but content extends outside the widget container - see attached

[AddInName("Product group list with uplift")]
    [AddInDescription("All product groups with uplift/downlift")]
    [AddInIcon(Dynamicweb.Core.UI.Icons.KnownIcon.HeartO)]
    public class ProductGroupDashboard : ListWidget
    {
        public ProductGroupDashboard()
        {
            Title = "Product groups with uplift/downlift";
            Columns = 6;
            
        }
        public override IEnumerable<ListViewItem> GetItems(IDashboard dashboard, string path)
        {
            var groupList = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroups();
            

            if (groupList.Any())
            {
                foreach (var group in groupList)
                {
                    var groupFieldValues = group.ProductGroupFieldValues;
                    
                    if (groupFieldValues != null)
                    {
                        var groupFieldValue = groupFieldValues.GetProductGroupFieldValue("GroupPercentage");
                        if (groupFieldValue != null && groupFieldValue.HasValue)
                        {
                            var upliftPercent = Convert.ToDouble(groupFieldValue.Value);
                            if (upliftPercent != 0)
                            {
                                var data = new ListViewItem()
                                {
                                    Title = group.Name,
                                    RightText = upliftPercent.ToString() + "%",
                                    OnClick = "location.href = '/Admin/Module/eCom_Catalog/dw7/edit/EcomGroup_Edit.aspx?ID=" + group.IdUrlEncoded + "#'",
                                };
                                yield return data;
                                
                            }
                        }
                    }
                }
            }
        }
    }

Udklip.PNG

 

You must be logged in to post in the forum