HomeHome Product Discus... Product Discus...SmithCartSmithCartStore Admin - Search for ProductStore Admin - Search for Product
Previous
 
Next
New Post
8/24/2010 3:06 PM
 

"Search for product" doesn't seem to be working very well in the store admin menu.... if I add in a new item, and search for it again by SKU, it doesn't come up.

Searching by product name doesn't return any results... does the search by Product Name do a "LIKE" Search? Which sp is that, so I can take a look?

 
New Post
8/24/2010 3:12 PM
 

Mmmm... I think I found the procedure..... Investigating now.

I'll let you know what I find.

 
New Post
8/24/2010 3:25 PM
 

Well, it's past quitting time.... and I'm brain-dead at the moment.... so I will have to investigate further.

The program must be passing some default fields to it, such as sortorder and so forth.... maybe that's not working properly? Searches don't seem to be working for any products that I put in, making me think that something isn't getting passed properly, or there's an issue with the procedure.... I will investigate further tomorrow when I'm mor coherant.

 
New Post
8/24/2010 4:17 PM
 

The stored procedure is called Smith_productByFilter


Scott Kelly
Project Manager
DotNetNuke Consulting, DotNetNuke Store and DNN Ecommerce
 
New Post
8/24/2010 7:21 PM
 

Compare the sproc "Smith_productByFilter" in your database with the same sproc in the 03.02.00.SqlDataProvider file in the 3.04 install zip to make sure they are the same you may have an old version of the sproc


At your service,
Dave Smith
DotNetNuke Consulting, DotNetNuke Store and DNN Ecommerce
 
New Post
8/25/2010 6:21 AM
 

Well, the Smith_productByFilter wasn't in the SQLDataProvider for build 3.04... it was, however, in the SQLDataProvider for build 3.02... and I have verified that it's the same sproc.

The interesting thing is, if I search in the CART for an item, it finds it. If I search in the Store Admin --> Manage Products, it does not find it.

Are those two different sprocs?

 
New Post
8/25/2010 8:42 AM
 

Yes the sproc that does the search in the front end of the cart from the product listing page is called "listproductsbyfilter"

-Scott


Scott Kelly
Project Manager
DotNetNuke Consulting, DotNetNuke Store and DNN Ecommerce
 
New Post
8/27/2010 1:00 AM
Accepted Answer 

I fixed the stored procedure that does the search from the manage products screen. Run the following stored proc in your database if your database uses an objectqualifier make sure you add yours. Changes highlighted in yellow:

/****** Object: StoredProcedure [dbo].[Smith_productByFilter] Script Date: 08/27/2010 00:11:07 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO


ALTER PROCEDURE [dbo].[Smith_productByFilter]
@Page int,
@RecsPerPage int,
@sortfield varchar(50),
@sortorder varchar(10),
@filter varchar(50),
@searchtext varchar(50) ,
@tabModuleId int,
@PortalId int
as

CREATE TABLE #TempItems
(
ProductAutoID int IDENTITY,
ProductID int
)
DECLARE @SearchSQL varchar(5000)

if(@Filter='All')
Begin
SELECT @SearchSQL ='INSERT INTO #TempItems (ProductID) select P.ProductID from Smith_Products P left outer join ' +
'Smith_Category C on C.CategoryID=P.CategoryID'+
' where ( p.TabModuleId = ' + CAST ( @tabModuleId AS VARCHAR(10)) + ' OR p.Share = 1 ) and P.LogicallyDeleted !=''1'''


if( @sortfield='CategoryName')
SELECT @SearchSQL=@SearchSQL+' '+' order by C.' +@sortfield+' '+ @sortorder
else
SELECT @SearchSQL=@SearchSQL+' '+' order by P.'+@sortfield+' '+ @sortorder
End

else if(@Filter='CategoryName')
Begin
SELECT @SearchSQL ='INSERT INTO #TempItems (ProductID) select P.ProductID from Smith_Products P inner join ' +
' Smith_CategoryProduct CP on CP.ProductID=P.ProductID inner join Smith_Category C on C.CategoryID=CP.CategoryID'+
' where ( p.TabModuleId = ' + CAST ( @tabModuleId AS VARCHAR(10)) + ' OR p.Share = 1 ) and P.LogicallyDeleted !=''1'' and ( C.'+@filter+' Like ''%' + @searchtext + '%'')'
if( @sortfield='CategoryName')
SELECT @SearchSQL=@SearchSQL+' '+' order by C.' +@sortfield+' '+ @sortorder
else
SELECT @SearchSQL=@SearchSQL+' '+' order by P.'+@sortfield+' '+ @sortorder
End
else
Begin
SELECT @SearchSQL ='INSERT INTO #TempItems (ProductID) select p.ProductID from Smith_Products P ' +
' where ( p.TabModuleId = ' + CAST ( @tabModuleId AS VARCHAR(10)) + ' OR p.Share = 1 ) and P.LogicallyDeleted !=''1'' and (
P.'+@filter+' Like ''%' + @searchtext + '%'')'
if( @sortfield='CategoryName')
SELECT @SearchSQL=@SearchSQL+' '+' order by C.' +@sortfield+' '+ @sortorder
else
SELECT @SearchSQL=@SearchSQL+' '+' order by P.'+@sortfield+' '+ @sortorder
End

EXECUTE(@SearchSQL)
DECLARE @FirstRec int, @LastRec int
SELECT @FirstRec = (@Page - 1) * @RecsPerPage
SELECT @LastRec = (@Page * @RecsPerPage + 1)

SELECT p.*,c.categoryname, TotalRecords=(
SELECT COUNT(*)
FROM #TempItems TI),
MoreRecords =
(
SELECT COUNT(*)
FROM #TempItems TI
WHERE TI.ProductAutoID >= @LastRec
)
FROM Smith_Products P left outer join
Smith_Category C on C.CategoryID=P.CategoryID RIGHT OUTER JOIN
#TempItems T ON P.ProductID = T.ProductID
WHERE ProductAutoID > @FirstRec AND ProductAutoID < @LastRec and p.PortalID = @PortalId


At your service,
Dave Smith
DotNetNuke Consulting, DotNetNuke Store and DNN Ecommerce
 
New Post
8/27/2010 5:46 AM
 

Nice job, Dave! I updated the procedure, and at first glance, that seems to have fixed things. I'll let you know.

Thank you again.

 
New Post
8/27/2010 6:14 AM
 

Whoops---- I spoke too soon. One of the warehouse folks just came in and said it still isn't working right.

Ready for this one, though? Seems that she may have found a pattern... anything starting with a S0 (zero) isn't working... I have, for example, S0069 for a product.... S0069, S00, S0, no results.

I'm going to take a closer peek at the routine today... if I figure it out, I'll post back my findings.

 
New Post
8/27/2010 6:59 AM
 

Whoops... I spoke too soon about speaking too soon.... your routine works. My data entry people need to be shot. LOL

 
Previous
 
Next
HomeHome Product Discus... Product Discus...SmithCartSmithCartStore Admin - Search for ProductStore Admin - Search for Product