Children Products visibility issue

2 个月 前
Some products have at least up to 17 children. They can not be sold separately therefore therefore they have been selected not to make visibly independently.

The problem is they  Search by Product ID returns no results.  That's 17 products for the 1 product which will not be found. I'm working with 1,300 products grouped and simple which roll-up to 125 products. That's going to be a lot of un found products

Putting the Product ID in the Tags( a bad hack) does not work. My expectation would be that when the when searching by children products the search would return the parent product.

Is this a bad expectation are there any work around?
2 个月 前
It's easy to modify the ProductLoadAllPaged stored procedure with SSMS to suit your needs.

E.G. this would get child products by product attribute combination SKU:


    IF @SearchSku = 1
    BEGIN
      SET @sql = @sql + '
      UNION
      SELECT p.Id
      FROM Product p with (NOLOCK)
      LEFT JOIN ProductAttributeCombination pac with (NOLOCK)
      ON p.Id = pac.ProductId
      WHERE '
      IF @UseFullTextSearch = 1
        SET @sql = @sql + 'p.[Sku] LIKE ''%'  + @Keywords+ '%'' OR pac.[Sku] LIKE ''%'  + @Keywords + '%'''
      ELSE
        SET @sql = @sql + 'PATINDEX(@Keywords, p.[Sku]) > 0 OR PATINDEX(@Keywords, pac.[Sku]) > 0'
    END
2 个月 前
Thanks for point me to the store procedure.
Unfortunately, it did not return the expected results.  Additionally it resulted in a bug - a second search box was created after clicking the green search button.
As an aside I also tried to replace SELECT P.Id with SELECT DISTINCT CASE WHEN p.VisibleIndividually = 0 THEN p.ParentGroupedProductId ELSE p.Id END as Id
which also did not return the expected results and created the second search bar
See the attached image.
2 个月 前
attaching the image
2 个月 前
You can't attach images directly in your post.  Upload your image to a another sharing site, and then put the link here.
2 个月 前
link the image https://postimg.cc/t7tb7cPN

or

https://postimg.cc/t7tb7cPN
2 个月 前
That is the "search" page reached when clicking the magnifying glass in the top search bar.  It is built in to nopCommerce and did not come about by editing the stored procedure.  

The top search bar has 2 different methods, an ajax request that fires after you stop typing which displays results below, and a normal form post that redirects to the search page in your screen shot.

We simply need to figure out the SQL to return the individual products, but probably need more information on how your products are setup.  Do you have the parent setup as a grouped product with "children" variants?  Or is the parent a simple product bundled with "children" attribute combinations that are associated to other individual products?  And by "product Id" are you referring to its Id in the database, or some other identifier?
2 个月 前
Data from table Product
Parent: Grouped (Product with Variiants)Id: 822, ProductTypeId:10, ParentProductGroupId: 0,  ProductTemplateId:2, VisibileIndvidula: 1
Child1:Simple                           Id: 819, ProductTypeId:10, ParentProductGroupId: 822,ProductTemplateId:1, VisibileIndvidula: 0
Child2:Simple                           Id: 820, ProductTypeId:10, ParentProductGroupId: 822,ProductTemplateId:1, VisibileIndvidula: 0
Child2:Simple                           Id: 821, ProductTypeId:10, ParentProductGroupId: 822,ProductTemplateId:1, VisibileIndvidula: 0[u][/u]

In my prior communication product id refers to column 'Id' of table 'Product'