HomeHome Product Discus... Product Discus...SmithCartSmithCartGetting the Current User to a Stored ProcedureGetting the Current User to a Stored Procedure
Previous
 
Next
New Post
8/27/2010 9:46 AM
 

Hi,

I'm new to Smith Shopping Cart and I was wondering if there is a way to pass the current user's ID to a stored procedure that is executed when the transact has been successful?

Any guidance would be appreciated.

mmoney

 
New Post
8/28/2010 12:27 AM
 

The oncheckout event does not pass any parameters to your custom stored proc but you can write a trigger on the orders table or use scope identity() in your stored proc to get the orderid and userid of the last order inserted.

Dave


At your service,
Dave Smith
DotNetNuke Consulting, DotNetNuke Store and DNN Ecommerce
 
New Post
8/29/2010 12:47 PM
 

If Smith's is running in "Test" mode, will the stored procedure be called?

I have written a stored procedure, which executes as desired in the SQL tool but when saved and called from Smith tools, does not seem to fire. I've done a lot of research on the scope identity() function and can get the IDENT_CURRENT('table') function to return the last orderID but for some reason, I can't get the scope_identity() function to return anything. How does it know which table to return the value from - I'm assuming I'm trying to get it to return the value from dbo.Smiths_StoreOrders? I noticed the stored procedure dbo.Smith_AddStoreOrders ends with SELECT scope_identity(), do I use this in some way to retrieve the customerID. Here is my stored procedure as I have it now...any guidance would be greatly appreciated:

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [dbo].[Neighbay_ShoppingCart]

AS
DECLARE @OrderID int
DECLARE @UserID int
DECLARE @ExpiryDate datetime
DECLARE @PassDate datetime


SET @ExpiryDate = DATEADD(mm,3,GETDATE())
SET @passdate = CURRENT_TIMESTAMP
SET @OrderID = IDENT_CURRENT('Smith_StoreOrders')
SET @UserID = (SELECT CustomerID FROM Smith_StoreOrders WHERE OrderID = @OrderID)

exec dbo.Ventrian_PropertyAgent_PropertyAdd 495,17,1,@passdate,@passdate,@passdate,@ExpiryDate,0,3,@UserID,1,44.48706,-76.99449

 
New Post
8/29/2010 1:06 PM
 

When naming your stored procedure you will need to append the following:

DatabaseOwner + ObjectQualifier + ModuleQualifier in front of your stored procedure.

  • DatabaseOwner is usually “dbo”
  • ObjectQualifier – Is assigned when you installed DNN (defaults to _dnn)
  • ModuleQualifier is “Smith”

For example, a stored procedure titled “TransferOrder” should be named as follows:

“dbo.dnn_Smith_ TransferOrder”


At your service,
Dave Smith
DotNetNuke Consulting, DotNetNuke Store and DNN Ecommerce
 
New Post
8/29/2010 3:39 PM
 

Hmm....yes, that is the quote as it appears in the Smith Shopping Cart manual. This I read and I understand how to name the stored procedure. For the sake of others with similar questions I will add that one of the following - I'm not sure which as the the changes were made at the same time - is responsible for your stored procedure not calling:

1. Have not yet inserted the license key

2. Are working in test mode

I guess the first part of my question was what could stop the stored procedure from executing - since mine is working now, I am concluding that it was one of the preceeding options. Mine was named correctly.

The second part of my question was how one would use scope_identity to retrieve the value of OrderID from the table dbo.smith_storeorders. It has been eluded to in other posts, but no example was provide...that I could find.

Any insight on this would be helpful....or even a url with further info.

Thanks

 
New Post
8/29/2010 3:47 PM
 

Yes you can try using SELECT SCOPE_IDENTITY() which returnsthe last IDENTITY value produced on a connection and by a statement in the same scope, regardless of the table that produced the value. If that doesnt return the last order id created in the smith_storeorders then you can try using SELECT IDENT_CURRENT(‘smith_storeorders’) which returns the last IDENTITY value produced in a table, regardless of the connection that created the value, and regardless of the scope of the statement that produced the value. IDENT_CURRENT is not limited by scope and session; it is limited to a specified table. IDENT_CURRENT returns the identity value generated for a specific table in any session and any scope.


At your service,
Dave Smith
DotNetNuke Consulting, DotNetNuke Store and DNN Ecommerce
 
New Post
8/29/2010 5:58 PM
 

Thank you for the answers. This has worked perfectly.

 
Previous
 
Next
HomeHome Product Discus... Product Discus...SmithCartSmithCartGetting the Current User to a Stored ProcedureGetting the Current User to a Stored Procedure