Replace add to cart button with "call to order" text

Store UI, layout, design, look and feel; Discussion on the customer facing pages of your online store. Cascading Style Sheets, Themes, Scriptlets, NVelocity and the components in the ConLib directory.
Post Reply
tntmjr
Ensign (ENS)
Ensign (ENS)
Posts: 11
Joined: Tue Jul 01, 2008 3:13 pm
Location: Dirty Jersey
Contact:

Replace add to cart button with "call to order" text

Post by tntmjr » Mon Nov 24, 2008 10:42 am

When disabling purchase on a product it removes the add to cart button - how can i replace the now missing button with some text like "Call to Order"

I found this code but i'm not sure how to tell it to out put text.

private void HideAddToBasket()
{
AddToBasketButton.Visible = false;
AddToWishlistButton.Visible = false;
rowQuantity.Visible = false;

}

private void ShowAddToBasket()
{
AddToBasketButton.Visible = true;
AddToWishlistButton.Visible = true;
rowQuantity.Visible = true;

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Replace add to cart button with "call to order" text

Post by mazhar » Mon Nov 24, 2008 11:04 am

Very easy. Edit the ConLib/BuyProductDialog.ascx file and locate the following line of code

Code: Select all

<asp:LinkButton ID="AddToBasketButton" runat="server" SkinID="Button" Visible="true" OnClick="AddToBasketButton_Click" Text="Add to Basket" EnableViewState="false" ValidationGroup="AddToBasket"></asp:LinkButton>
and make it look like

Code: Select all

<asp:LinkButton ID="AddToBasketButton" runat="server" SkinID="Button" Visible="true" OnClick="AddToBasketButton_Click" Text="Add to Basket" EnableViewState="false" ValidationGroup="AddToBasket"></asp:LinkButton>
                    <asp:Label ID="CallToOrderLabel" runat="server" Text="Call to order" Visible="false"></asp:Label>
Now edit the ConLib/BuyProductDialog.ascx.cs file and in the HideAddToBasket function add the following line of code so it should look like as below

Code: Select all

private void HideAddToBasket()
    {
        AddToBasketButton.Visible = false;
        AddToWishlistButton.Visible = false;
        rowQuantity.Visible = false;
        CallToOrderLabel.Visible = true;
    }

tntmjr
Ensign (ENS)
Ensign (ENS)
Posts: 11
Joined: Tue Jul 01, 2008 3:13 pm
Location: Dirty Jersey
Contact:

Re: Replace add to cart button with "call to order" text

Post by tntmjr » Mon Nov 24, 2008 11:56 am

Thanks for the quick response.

However, the new text shows up all the time and we only want it to appear when there is no button. Am I missing something??

Here is what I have so far:

Code: Select all

<asp:LinkButton ID="AddToBasketButton" runat="server" SkinID="Button" Visible="true" OnClick="AddToBasketButton_Click" Text="Add to Basket" EnableViewState="false" ValidationGroup="AddToBasket"></asp:LinkButton>                    
                    <br />
<span style="color:red; font-weight:bold"> <asp:Label ID="CallToOrderLabel" runat="server" Text="Call To Place Order" Visible="false"></asp:Label></span>
and on the .cs page:

Code: Select all

 private void HideAddToBasket()
    {
        AddToBasketButton.Visible = false;
        AddToWishlistButton.Visible = false;
        rowQuantity.Visible = false;
		CallToOrderLabel.Visible = true;
    }

    private void ShowAddToBasket()
    {
        AddToBasketButton.Visible = true;
        AddToWishlistButton.Visible = true;
        rowQuantity.Visible = true;
    }

tntmjr
Ensign (ENS)
Ensign (ENS)
Posts: 11
Joined: Tue Jul 01, 2008 3:13 pm
Location: Dirty Jersey
Contact:

Re: Replace add to cart button with "call to order" text

Post by tntmjr » Mon Nov 24, 2008 2:14 pm

I found elsewhere in the code the function hideaddtobasket is called again. Which means we have set the visibility of my new CallToOrderLabel in both functions to reinforce it. Here is what I came up with.

On the buyproductdialog.ascx.cs page:

Code: Select all

 private void HideAddToBasket()
    {
      if (_Product.DisablePurchase) {
			CallToOrderLabel.Visible = true;
		}
		AddToBasketButton.Visible = false;
        AddToWishlistButton.Visible = false;
        rowQuantity.Visible = false;
	
    }

    private void ShowAddToBasket()
    {
        CallToOrderLabel.Visible = false;
        AddToBasketButton.Visible = true;
        AddToWishlistButton.Visible = true;
        rowQuantity.Visible = true;
    }
Thanks Again Mazhar for your help!!!

Thanks also go to Misty (AppX/FFG) for setting me straight.


Post Reply