Is it possible to let the user select how many products to see in a list?
Something like a select box with options 12,24,36 etc, that changes the number of products shown in the list?
It should be possible with ex. jQuery, but what about standard DW. Is there something like this hidden in the DW functionality?
/Theis
Developer forum
E-mail notifications
Select number of products on product list
Replies
Just checked the code for possible hacks or notifications to manipulate this - and could not find a simple way...
But here's a hack... Hope you can use it:
<Subscribe(Dynamicweb.Notifications.Standard.Paragraph.OnBeforeRender)> _
Public Class NotificationSubscriber1
Inherits NotificationSubscriber
Public Overrides Sub OnNotify(ByVal notification As String, ByVal args As Dynamicweb.Extensibility.NotificationArgs)
If Not String.IsNullOrEmpty(Base.Request("PageSize")) Then
Dim paragraphArgs As Dynamicweb.Notifications.Standard.Paragraph.OnBeforeRenderArgs = DirectCast(args, Dynamicweb.Notifications.Standard.Paragraph.OnBeforeRenderArgs)
'Do some sanity check - we get if from querystring
Dim pagesize As Integer = Base.ChkInteger(Base.Request("PageSize"))
If pagesize < 100 AndAlso pagesize > 0 AndAlso paragraphArgs.Paragraph.Paragraph.ParagraphModuleSystemName.ToLower = "ecom_catalog" Then
Dim settings As Dynamicweb.Properties = Dynamicweb.Properties.LoadProperties(paragraphArgs.Paragraph.Paragraph.Row)
settings.Value("PageSize") = pagesize.ToString
paragraphArgs.Paragraph.Paragraph.Row.Item("ParagraphModuleSettings") = settings.ToString
End If
End If
End Sub
End Class
It looks good, I'll give it at go. :-)
Thanx
For those interested, this is a working C# version of the above code:
using Dynamicweb;
using Dynamicweb.Extensibility;
namespace CustomModules
{
[Subscribe(Dynamicweb.Notifications.Standard.Paragraph.OnBeforeRender)]
public class Notification_Paragraph : NotificationSubscriber
{
public override void OnNotify(string notification, NotificationArgs args)
{
if (!string.IsNullOrEmpty(Base.Request("PageSize"))) {
Dynamicweb.Notifications.Standard.Paragraph.OnBeforeRenderArgs paragraphArgs = (Dynamicweb.Notifications.Standard.Paragraph.OnBeforeRenderArgs)args;
int PageSize = Base.ChkInteger(Base.Request("PageSize"));
if (PageSize < 200 && PageSize > 0 && paragraphArgs.Paragraph.Paragraph.ParagraphModuleSystemName.ToLower().Equals("ecom_catalog")) {
Properties settings = Properties.LoadProperties(paragraphArgs.Paragraph.Paragraph.Row);
settings.set_Value("PageSize", PageSize.ToString());
paragraphArgs.Paragraph.Paragraph.Row["ParagraphModuleSettings"] = settings.ToString();
}
}
base.OnNotify(notification, args);
}
}
}
Regards
Martin
You must be logged in to post in the forum