I've been using the Starter Kit to develop our ecommerce website, which has been going fairly well. However somewhere during development a problem with the cart has come up.
When I try to add a product to the cart (on the individual product page - product_product.xslt) an error is given:
<![CDATA[
MESSAGE: Exception has been thrown by the target of an invocation. STACKTRACE: at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at TeaCommerce.Presentation.TeaCommerceBase.RequestModule.invokeMethod(restExtension myExtension, Object[] paras) INNEREXCEPTION: System.InvalidOperationException: Nullable object must have a value.
at TeaCommerce.Base.FormAddOrderLine(Dictionary`2 fieldKeyValues)
at TeaCommerce.Base.ParseAction(IDictionary`2 vars)
at TeaCommerce.Base.SubmitForm()
]]>
I've tried adding a product via Javascript in the console and also using the button. I've also tried reverting all of the XSLT file back to the original in the starter kit.
I've seen some other threads with similar issues but the solutions did not work.
Can you replicate the problem from the console? Have you checked alle the parameter data you add to the FormAddOrderLine post? It might be the node id or the quantity that cannot be parsed. My guess is the node id. It should be in an input field in your form.
In the console when I use AddOrderLine function it adds to the cart successfully.
I've reverted back to the starter kit XSLT for that page (product_product.xslt) so I'm using the same form - I can see the correct nodeid on each product in the html. So I'm assuming it's something outside of the xslt that has gone wrong? The variants functionality does not seem to work currently, could this be related? We are following the same format as the starter kit for variants (copied them across).
After looking further I think this is definitely related to the variants - when I copy an entire product and its variants from the original products in the starter kit (Product A1) and paste it into my category, it adds to the cart and the variants functionality works. However when I create my own product under the same category/add variants it does not. The products are using the same Document Type and template.
Thanks for the help - turns out we were using the latest version of Jquery rather than 1.7.1, and so the .live functions used in Teacommerce_advanced.js did not work. Rolled back to the older version and now everything works again.
We dont have a updated advanced script that supports jQuery 1.9. We are using the new starter kit for Tea Commerce 2.0 and that is the one that will be updated from now on.
At the moment we have choosen that there is no upgrade path because there so many changes to the DB and API. Even if we did a upgrade path for the DB then all the API methods has changed so you would need to go change all the method calls anyway. So that is why :)
Error adding product to cart (on product page)
I've been using the Starter Kit to develop our ecommerce website, which has been going fairly well. However somewhere during development a problem with the cart has come up.
When I try to add a product to the cart (on the individual product page - product_product.xslt) an error is given:
I've tried adding a product via Javascript in the console and also using the button. I've also tried reverting all of the XSLT file back to the original in the starter kit.
I've seen some other threads with similar issues but the solutions did not work.
The site is running Umbraco 4.7.2
Any help is much appreciated.
EDIT: I can add a product to the cart via the console using AddOrderLine(productID, quantity).
Hi Matt,
Can you replicate the problem from the console? Have you checked alle the parameter data you add to the FormAddOrderLine post? It might be the node id or the quantity that cannot be parsed. My guess is the node id. It should be in an input field in your form.
/Rune
Hi Rune,
In the console when I use AddOrderLine function it adds to the cart successfully.
I've reverted back to the starter kit XSLT for that page (product_product.xslt) so I'm using the same form - I can see the correct nodeid on each product in the html. So I'm assuming it's something outside of the xslt that has gone wrong? The variants functionality does not seem to work currently, could this be related? We are following the same format as the starter kit for variants (copied them across).
After looking further I think this is definitely related to the variants - when I copy an entire product and its variants from the original products in the starter kit (Product A1) and paste it into my category, it adds to the cart and the variants functionality works. However when I create my own product under the same category/add variants it does not. The products are using the same Document Type and template.
Could you paste your xslt markup.
Just the <form> tag part. Something must be wrong there i think.
Otherwise you could maybe post a link to a test site where we can help debugging it?
/Rune
Hi Rune,
Thanks for the help - turns out we were using the latest version of Jquery rather than 1.7.1, and so the .live functions used in Teacommerce_advanced.js did not work. Rolled back to the older version and now everything works again.
Hi Matt
Could you mark the right answer as a solution? :)
Kind regards
Anders
Alternatively, see http://jquery.com/upgrade-guide/1.9/#live-removed
"To exactly match
$("a.foo").live("click", fn)
, for example, you can write$(document).on("click", "a.foo", fn)
."Anders - do you have an upgraded version of Teacommerce_advanced.js available for the starter kit? I count 13 instances.
Rgds
John P
Hi John
We dont have a updated advanced script that supports jQuery 1.9. We are using the new starter kit for Tea Commerce 2.0 and that is the one that will be updated from now on.
Kind regards
Anders
Thanks Anders. Its an easy fix anyway. Just replace all instances of .live with .on in Teacommerce_advanced.js and it works.
Will there be an upgrade pathway from V1.4.4.4 to V2.0?
Rgds
John P
At the moment we have choosen that there is no upgrade path because there so many changes to the DB and API. Even if we did a upgrade path for the DB then all the API methods has changed so you would need to go change all the method calls anyway. So that is why :)
is working on a reply...