tcbase is the Tea Commerce version of umbraco base. Long story short, we had to create our own to get it working in the very first version of Tea Commerce.
tcbase is also the server API that the Tea Commerce javascript ajax calls to fetch or manipulate data. Furthermore we also use it for our no javascript fallback. That is what you're looking at above.
In general it works by posting the form to the /tcbase/teacommerce/SubmitForm.aspx url along with a bunch of data. The data is added with normal html form fields. In the case of the plus and minus buttons a form can look something like this:
The AddOrderLine field tells Tea Commerce that you want to do an AddOrderLine command. It's value contains information about what other fields and in what order should be used in the command. The order should be the same as in the javascript API.
That all makes sense - however I seem to have come across a problem!
I am using .Net Master Pages and the master template has a form which is "runat=server". This seems to be causing a problem - having other forms within the mater template form.
Can I do what "/tcbase/teacommerce/SubmitForm.aspx" does via the .Net API? (i.e. in code-behind)
When using .NET master templates with a runat=server form tag you cannot use the normal fallback method. you will have to do the same thing yourself.
You can do that by either by manipulating the order directly. Or you can do it with the TeaCommerce.Base API, which contains all the static methods used by the javascript and fallback methods.
This became more difficult than I anticipated - you can't (?) put .Net controls in XSLT, I tried putting an HTML control with runat=server and a function in the "cartStep" master template - but couldn't get the two to link / fire.
First of all, it pointed out that I needed to alter the "removeOrderLine" function in teaCommerce_Advanced.js to make it use "TeaCommerce.removeUniqueOrderLine" rather than "TeaCommerce.removeOrderLine".
Secondly, I removed the "form" tags so that they did not clash with the ASP.Net form I have in my master template.
So, the delete function now works ... 90% ... I just need to make it properly update the page to show that a line has been deleted (update the page level basket summary, and refresh the page and show "cart empty" if necessary).
What or where is tcbase?
In your demo site, the + and - buttons around the item quantity, in the basket, have the following form defined:
<form action="/tcbase/teacommerce/SubmitForm.aspx" method="post">
What or where is tcbase?
Hi Gordon,
tcbase is the Tea Commerce version of umbraco base. Long story short, we had to create our own to get it working in the very first version of Tea Commerce.
tcbase is also the server API that the Tea Commerce javascript ajax calls to fetch or manipulate data. Furthermore we also use it for our no javascript fallback. That is what you're looking at above.
In general it works by posting the form to the /tcbase/teacommerce/SubmitForm.aspx url along with a bunch of data. The data is added with normal html form fields. In the case of the plus and minus buttons a form can look something like this:
<form action="/tcbase/teacommerce/SubmitForm.aspx" method="post">
<input name="AddOrderLine" type="hidden" value="nodeId,quantity" />
<input name="nodeId" type="hidden" value="{@nodeId}" />
<input name="quantity" type="hidden" value="1" />
<input type="submit" value="+" class="plus" />
</form>
The AddOrderLine field tells Tea Commerce that you want to do an AddOrderLine command. It's value contains information about what other fields and in what order should be used in the command. The order should be the same as in the javascript API.
Does that make sense?
/Rune
That all makes sense - however I seem to have come across a problem!
I am using .Net Master Pages and the master template has a form which is "runat=server". This seems to be causing a problem - having other forms within the mater template form.
Can I do what "/tcbase/teacommerce/SubmitForm.aspx" does via the .Net API? (i.e. in code-behind)
Hi Gordon,
When using .NET master templates with a runat=server form tag you cannot use the normal fallback method. you will have to do the same thing yourself.
You can do that by either by manipulating the order directly. Or you can do it with the TeaCommerce.Base API, which contains all the static methods used by the javascript and fallback methods.
/Rune
Ah - TeaCommerce.Base ... I'll give that a go :-)
This became more difficult than I anticipated - you can't (?) put .Net controls in XSLT, I tried putting an HTML control with runat=server and a function in the "cartStep" master template - but couldn't get the two to link / fire.
Eventually, I came across this post http://our.umbraco.org/projects/website-utilities/tea-commerce/tea-commerce-support/22047-Am-I-using-CreateUniqueOrderLine-correctly
First of all, it pointed out that I needed to alter the "removeOrderLine" function in teaCommerce_Advanced.js to make it use "TeaCommerce.removeUniqueOrderLine" rather than "TeaCommerce.removeOrderLine".
Secondly, I removed the "form" tags so that they did not clash with the ASP.Net form I have in my master template.
So, the delete function now works ... 90% ... I just need to make it properly update the page to show that a line has been deleted (update the page level basket summary, and refresh the page and show "cart empty" if necessary).
Well, I think that is a step forward!!! :-)
Ah. I didn't know you where using the javascript API after all. Nice. Well you're well on your way now.
/Rune
is working on a reply...