Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Quantity Not Working For ShoppingCartItemSelector View modes: 
User avatar
Member
Member
justin-liquidprint - 10/1/2013 5:22:56 PM
   
Quantity Not Working For ShoppingCartItemSelector
Using the ShoppingCartItemSelector within a transformation. Control is displaying fine with a qty field (textbox) and add to cart button. No matter what the quantity entered, only one of the items gets added to the cart.


<uc1:CartItemSelector
runat="server"
SKUID='<%# ValidationHelper.GetInteger(Eval("SKUID"), 0) %>'
SKUEnabled='<%# ValidationHelper.GetBoolean(Eval("SKUEnabled"), false) %>'
ShowUnitsTextBox="true"
/>

User avatar
Member
Member
justin-liquidprint - 10/2/2013 12:02:40 PM
   
RE:Quantity Not Working For ShoppingCartItemSelector
Any tips on how best to even start debugging this issue?

User avatar
Member
Member
justin-liquidprint - 10/2/2013 2:42:43 PM
   
RE:Quantity Not Working For ShoppingCartItemSelector
Narrowed this down a bit, seems to be the txtUnits variable is not being set properly. This property is defaulting to the DefaultQuantity. Still not sure how to debug what's coming through though given this is all happening in an AJAX Update Panel.


public int Quantity
{
get
{
if (ShowUnitsTextBox)
{
return ValidationHelper.GetInteger(txtUnits.Text.Trim(), DefaultQuantity);
}
else
{
return DefaultQuantity;
}
}
}

User avatar
Member
Member
justin-liquidprint - 10/2/2013 3:02:17 PM
   
RE:Quantity Not Working For ShoppingCartItemSelector
Outputting what is coming through to the txtUnits.Text.Trim() value and it's set to "1,(txtUnits value)". Seems like it's appending the submitted value to the one previous.

User avatar
Member
Member
justin-liquidprint - 10/2/2013 3:39:11 PM
   
RE:Quantity Not Working For ShoppingCartItemSelector
It's hacky and I'm not proud of it, but this is my fix and it seems to be working. If anyone knows the root cause of why the textbox submitted value is coming back as n,n.....,n, I'm all ears.


/// <summary>
/// Quantity of the specified product to add to the shopping cart.
/// </summary>
public int Quantity
{
get
{
if (ShowUnitsTextBox)
{
string units = txtUnits.Text.Trim();
units = units.Substring(units.LastIndexOf(",") + 1);

//ScriptManager.RegisterStartupScript(upnlAjax, this.GetType(), "redirectMe", "alert('" + units + "');", true);
return ValidationHelper.GetInteger(units, DefaultQuantity);
}
else
{
return DefaultQuantity;
}
}
}

User avatar
Certified Developer 13
Certified Developer 13
kentico_josefd - 10/4/2013 7:14:24 PM
   
RE:Quantity Not Working For ShoppingCartItemSelector
Hello Justin,

I tested your code in the Sample Corporate site product selected item transformation and it appears to be working correctly with the latest Kentico version and hotfix (.55). Can you try installing the latest hotfix and testing if the issue persists?

Also, can you try using your exact code on a product repeater of the Sample Corporate site to see if it behaves any differently?

Regards,

Josef Dvorak