LWP_VALIDATE_CART

Hey all, 

Quick question, does someone have an unaltered LWP_VALIDATE_CART stored procedure that you can send to me? We had some old customizations on TNEW years ago, and we're back on TNEW and those customizations, in the form of web hooks in the LWP_VALIDATE_CART procedure are causing havoc in our renewals path, specifically add ons.

If I had a clean version of this sp, I believe it would help solve my issues. 

Thanks,
M

  • Our is all jazzed up too.

    In the past I've reached out to support.

  • Thanks for the reply. I have, but while waiting I'm troubleshooting because of time sensitivity. 

  • This is the version from our DB (self-hosted) if that's any good? (we've never used it)

    USE [impresario]
    GO
    /****** Object:  StoredProcedure [dbo].[LWP_VALIDATE_CART]    Script Date: 12/02/2024 13:55:15 ******/
    SET ANSI_NULLS OFF
    GO
    SET QUOTED_IDENTIFIER OFF
    GO
    ALTER Procedure [dbo].[LWP_VALIDATE_CART](
    		@sessionkey varchar(64) = null,	
    		@validate_point int = null)
    	
    	AS
    	
    	Set NoCount On
    	
    	/*****************************************************************************************************************************
    	New Procedure CWR 10/25/2004  This procedure is a place to store localized code to validate web order information.  
    	
    	It either returns an -101 error message with some error text or it simply returns.  There is no resultset.  The optional
    	validate_point parameter allows code to be written for various purposes.  Sample code is included.
    	
    	******************************************************************************************************************************/
    	
    	Declare	@errmsg varchar(200),
    		@customer_no int,
    		@cart_count int
    		
    	
    	-- validate sessionkey parameter
    	If @sessionkey is null OR not exists (select * from t_web_session_session where sessionkey = @sessionkey)
    	  Begin
    		select @errmsg = 'Invalid Session ID'
    		RAISERROR(@errmsg, 11, 2) WITH SETERROR
    		return -101
    	  End
    	Else
    		Select @customer_no = customer_no from t_web_session_session where sessionkey = @sessionkey
    	
    	-- example of validating that the customer for this session has donated money in the past year:
    	If @validate_point = 1
    	  Begin
    		If Not Exists (select * from t_contribution where customer_no = @customer_no and cont_dt > dateadd(yy, -1, getdate()))
    		  Begin
    			select @errmsg = 'This constituent has not made a contribution in the last year'
    			RAISERROR(@errmsg, 11, 2) WITH SETERROR
    			return -101
    		  End
    	  End
    	
    	-- example of validating that the customer for this session has put more than 3 different performances in the current session cart:
    	If @validate_point = 2
    	  Begin
    		Select	@cart_count = count(distinct a.perf_no)
    		From	t_web_lineitem a
    			JOIN t_web_order b ON a.order_no = b.order_no
    		Where	b.sessionkey = @sessionkey
    			and a.pkg_no = 0	-- only count single performances
    	
    		If IsNull(@cart_count, 0) < 3
    		  Begin
    			select @errmsg = 'Buy at least three different performances and get a special discount.'
    			RAISERROR(@errmsg, 11, 2) WITH SETERROR
    			return -101
    		  End
    	  End
    	
    	
    	RETURN