Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > Dynamic "Add To Cart" button??? View modes: 
User avatar
Member
Member
eagleag - 10/22/2009 3:34:54 AM
   
Dynamic "Add To Cart" button???
Hi,
I;m trying to get a dynamic "Add to cart" button to work.
This is the button code in the transformation:

<uc1:CartItemSelector id="cartItemSelector" runat="server" SKUID='<%# ValidationHelper.GetInteger(Eval("SKUID"), 0) %>' SKUEnabled='<%# ValidationHelper.GetBoolean(Eval("SKUEnabled"), false) %>' ShowProductOptions="false" AddToCartImageButton="add-to-cart-black.png" />


I would like each product to have a different "Add to cart" image.
Example: add-to-cart-black.png, add-to-cart-red.png , add-to-cart-orange.png...
I tried this:

<uc1:CartItemSelector id="cartItemSelector" runat="server" SKUID='<%# ValidationHelper.GetInteger(Eval("SKUID"), 0) %>' SKUEnabled='<%# ValidationHelper.GetBoolean(Eval("SKUEnabled"), false) %>' ShowProductOptions="false" AddToCartImageButton="add-to-cart-<%# HTMLEncode(ResHelper.LocalizeString(Convert.ToString(Eval("SKUName")))) %> .png" />


but i get an error:
[CMSDataProperties.LoadTransformation]: The server tag is not well formed.


How can I make this work?

Thanks :)

User avatar
Kentico Developer
Kentico Developer
kentico_ondrejv - 10/23/2009 9:26:19 AM
   
RE:Dynamic "Add To Cart" button???
Hello,

Could you please try to use single quotes for AddToCartImageButton property instead of double one?

Best Regards
Ondrej Vasil

User avatar
Member
Member
eagleag - 10/28/2009 4:00:52 AM
   
RE:Dynamic "Add To Cart" button???
hi,
Itried simgle quote but getting this erorr:

[CMSDataProperties.LoadTransformation]: http://server/CMSTransformations/fba98c74-847e-4a3a-81f5-a04494dc4086/ecommerce/transformations/ecommerce_productslist.ascx(27): error CS1012: Too many characters in character literal


this is the code I used in transformation:

<img src="/App_Themes/mytheme/Images/ShoppingCart/package_<%# HTMLEncode(ResHelper.LocalizeString(Convert.ToString(Eval('SKUName')))) %>_b.png" border="0"/>


please advise

THANKS

User avatar
Member
Member
eagleag - 10/28/2009 4:06:33 AM
   
got it to work
I just used :

<img src="/App_Themes/mytheme/Images/ShoppingCart/package_<%# Eval("SKUName") %>_b.png"


dpont no why I didnt try that before. :)