Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 17 of 17

Thread: Which category is this product in?

  1. #1
    BFG 9000 is offline Senior Member
    Join Date
    Oct 2006
    Location
    South UK
    Posts
    882

    Default Which category is this product in?

    Greetings all,

    Supposing I have a product mapped to multiple categories.

    If someone with no cookie or previous browsing history on the site lands on a product page (from google for example), which category will be chosen to appear in the breadcrumb & which categories skin will be displayed (supposing I have a different skin assigned to each of the relevant categories). In fact - is this effectively one question rather than two?

    I'm just trying to get my head around the rules that decide this & if I can influence them in any way.


    TTFN

    BFG

  2. #2
    Rob is offline Senior Member
    Join Date
    Aug 2004
    Posts
    3,037

    Default

    in this specific case, for SEO reasons, we try to find their last category cookie, and if not, we find the first mapped category for the product. The code is all on the showproduct code behind, You can step through it.
    AspDotNetStorefront
    Shopping Cart

  3. #3
    BFG 9000 is offline Senior Member
    Join Date
    Oct 2006
    Location
    South UK
    Posts
    882

    Default

    Thans for the help !!


    TTFN

    BFG

  4. #4
    C-Clops is offline Member
    Join Date
    Feb 2007
    Posts
    49

    Default How to determine category in an xml package?

    Following on to this:

    In previous versions the product links used to include the category ID that you were coming from. This is no longer the case, how would we show a category specific header on a product detail page?

    I guess the question is how would you determine the category in the xmlpackage?

    rc

  5. #5
    DanV's Avatar
    DanV is offline Ursus arctos horribilis
    Join Date
    Apr 2006
    Posts
    1,568

    Default

    I guess the question is how would you determine the category in the xmlpackage?
    Set the package to debug mode. You will see in the runtime XML that the parent entity type (eg. category/department) and the entity ID is stored in the system runtime data. You can access it via XPath in the package.

  6. #6
    ram is offline Senior Member
    Join Date
    Oct 2007
    Posts
    153

    Default

    Hi,

    How do I find which category a particular product is in via query? There are some items in our database that are not in any category. I want a query to find their sku and productid so that I can delete them. Thanks.

    Ram

  7. #7
    DanV's Avatar
    DanV is offline Ursus arctos horribilis
    Join Date
    Apr 2006
    Posts
    1,568

    Default

    select categoryid from productcategory where productid = 123

  8. #8
    ram is offline Senior Member
    Join Date
    Oct 2007
    Posts
    153

    Default

    How can I find items that are not in any of the categories? When you search such items on the admin site, the category column will be empty.

  9. #9
    DanV's Avatar
    DanV is offline Ursus arctos horribilis
    Join Date
    Apr 2006
    Posts
    1,568

    Default

    Code:
    select productid from product where productid not in (select productid from productcategory)
    will return a list of all unmapped products.

  10. #10
    ram is offline Senior Member
    Join Date
    Oct 2007
    Posts
    153

    Default

    Item A belongs to Category B in the ProductCategory table. Category B exists in the Category table and is marked as not deleted but when I try to open that category, it redirects to default.aspx and when I search for Item A in the Admin section, the category column is empty. How do I find such items? Lot of data needs to be cleaned up. Hope someone could help me. Thanks.

  11. #11
    miguelcrush is offline Senior Member
    Join Date
    Mar 2008
    Posts
    149

    Default

    is that category published?
    Mike Steyer
    Information Systems Admin

  12. #12
    ram is offline Senior Member
    Join Date
    Oct 2007
    Posts
    153

    Default

    What do you mean by published? That category is active in the Category table but when I try to open it, it redirects to default.aspx.

  13. #13
    ram is offline Senior Member
    Join Date
    Oct 2007
    Posts
    153

    Default

    Yes, published = 1.

  14. #14
    miguelcrush is offline Senior Member
    Join Date
    Mar 2008
    Posts
    149

    Default

    then the query dan posted will accomplish this
    Mike Steyer
    Information Systems Admin

  15. #15
    ram is offline Senior Member
    Join Date
    Oct 2007
    Posts
    153

    Default

    No, it doesn't.

  16. #16
    BFG 9000 is offline Senior Member
    Join Date
    Oct 2006
    Location
    South UK
    Posts
    882

    Default

    Quote Originally Posted by AspDotNetStorefront View Post
    in this specific case, for SEO reasons, we try to find their last category cookie, and if not, we find the first mapped category for the product. The code is all on the showproduct code behind, You can step through it.
    I'm struggling a little here..............

    I can see that the showproduct codebehind uses EntityHelper.GetProductsFirstEntity to determine a category for the product.
    Where can I see exactly the logic that EntityHelper.GetProductsFirstEntity uses - I need to mimic it in my left nav xmlpackage.


    We have products mapped to multiple categories & if there's no lastviewedentityinstanceid (or one that isn't relevant) I sometimes find that the breadcrumb & my left nav disagree.....

    Here's what I use in my left nav xml package if there's no (relevant) lastviewedentityinstanceid :-

    Code:
    SELECT TOP 1 CategoryID from dbo.ProductCategory where ProductID = @prod ORDER BY ProductID asc

    TTFN

    BFG

  17. #17
    BFG 9000 is offline Senior Member
    Join Date
    Oct 2006
    Location
    South UK
    Posts
    882

    Default

    Anyone?

    Alternatively, is there any function I can use to find out which category the breadcrumb is using?

    or some way to use EntityHelper.GetProductsFirstEntity within an xmlpackage?


    TTFN

    BFG