Admin area - view basket contents


https://forum.kartris.com/Topic1314.aspx
Print Topic | Close Window

By saturation - Wed 7 Sep 2011
I would like to see what's in my customer's saved baskets from the backend--at the individual level.   Is there a simple way to code this?
By Mohammad - Fri 16 Sep 2011
Its not that easy to do it in back-end, but I can give a hint to start (but my code is a bit limited - version name, code number and the saved quantity for each version; options are a bit complicated so will not include it).

You need to have 2 new stored procedures:

1. To get the saved baskets for a customer
SELECT DISTINCT SB.SBSKT_ID, SB.SBSKT_Name, 
SB.SBSKT_DateTimeAdded, SB.SBSKT_LastUpdated
FROM tblKartrisSavedBaskets SB INNER JOIN tblKartrisBasketValues BV
ON SB.SBSKT_ID=BV.BV_ParentID AND BV.BV_ParentType='s'
WHERE SB.SBSKT_UserID=@UserID

@UserID is the customer id, you can remove the last line to get all the saved baskets regardless to the customer.

2. To get what is inside each saved basket
SELECT  vKartrisTypeVersions.V_Name, vKartrisTypeVersions.V_CodeNumber, tblKartrisBasketValues.BV_Quantity
FROM    tblKartrisBasketValues INNER JOIN vKartrisTypeVersions
ON tblKartrisBasketValues.BV_VersionID = vKartrisTypeVersions.V_ID
WHERE   vKartrisTypeVersions.LANG_ID = @LANG_ID
AND BV_ParentID=@BasketSavedID
AND BV_ParentType='s'

Red colored are same reference; you need to pass the value of the @BasketSavedID  from the first result set; field:SBSKT_ID.
Blue colored @LANG_ID is the language id in which the version name will display.

Hope that will help you.