Page 1 of 1

Display SKU on product page

Posted: Mon Jul 27, 2009 7:13 am
by jdarby
Our product page has been customized and no longer displays the product's SKU near the Price/Quantity/Add to Cart buttons. I believe something in BuyProductDialog.ascx needs to be fixed but I can't quite figure it out. Here is the contents of the file as I have it now, any ideas? Thanks.

Code: Select all

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="BuyProductDialog.ascx.cs" Inherits="ConLib_Custom_BuyProductDialog" %>
<%--
<conlib>
<summary>Displays product details and buy now button to add it to cart.</summary>
<param name="ShowSku" default="true">Possible values are true or false.  Indicates whether the SKU will be shown or not.</param>
<param name="ShowPrice" default="true">Possible values are true or false.  Indicates whether the price details will be shown or not.</param>
<param name="ShowSubscription" default="true">Possible values are true or false.  Indicates whether the subscription details will be shown or not.</param>
<param name="ShowMSRP" default="true">Possible values are true or false.  Indicates whether the MSPR will be shown or not.</param>
<param name="ShowPartNumber" default="false">Possible values are true or false.  Indicates whether the Part/Model Number will be shown or not.</param>
</conlib>
--%>
<%@ Register Assembly="CommerceBuilder.Web" Namespace="CommerceBuilder.Web.UI.WebControls" TagPrefix="cb" %>
<%@ Register Src="~/ConLib/Utility/ProductPrice.ascx" TagName="ProductPrice" TagPrefix="uc" %>
<ajax:UpdatePanel ID="BuyProductPanel" runat="server" UpdateMode="Always">
    <ContentTemplate>
        <table class="buyProductForm" cellpadding="0" cellspacing="0">
            <tr id="trSku" runat="server" enableviewstate="false">
                <th class="rowHeader">
                    <asp:Localize ID="SkuLocalize" runat="server" Text="Item #:" EnableViewState="false"></asp:Localize>
                </th>
                <td>
                    <asp:Literal ID="Sku" runat="server"></asp:Literal>
                </td>
            </tr>
            <tr id="trPartNumber" runat="server" enableviewstate="false">
                <th class="rowHeader">
                    <asp:Localize ID="PartNumberLocalize" runat="server" Text="Part #:" EnableViewState="false"></asp:Localize>
                </th>
                <td>
                    <asp:Literal ID="PartNumber" runat="server"></asp:Literal>
                </td>
            </tr>
            <tr id="trRegPrice" runat="server" enableviewstate="false">
                <th class="rowHeader">
                    <asp:Localize ID="RegPriceLocalize" runat="server" Text="Reg. Price:" EnableViewState="false"></asp:Localize> 
                </th>
                <td>
                    <asp:Label ID="RegPrice" runat="server" SkinID="MSRP" EnableViewState="false"></asp:Label>
                </td>
            </tr>

            <tr id="trOurPrice" runat="server" EnableViewState="false">
                <th class="rowHeader" valign="top">
                    <asp:Localize ID="OurPriceLocalize" runat="server" Text="Price:" EnableViewState="false"></asp:Localize>        
                </th>
                <td>
                    <uc:ProductPrice ID="OurPrice" runat="server" />                    
                </td>
            </tr>
            <tr id="trVariablePrice" runat="server" enableviewstate="false">
                <th class="rowHeader">
                    <asp:Localize ID="VariablePriceLabel" runat="server" Text="Enter Price:" EnableViewState="false"></asp:Localize>
                </th>
                <td>
                    <asp:TextBox ID="VariablePrice" runat="server" MaxLength="8" Width="60px" ValidationGroup="AddToBasket"></asp:TextBox>
                    <asp:PlaceHolder ID="phVariablePrice" runat="server"></asp:PlaceHolder>
                </td>
            </tr>
            <tr id="rowSubscription" runat="server" enableviewstate="false">
                <td>&nbsp;</td>
                <td>
                    <asp:Localize ID="RecuringPaymentMessage" runat="server" Text="This item includes a recurring payment." EnableViewState="false"></asp:Localize><br />
                    <asp:Localize ID="InitialPayment" runat="server" Text="Initial Payment: {0:ulc}<br />" EnableViewState="false"></asp:Localize>
                    <asp:Localize ID="RecurringPayment" runat="server" Text="Recurring Payment: {0} payments of {1:ulc}, every {2}." EnableViewState="false"></asp:Localize>
                </td>
            </tr>
			<asp:PlaceHolder runat="server" id="phOptions" EnableViewState="false"></asp:PlaceHolder>
			<asp:PlaceHolder ID="phAddToBasketWarningOpt" runat="server" EnableViewState="false" Visible="false">
			<tr>
				<td>&nbsp;</td>
                <td colspan="8">          
                    <asp:Label ID="AddToBasketWarningOpt" runat="server" EnableViewState="false"  SkinID="ErrorCondition" Text="Please make your selections above."></asp:Label>
                </td>
            </tr>
			</asp:PlaceHolder>
			<asp:PlaceHolder runat="server" id="phKitOptions" EnableViewState="false"></asp:PlaceHolder>
			<asp:PlaceHolder ID="phAddToBasketWarningKit" runat="server" EnableViewState="false" Visible="false">
			<tr>
				<td>&nbsp;</td>
                <td colspan="8">          
                    <asp:Label ID="AddToBasketWarningKit" runat="server" EnableViewState="false"  SkinID="ErrorCondition" Text="Please make your selections above."></asp:Label>
                </td>
            </tr>
			</asp:PlaceHolder>
            <tr id="rowQuantity" runat="server" enableviewstate="false">
                <th class="rowHeader">
                    <asp:Localize ID="QuantityLocalize" runat="server" Text="Quantity:"></asp:Localize>        
                </th>
                <td nowrap>
                    <cb:updowncontrol Width="30" id="Quantity" runat="server" DownImageUrl="~/images/down.gif" UpImageUrl="~/images/up.gif" Columns="2" MaxLength="5" Text='1' MaxValue="32767" onFocus="this.select()"></cb:updowncontrol><asp:CustomValidator ID="QuantityValidaor" runat="server" ValidationGroup="AddToBasket" ErrorMessage="Quantity can not exceed the available stock of {0}." ControlToValidate="Quantity">*</asp:CustomValidator>
                    <asp:PlaceHolder ID="QuantityLimitsPanel" runat="server" EnableViewState="false"></asp:PlaceHolder>
                    </td>
            </tr>
            <tr>
                <td></td>
                <td>
                    <asp:PlaceHolder ID="InventoryDetailsPanel" runat="server" EnableViewState="false"></asp:PlaceHolder>
                </td>
            </tr>
            <tr>
            	<td></td>
                <td>
                    <asp:ValidationSummary ID="ValidationSummary" runat="server" ValidationGroup="AddToBasket" />					
                </td>
            </tr>
            <tr>
            	<td></td>
            	<td class="AddToCart">
                    <asp:LinkButton ID="AddToBasketButton" runat="server" SkinID="Ignore" Visible="true" OnClick="AddToBasketButton_Click" Text="ADD TO CART" EnableViewState="false" ValidationGroup="AddToBasket"></asp:LinkButton>            	
                </td>
            </tr>
            <tr>
            	<td></td>
            	<td>
                    <asp:LinkButton ID="AddToWishlistButton" runat="server" SkinID="Button" Visible="true" OnClick="AddToWishlistButton_Click" Text="ADD TO WISHLIST" EnableViewState="false" ValidationGroup="AddToBasket"></asp:LinkButton>
            	</td>
            </tr>
        </table>
    </ContentTemplate>
</ajax:UpdatePanel>

Re: Display SKU on product page

Posted: Mon Jul 27, 2009 8:27 am
by mazhar
Above ASCX file seems to be good. Check you .CS code file to make sure that it contains following statements as it is

Code: Select all

//HANDLE SKU ROW
            trSku.Visible = (ShowSku && (_Product.Sku != string.Empty));
            if (trSku.Visible)
            {
                Sku.Text = _Product.Sku;
            }
and also when making use of this custom conlib you are not asking it to hide sku as below
[[ConLib:Custom\BuyProductDialog ShowSku="false"]]

Re: Display SKU on product page

Posted: Mon Jul 27, 2009 8:39 am
by jdarby
.CS file was good. The conlib was set as "[[ConLib:Custom/BuyProductDialog]]" so I suppose it is not displaying the SKU by default. I changed it to [[ConLib:Custom/BuyProductDialog ShowSku="True"]] and the SKU pops in. Thanks!

Re: Display SKU on product page

Posted: Mon Jul 27, 2009 8:49 am
by mazhar
Well that wasn't the case with me. I haven't specified ShowSku and its working great. Anyhow sounds good that you are able to solve it.