Page 1 of 1

Related products in 7.0.7

Posted: Tue Jan 29, 2013 2:08 pm
by jdarby
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.

Re: Related products in 7.0.7

Posted: Wed Feb 06, 2013 6:43 pm
by Logan Rhodehamel
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.

Re: Related products in 7.0.7

Posted: Mon Feb 11, 2013 9:53 am
by jdarby
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?

Re: Related products in 7.0.7

Posted: Wed Feb 13, 2013 9:14 am
by Katie
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.