Page 1 of 1
Private / Locked items still show up in Upsell
Posted: Thu Jan 15, 2015 6:07 am
by BC_Bo
I noticed something odd about Private (Locked) items. They still show up as options in Upsell, even when they are set to Private.
My understanding is that the entire point of having an item marked as Private is to prevent it from being seen by the public.
Is this a bug, or is it intentional?
Re: Private / Locked items still show up in Upsell
Posted: Thu Jan 15, 2015 9:30 am
by rmaweb
Can you double check the following file in your site? Its the one that is used in the /ProductAccessories.aspx file
Conlib/ProductAccessoriesGrid.ascx.cs
Find: ProductList.DataSource = _Product.GetUpsellProducts(true, true);
Just make sure both options in GetUpsellProducts are set to true.
Re: Private / Locked items still show up in Upsell
Posted: Thu Jan 15, 2015 9:57 am
by Katie
BC_Bo -
Which version are you using? This is a bug from one of our older versions.
Thanks
Katie
Re: Private / Locked items still show up in Upsell
Posted: Fri Jan 16, 2015 6:40 am
by BC_Bo
Thanks for the responses.
It looks like the code for Conlib/ProductAccessoriesGrid.ascx.cs is correct.
Code: Select all
{
CaptionLabel.Text = string.Format(CaptionLabel.Text, _Product.Name);
InstructionText.Text = string.Format(InstructionText.Text, _Product.Name);
KeepShoppingLink.NavigateUrl = AbleCommerce.Code.NavigationHelper.GetReturnUrl(AbleCommerce.Code.NavigationHelper.GetLastShoppingUrl());
ProductList.RepeatColumns = this.Columns;
ProductList.DataSource = _Product.GetUpsellProducts(true, true);
ProductList.DataBind();
}
My version is Gold R9 (VERSION: 7.0.89.7670)
I just confirmed that this is still an issue. Private items show up in Upsell whether I add them as a Private item or an Upsell item is made Private. Hidden items also appear, but I believe that's how it's supposed to be.
Re: Private / Locked items still show up in Upsell
Posted: Fri Jan 16, 2015 12:36 pm
by Katie
I just tested using the Printer sample product which has Printer paper as an up-sell item. When I added the Printer to the cart, the ProductAccessories.aspx page appeared with the paper as one up-sell choice. Then I cleared the cart and changed the visibility of the paper to private. When I added the printer on the second test, the paper was not one of the choices.
I also tested as an admin user and guest user. The results are the same. This appears to be working fine and we've had no one else report it, so there must be some subtle difference between our two installs. The bug that I was thinking of before was actually in the Related products control and that was fixed awhile ago.
Thanks
Katie
Re: Private / Locked items still show up in Upsell
Posted: Thu Jan 22, 2015 5:59 am
by AbleMods
Sorry Katie, it was a bug in my code.
The _Product object has two ways to access the child Upsell entities. You can reference _Product.UpsellProducts directly to reach the collection. But the collection returned is unfiltered and includes any visibility.
The correct way is to use the _Product.GetUpsellProducts() method which accepts a parameter to filter the returned collection for visible upsell products only. Doing it this way resolved the issue.