Left Sidebar in AC Gold (scriptlet in old version)
Left Sidebar in AC Gold (scriptlet in old version)
Can someone please explain how to create a custom left sidebar in AC Gold. In the prevsious version it was easy to create a side bar with the scriptlets. Do you have to hard code custom sidebars in Gold?? In the previous version you could create headers, footers, sidebars, etc.. with scriptlets.
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Re: Left Sidebar in AC Gold (scriptlet in old version)
I haven't tried it yet, but Able has been adding capabilities and it looks like you need to create one implementing ISidebar.
viewtopic.php?f=65&t=16733
viewtopic.php?f=65&t=16733
Available controls gets populated by examining the controls in the ConLib folder (and it's subdirectories). It looks for controls that implement the CommerceBuilder.UI.ISidebarControl interface. If you create new controls, you can do the same and your control will be included into the list. (In our next update, header and footer controls will additionally be supported in this fashion with IHeaderControl and IFooterControl interfaces.)
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Re: Left Sidebar in AC Gold (scriptlet in old version)
It's still pretty simple to make customer sidebar controls or headers and footers.
For sidebars, you need to include the ISidebarControl in the code behind like this:
for headers you need to include IHeaderControl:
and for footers you need to include IFooterControl:
Adding these to your code behind declarations will let the layout editors understand which controls to include in which lists.
For sidebars, you need to include the ISidebarControl in the code behind like this:
Code: Select all
public partial class SimpleCategoryList : System.Web.UI.UserControl, ISidebarControl
Code: Select all
public partial class StoreHeader : System.Web.UI.UserControl, IHeaderControl
Code: Select all
public partial class StoreFooter : System.Web.UI.UserControl, IFooterControl
-
- Lieutenant, Jr. Grade (LT JG)
- Posts: 42
- Joined: Fri Apr 15, 2011 11:04 pm
Re: Left Sidebar in AC Gold (scriptlet in old version)
To save someone else frustration here, I wanted to point out an apparent bug (which I have logged using AC's new feedback tool within the admin panel).
I am using Gold R3 B5078, btw.
If you want to place your custom controls within a nested directory for organization (i.e. 'ConLib/Custom/'), the Edit Layout form within the admin panel will not properly mange these nested controls. When adding a given nested control to one of the "Selected Controls" list boxes, and clicking save, the control will be moved back over to the "Available Controls" list box, as if it didn't "take." Note that the control IS actually being added to appropriate Master Page, but the Edit Layout form doesn't see this because of a discrepancy in references to the control's name.
Here is how I fixed it if you're interested: I added a helper method to compare the controls' names properly:
and then called this method for each of the 4 possible control types:
I am using Gold R3 B5078, btw.
If you want to place your custom controls within a nested directory for organization (i.e. 'ConLib/Custom/'), the Edit Layout form within the admin panel will not properly mange these nested controls. When adding a given nested control to one of the "Selected Controls" list boxes, and clicking save, the control will be moved back over to the "Available Controls" list box, as if it didn't "take." Note that the control IS actually being added to appropriate Master Page, but the Edit Layout form doesn't see this because of a discrepancy in references to the control's name.
Here is how I fixed it if you're interested: I added a helper method to compare the controls' names properly:
Code: Select all
/// <summary>
/// Looks through a collection of ConLibControl(s) and returns the first instance whose name matches a supplied string
/// </summary>
/// <param name="controlName">The name of the control to look for</param>
/// <param name="controlCollection">The collection to look through</param>
/// <returns>A ConLibControl reference</returns>
// 2013-02-27:CFL_JPH - Nested controls were not being found because of the extra characters (the nested directory names) in their "name":
private ConLibControl FindSelectedControls(string controlName, ConLibControlCollection controlCollection)
{
ConLibControl selectedControl = null;
foreach (ConLibControl control in controlCollection)
{
string name = control.Name;
if (name.Contains("/")) name = name.Substring(name.LastIndexOf("/") + 1);
if (controlName == name)
{
selectedControl = control;
break;
}
}
return selectedControl;
}
// 2013-02-27:CFL_JPH - Nested controls were not being found because of the extra characters (the nested directory names) in their "name": End
Code: Select all
// 2013-02-27:CFL_JPH - Nested controls were not being found because of the extra characters (the nested directory names) in their "name":
//ConLibControl selectedControl = _HeaderControls.FirstOrDefault(control => control.Name.Equals(headerControl));
ConLibControl selectedControl = FindSelectedControls(headerControl, _HeaderControls);
// 2013-02-27:CFL_JPH - Nested controls were not being found because of the extra characters (the nested directory names) in their "name": End
Code: Select all
// 2013-02-27:CFL_JPH - Nested controls were not being found because of the extra characters (the nested directory names) in their "name":
//ConLibControl selectedControl = _SidebarControls.FirstOrDefault(control => control.Name.Equals(leftSidebarControl));
ConLibControl selectedControl = FindSelectedControls(leftSidebarControl, _SidebarControls);
// 2013-02-27:CFL_JPH - Nested controls were not being found because of the extra characters (the nested directory names) in their "name": End
Code: Select all
// 2013-02-27:CFL_JPH - Nested controls were not being found because of the extra characters (the nested directory names) in their "name":
//ConLibControl selectedControl = _SidebarControls.FirstOrDefault(control => control.Name.Equals(rightSidebarControl));
ConLibControl selectedControl = FindSelectedControls(rightSidebarControl, _SidebarControls);
// 2013-02-27:CFL_JPH - Nested controls were not being found because of the extra characters (the nested directory names) in their "name": End
Code: Select all
// 2013-02-27:CFL_JPH - Nested controls were not being found because of the extra characters (the nested directory names) in their "name":
//ConLibControl selectedControl = _FooterControls.FirstOrDefault(control => control.Name.Equals(footerControl));
ConLibControl selectedControl = FindSelectedControls(footerControl, _FooterControls);
// 2013-02-27:CFL_JPH - Nested controls were not being found because of the extra characters (the nested directory names) in their "name": End
Jason Hendee
Cables for Less
Cables for Less
-
- Commander (CMDR)
- Posts: 118
- Joined: Sat Dec 20, 2008 11:27 pm
Re: Left Sidebar in AC Gold (scriptlet in old version)
I've reported the nesting conlib problems several times myself. They totally don't work with the layout editor, so I end up making my layout changes directly in Visual Studio. I just installed R4, and it seems it didn't fix the problem there, either. I can see the custom controls in level ConLib/Custom/NonStandard but not at level ConLib/Custom. I use the NonStandard folder for 3rd party add-ons or things I write and the Custom level is just standard conlibs that I have modified a little. When I loaded R4 just now, None of the layouts that I have specified in the masters via Visual Studio are registering as selected controls. I'm not going to bother with selecting them now because I think it will just hose everything up and I will have to change the layouts manually again. This layout editor is buggy at best, and I've submitted several bugs and suggestions.
Re: Left Sidebar in AC Gold (scriptlet in old version)
This cab easily fixed by makking few changes to Edit Layout page. Edit your Admin/Website/Layout/EditLayout.aspx.cs file and then do the following updates.
locate
and update it
locate
and updated it
locate
and update it
locate
and udpate it
locate
Code: Select all
ConLibControl selectedControl = _HeaderControls.FirstOrDefault(control => control.Name.Equals(headerControl));
Code: Select all
ConLibControl selectedControl = _HeaderControls.FirstOrDefault(control => (control.Name.Equals(headerControl) || control.Name.EndsWith("/" + headerControl)));
Code: Select all
ConLibControl selectedControl = _SidebarControls.FirstOrDefault(control => control.Name.Equals(leftSidebarControl));
Code: Select all
ConLibControl selectedControl = _SidebarControls.FirstOrDefault(control => (control.Name.Equals(leftSidebarControl) || control.Name.EndsWith("/" + leftSidebarControl)));
Code: Select all
ConLibControl selectedControl = _SidebarControls.FirstOrDefault(control => control.Name.Equals(rightSidebarControl));
Code: Select all
ConLibControl selectedControl = _SidebarControls.FirstOrDefault(control => (control.Name.Equals(rightSidebarControl) || control.Name.EndsWith("/" + rightSidebarControl)));
Code: Select all
ConLibControl selectedControl = _FooterControls.FirstOrDefault(control => control.Name.Equals(footerControl));
Code: Select all
ConLibControl selectedControl = _FooterControls.FirstOrDefault(control => (control.Name.Equals(footerControl) || control.Name.EndsWith("/" + footerControl)));
-
- Lieutenant, Jr. Grade (LT JG)
- Posts: 42
- Joined: Fri Apr 15, 2011 11:04 pm
Re: Left Sidebar in AC Gold (scriptlet in old version)
Mazhar,
Thank you for the LINQ-based fix; much less modification than mine
Thank you for the LINQ-based fix; much less modification than mine
Jason Hendee
Cables for Less
Cables for Less