Page 1 of 1

Moving logic from Show Product 1.htm to conlib file

Posted: Wed Apr 02, 2008 5:45 pm
by jmestep
I'm using the tabbed description control that Joe invented to display Reviews, Extended Descriptions, and Customers also bought.
I've got the review panel in there OK by

<%@ Register Src="ProductReviewsPanel.ascx" TagName="ProductReviews" TagPrefix="uc" %>

and
<uc:ProductReviews ID="ProductReviews" runat="server" />

I'm just not sure how to take the logic of whether to display the reviews or not from the Show Product 1.htm and use it to display the reviews. That logic is:
#if($store.Settings.ProductReviewEnabled != "None")
#if($store.Settings.ProductReviewEnabled == "Registered")
#if($customer.IsAnonymous == false)

I've got Joe's control in the Show Product 1.htm, as below, but I can't put the review logic around it because it displays other things in the other two tabs.
<tr><td colspan="2">[[Conlib:Custom/ProductDescriptionTabbed]]</td></tr>

thanks

Re: Moving logic from Show Product 1.htm to conlib file

Posted: Wed Apr 02, 2008 9:31 pm
by AbleMods
I would take it out of the .htm file altogether and include it in the buyproductdialog user control instead.

Then you can just set the .visible property on the product rating control depending on your need.

Re: Moving logic from Show Product 1.htm to conlib file

Posted: Thu Apr 03, 2008 7:58 am
by jmestep
I was thinking about that, but I hadn't figured out how to write the wording for the logic. In the .cs file?

Re: Moving logic from Show Product 1.htm to conlib file

Posted: Thu Apr 03, 2008 9:36 am
by AbleMods
Yeah but you'll have to make changes to both the HTML side and the .cs side of the page.

On the HTML side, I think there's already a reference to a different user control included in BuyProductDialog. Just look at how they're adding it at the top and then referencing it down in the HTML.

Then on the .cs side, you could just set that user controls (id).Visible = False in Page_PreRender if you don't want it displayed on the BuyProductDialog. Obviously based on whatever criteria you want to test for in the code.