Related products in 7.0.7

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
jdarby
Commander (CMDR)
Commander (CMDR)
Posts: 151
Joined: Thu Sep 25, 2008 2:21 pm

Related products in 7.0.7

Post by jdarby » Tue Jan 29, 2013 2:08 pm

Using AC 7.0.7 and trying to make an adjustment to the RelatedProducts conlib so it only displays 4 items max. I added the "MaxItems" flag but it continues to display all of the related items. I tried this on a 100% clean and unmodified version and it does the same. Is there a fix for this?

Here is my code:
[[ConLib:RelatedProducts Caption="Related Items" MaxItems="4" Orientation="HORIZONTAL" Columns="4"]]

All of the option flags are working as expected except for MaxItems.

User avatar
Logan Rhodehamel
Developer
Developer
Posts: 4116
Joined: Wed Dec 10, 2003 5:26 pm

Re: Related products in 7.0.7

Post by Logan Rhodehamel » Wed Feb 06, 2013 6:43 pm

It looks like a valid bug.

If you open the file RelatedProducts.ascx.cs around line 89 you find this:

Code: Select all

                if (relatedProduct.ChildProduct.Visibility == CatalogVisibility.Public)
A quick fix might be to add a check against the MaxItems property:

Code: Select all

                if (relatedProduct.ChildProduct.Visibility == CatalogVisibility.Public && products.Count < this.MaxItems)
This should limit the display to the first X items. However a better fix would probably choose a random selection from the available set.
Cheers,
Logan
Image.com

If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.

jdarby
Commander (CMDR)
Commander (CMDR)
Posts: 151
Joined: Thu Sep 25, 2008 2:21 pm

Re: Related products in 7.0.7

Post by jdarby » Mon Feb 11, 2013 9:53 am

Logan Rhodehamel wrote:It looks like a valid bug.

If you open the file RelatedProducts.ascx.cs around line 89 you find this:

Code: Select all

                if (relatedProduct.ChildProduct.Visibility == CatalogVisibility.Public)
A quick fix might be to add a check against the MaxItems property:

Code: Select all

                if (relatedProduct.ChildProduct.Visibility == CatalogVisibility.Public && products.Count < this.MaxItems)
This should limit the display to the first X items. However a better fix would probably choose a random selection from the available set.
I assumed the MaxItems flag would display a random set of results. Is there a way I can do this that is similar to the fix above?

User avatar
Katie
AbleCommerce Admin
AbleCommerce Admin
Posts: 2651
Joined: Tue Dec 02, 2003 1:54 am
Contact:

Re: Related products in 7.0.7

Post by Katie » Wed Feb 13, 2013 9:14 am

Randomizing the results is a different issue. It would actually be considered an enhancement. I made the suggestion that we add a new property to enable or disable randomization because we shouldn't change the existing behavior of a control. If considered, it would have to be something we add to our current version of AbleCommerce Gold.
Thank you for choosing AbleCommerce!

http://help.ablecommerce.com - product support
http://wiki.ablecommerce.com - developer support

Post Reply