admin
-
1/13/2006 2:45:59 PM
Re: Shopping Cart - DataItem.ComProductID
Hi Jeremy,
Thank you for this question. You're right that those two tables (COM_Product and CMS_Product) are not a very good example. We will improve it in Kentico CMS 2.0.
Here's what you can do now:
1) Modify the View_CMS_Tree_Joined view like this:
SELECT dbo.CMS_Tree.NodeID, dbo.CMS_Tree.IDPath, dbo.CMS_Tree.AliasPath, dbo.CMS_Tree.NamePath, dbo.CMS_Tree.NodeName, dbo.CMS_Tree.NodeAlias, dbo.CMS_Tree.ModifiedWhen, dbo.CMS_Tree.ModifiedByUserID, dbo.CMS_Tree.ClassID, dbo.CMS_Tree.ParentNodeID, dbo.CMS_Tree.NodeLevel, dbo.CMS_Tree.ForeignKeyValue, dbo.CMS_Tree.CreatedByUserID, dbo.CMS_Tree.CreatedWhen, dbo.CMS_Tree.OwnerUserID, dbo.CMS_Tree.CheckedOutByUserID, dbo.CMS_Tree.CheckedOutWhen, dbo.CMS_Tree.CheckedOutVersionHistoryID, dbo.CMS_Tree.PublishedVersionHistoryID, dbo.CMS_Tree.WorkflowStepID, dbo.CMS_Tree.PublishFrom, dbo.CMS_Tree.PublishTo, dbo.CMS_Tree.ACLID, dbo.CMS_Tree.UrlPath, dbo.CMS_Tree.ComProductID, dbo.CMS_Class.ClassName, dbo.CMS_Class.ClassDisplayName, dbo.CMS_User.UserName, dbo.CMS_User.FullName, OWNER.UserName AS OwnerUserName, OWNER.FullName AS OwnerFullName, CREATOR.UserName AS CreatorUserName, CREATOR.FullName AS CreatorFullName, CHECKEDOUT.UserName AS CheckedOutByUserName, CHECKEDOUT.FullName AS CheckedOutByFullName, CASE WHEN ((checkedoutversionhistoryid IS NULL AND publishedversionhistoryid IS NULL) OR (checkedoutversionhistoryid IS NOT NULL AND publishedversionhistoryid IS NOT NULL)) AND (publishfrom IS NULL OR (publishfrom IS NOT NULL AND publishfrom <= getdate())) AND (publishto IS NULL OR (publishto IS NOT NULL AND publishto >= getdate())) THEN 1 ELSE 0 END AS Published, dbo.COM_Product.ProductName AS COM_ProductName, dbo.COM_Product.ProductPrice AS COM_ProductPrice, dbo.COM_Product.ProductCode AS COM_ProductCode, dbo.COM_Product.ProductVatRate AS COM_ProductVatRate, dbo.COM_Product.ProductIsActive AS COM_ProductIsActive FROM dbo.CMS_Tree LEFT OUTER JOIN dbo.CMS_Class ON dbo.CMS_Class.ClassID = dbo.CMS_Tree.ClassID LEFT OUTER JOIN dbo.CMS_User ON dbo.CMS_User.UserID = dbo.CMS_Tree.ModifiedByUserID LEFT OUTER JOIN dbo.CMS_User AS OWNER ON OWNER.UserID = dbo.CMS_Tree.OwnerUserID LEFT OUTER JOIN dbo.CMS_User AS CREATOR ON CREATOR.UserID = dbo.CMS_Tree.CreatedByUserID LEFT OUTER JOIN dbo.CMS_User AS CHECKEDOUT ON CHECKEDOUT.UserID = dbo.CMS_Tree.CheckedOutByUserID LEFT OUTER JOIN dbo.COM_Product ON dbo.COM_Product.ProductID = dbo.CMS_Tree.ComProductID
2) Now you can use the following expression to display the price from the COM_Product table:
<%# DataBinder.Eval(Container, "DataItem.COM_ProductPrice") %>
Please let me know if you need any additional details.
Best Regards,
|