Need product template assistance.

For general questions and discussions specific to the AbleCommerce GOLD ASP.Net shopping cart software.
Post Reply
KenPalmer
Lieutenant (LT)
Lieutenant (LT)
Posts: 54
Joined: Fri Sep 21, 2012 9:50 am

Need product template assistance.

Post by KenPalmer » Tue Sep 25, 2012 3:50 pm

I'm creating a product template to display Books and CDs with additional pricing information that doesn't appear in the standard template. I've named the template "Alumni Books", and have added 3 new merchant fields:
* Gold Seal Price
* Retail Price
* Alumni Price

When viewing the product from the store's product description page, information that I entered in those merchant fields shows up, but it appears at the bottom of the page below the product description. My client would like those values to appear beside the product image, above the Quantity control and the "Add To Cart" and "Add to Wishlist" buttons.

Also, I need to change the "Our Price" label appearing on that page to read "Alumni Price". So I may be able to delete that last merchant field. But do need it to have the label "Alumni Price" when the "Alumni Books" template is selected.

I found the product template instructions at this link, but didn't see anything describing how I can move the displayed merchant fields around in the displayed product page.
http://help.ablecommerce.com/mergedProj ... mplate.htm

The client previously had this done in Able Commerce 5.5, so I imagine it can be done with Able Commerce Gold as well. I just need some guidance on how to achieve that. Thanks for your help.

User avatar
david-ebt
Captain (CAPT)
Captain (CAPT)
Posts: 253
Joined: Fri Dec 31, 2010 10:12 am

Re: Need product template assistance.

Post by david-ebt » Tue Sep 25, 2012 5:37 pm

Ken,

Take a look at the Conlib\ProductDescription.ascx control. At the bottom of that control it displays another user control which displays the product template fields and product custom fields.

Code: Select all

<div class="customFieldsWrapper">
    <uc:CustomFields ID="CustomFields" runat="server" />
</div>
It is using the Conlib\ProductCustomerFieldsDialog.ascx control. You should be able to move that around or put it inside another control.
David
http://www.ecombuildertoday.com
Enhanced Reporting for AbleCommerce
Image

KenPalmer
Lieutenant (LT)
Lieutenant (LT)
Posts: 54
Joined: Fri Sep 21, 2012 9:50 am

Re: Need product template assistance.

Post by KenPalmer » Wed Sep 26, 2012 12:06 pm

Thanks for your guidance David. I was able to take code from ProductCustomerFieldsDialog.ascx, and put that in BuyProductDialog.ascx. Here is part of what I did.

Put this in BuyProductDialog.ascx.

Code: Select all

<table class="buyProductForm">
	<asp:ListView ID="ProductTemplateFieldRows" runat="server" enableviewstate="false">
		<ItemTemplate>
			<tr>
				<th class="rowHeader"><%#Eval("InputField.Name")%></th>
				<td><%#Eval("InputValue")%></td>
			</tr>
		</ItemTemplate>
	</asp:ListView>
	<asp:ListView ID="ProductCustomFieldRows" runat="server" enableviewstate="false">
		<ItemTemplate>
			<tr>
				<th class="rowHeader"><%#Eval("InputField.Name")%></th>
				<td><%#Eval("InputValue")%></td>
			</tr>
		</ItemTemplate>
	</asp:ListView>
Put this in the code behind of BuyProductDialog.ascx.

Code: Select all

private void fillProductCustomRows(Product product)
{
	// Called from Page_Init() within "if (_Product != null)" clause.
	if (product != null)
	{
	List<ProductCustomField> customFields = (from cf in _Product.CustomFields
											 where !string.IsNullOrEmpty(cf.FieldValue)
											 select cf).ToList();
	ProductCustomFieldRows.DataSource = customFields;
	ProductCustomFieldRows.DataBind();
	}
}

private void fillProductTemplateRows(Product product)
{
	// Called from Page_Init() within "if (_Product != null)" clause.
	if (product != null)
	{
	List<ProductTemplateField> templateFields = (from tf in _Product.TemplateFields
												 where !string.IsNullOrEmpty(tf.InputValue) && tf.InputField.IsMerchantField
												 select tf).ToList();
	ProductTemplateFieldRows.DataSource = templateFields;
	ProductTemplateFieldRows.DataBind();
	}
}
That was pretty straightforward. The web code in this solution is clean and easy to read. A couple of using statements were required for the above as well. I also created a ProductDescription2.ascx control, similar to its original namesake, but lacking the CustomFields control. Then replaced references to ProductDescription.ascx with the new version 2 of this control.

User avatar
david-ebt
Captain (CAPT)
Captain (CAPT)
Posts: 253
Joined: Fri Dec 31, 2010 10:12 am

Re: Need product template assistance.

Post by david-ebt » Wed Sep 26, 2012 12:39 pm

Looks good Ken!

Thanks for posting your solution.
David
http://www.ecombuildertoday.com
Enhanced Reporting for AbleCommerce
Image

Post Reply