Private / Locked items still show up in Upsell

For general questions and discussions specific to the AbleCommerce GOLD ASP.Net shopping cart software.
Post Reply
BC_Bo
Ensign (ENS)
Ensign (ENS)
Posts: 13
Joined: Fri Jul 15, 2011 9:11 am

Private / Locked items still show up in Upsell

Post by BC_Bo » Thu Jan 15, 2015 6:07 am

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?

rmaweb
Commander (CMDR)
Commander (CMDR)
Posts: 118
Joined: Fri Sep 10, 2010 9:41 am

Re: Private / Locked items still show up in Upsell

Post by rmaweb » Thu Jan 15, 2015 9:30 am

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.
Ryan A.
Scott's Bait and Tackle
http://store.scottsbt.com
Work In Progress
Able Gold R10
Bootstrap 3.3

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

Re: Private / Locked items still show up in Upsell

Post by Katie » Thu Jan 15, 2015 9:57 am

BC_Bo -

Which version are you using? This is a bug from one of our older versions.

Thanks
Katie
Thank you for choosing AbleCommerce!

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

BC_Bo
Ensign (ENS)
Ensign (ENS)
Posts: 13
Joined: Fri Jul 15, 2011 9:11 am

Re: Private / Locked items still show up in Upsell

Post by BC_Bo » Fri Jan 16, 2015 6:40 am

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.

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

Re: Private / Locked items still show up in Upsell

Post by Katie » Fri Jan 16, 2015 12:36 pm

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
Thank you for choosing AbleCommerce!

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

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: Private / Locked items still show up in Upsell

Post by AbleMods » Thu Jan 22, 2015 5:59 am

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.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

Post Reply