Resolved!! creating dynamic list boxes in 1.9

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
Hi,

I would just like to share this, basicaly what i wanted on my site was dynamic listboxes on different categories and sub categories without user controls on the right hand side of my site, and thanks to LevGe aswell.

1. Created the locale resource strings: Name - Content.dvd, Value - DVD Chart.
                                                                  Content.top-selling-dvd, Value Top Sellers
                                                                  Content.pre-order-dvd,  Value - Top Pre Order


2. Code for ThreeColumn master page:

    <div class="master-wrapper-rightside-3">
            <%------ DVD category start ------%>
            <%-- 53 dvd main start --%>
            <div class="block block-dvd" id="listbox1" runat="server">
                <div class="title">
                    <%=GetLocaleResourceString("Content.dvd")%>
                </div>
                <div class="listbox">
                    <ul>
                        <li><a id="dvd1" href="~/Default.aspx" runat="server" enableviewstate="false">Link 1</a></li>
                        <li><a id="dvd2" href="~/Default.aspx" runat="server" enableviewstate="false">Link 2</a></li>
                        <li><a id="dvd3" href="~/Default.aspx" runat="server" enableviewstate="false">Link 3</a></li>
                    </ul>
                </div>
            </div>
            <%-- 53 dvd main finish --%>
            <%-- 69 top selling dvd start --%>
            <div class="block block-top-selling-dvd" id="listbox2" runat="server">
                <div class="title">
                    <%=GetLocaleResourceString("Content.top-selling-dvd")%>
                </div>
                <div class="listbox">
                    <ul>
                        <li><a id="dvd11" href="~/Default.aspx" runat="server" enableviewstate="false">Link 1</a></li>
                        <li><a id="dvd12" href="~/Default.aspx" runat="server" enableviewstate="false">Link 2</a></li>
                        <li><a id="dvd13" href="~/Default.aspx" runat="server" enableviewstate="false">Link 3</a></li>
                    </ul>
                </div>
            </div>
            <%-- 69 top selling dvd finish --%>
            <%-- 55 pre-order-dvd start --%>
            <div class="block block-pre-order-dvd" id="listbox3" runat="server">
                <div class="title">
                    <%=GetLocaleResourceString("Content.pre-order-dvd")%>
                </div>
                <div class="listbox">
                    <ul>
                        <li><a id="dvd21" href="~/Default.aspx" runat="server" enableviewstate="false">Link 1</a></li>
                        <li><a id="dvd22" href="~/Default.aspx" runat="server" enableviewstate="false">Link 2</a></li>
                        <li><a id="dvd23" href="~/Default.aspx" runat="server" enableviewstate="false">Link 3</a></li>
                    </ul>
                </div>
            </div>
            <%-- 55 pre order dvd finish --%>
            <%------ DVD category finish ------%>
            </asp:ContentPlaceHolder>
</div>



3. Then in the ThreeColumn.Master.cs.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using NopSolutions.NopCommerce.BusinessLogic.Configuration.Settings;
using NopSolutions.NopCommerce.Common.Utils;


namespace NopSolutions.NopCommerce.Web.MasterPages
{
    public partial class ThreeColumn : BaseNopFrontendMasterPage
    {
        new protected void Page_Load(object sender, EventArgs e)
        {

            listbox1.Visible = false;
            listbox2.Visible = false;
            listbox3.Visible = false;
            
            int categoryid = CommonHelper.QueryStringInt("CategoryId");

            //////////////////// if statements start /////////////////////////////

            //dvd category start
            if (categoryid == 53)//dvd chart main category
            {
                listbox1.Visible = true;//53 dvd chart
                listbox2.Visible = true;//69 top selling dvd
                listbox3.Visible = true;//55 pre order dvd
            }
            if (categoryid == 69)//top selling dvd
            {
                listbox2.Visible = true;
            }
            if (categoryid == 55)//pre order dvd
            {
                listbox3.Visible = true;
            }

            //dvd category finish
            
            

//////////////////// if statements end /////////////////////////////

//////////////////// else if statements start /////////////////////////////


    //dvd main category start
            else if (categoryid == 53)//dvd chart main category
            {

                listbox1.Visible = true;//53 dvd chart
                listbox2.Visible = true;//69 top selling dvd
                listbox3.Visible = true;//55 pre order dvd
            }
            else if (categoryid == 69)//top selling dvd
            {
                listbox2.Visible = true;
            }
            else if (categoryid == 55)//top selling dvd
            {
                listbox3.Visible = true;
            }
            //dvd main category finish

            
            //////////////////// else if statements end /////////////////////////////
        }
    }
}


4. then added the classes to style.css sheet.

.block-category-navigation, .block-manufacturer-navigation, .block-recently-viewed-products, 
.block-info, .block-shoppingcart, .block-livechat, .block-popular-tags,
.block-popular-blogtags, .block-blog-archive, .block-poll, .block-newsletter, .block-dvd, .block-top-selling-dvd,
.block-pre-order-dvd


recompile and that's it.
12 years ago
Tank you!!
Is there a site wher it can be seen?
12 years ago
Hi,

The site is under design construction but should be live without products on monday.
12 years ago
garrie007 wrote:
Hi,

The site is under design construction but should be live without products on monday.

Thanks again Garrie
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.