I have tried adding custom properties as per the AddOrUpdateOrderLine instructions but it does nothing.
I also tried a sp to update the table TeaCommerce_CustomOrderlineProperty but each time I add a product it deletes the previous entries in the table. Duh!
Maybe someone can explain why it is doing this and if it is actually possible to retain data in the table.
Attempt 2 (trying to manually update the TeaCommerce_CustomOrderLineProperty tbl)
Order order = TC.GetCurrentOrder(1); //got my current order
int lastOrderline = order.OrderLines.Count() - 1; //I've got the last orderline number which I want to ensure has the 3 property values
getSize = Request["sizes"].ToString().Trim();//got my size property value
MyProject.OrderModel.dbContextOrderProperties orderProperties = new MyProject.Models.OrderModel.dbContextOrderProperties();
//now call a sp to update the entry with the appropriate value
var updateProperty = orderProperties.Database.ExecuteSqlCommand("sp_updateOrderProperties @alias, @value, @orderlineID ",
new SqlParameter("@alias", "size"),
new SqlParameter("@value", getSize),
new SqlParameter("@orderlineID", order.OrderLines[lastOrderline].Id.ToString()));
Attempt 1 doesn't do anything (the table isn't updated with the appropriate values)
Attempt 2 updates the table with the values but as soon as a new product is added to the basket, the previous orderline values are deleted
NOTE: at the end of the basket/cart process, the property values are added to the TeaCommerce_CustomOrderProperty table but I need to be able to retain and use those properties throughout the process.
Try login into the backoffice of demo.teacommerce.net and see the Product template line 29-33. This is an example of how to do it - and it works. Just tested it at the site. Be sure to go there before midnight as the server resets every night :)
Custom Properties
I have tried adding custom properties as per the AddOrUpdateOrderLine instructions but it does nothing.
I also tried a sp to update the table TeaCommerce_CustomOrderlineProperty but each time I add a product it deletes the previous entries in the table. Duh!
Maybe someone can explain why it is doing this and if it is actually possible to retain data in the table.
thanks
Hi Stephen
What Tea Commerce version? And Umbraco? And have you tried using the HTML API or which API?
Kind regards
Anders
Hi
3.0.3 for Umbraco 7
I am using Umbraco version 7.2.4 assembly: 1.0.5557.19139
and using Razor API
@using TeaCommerce.Umbraco.Web @using TeaCommerce.Api.Models
I don't really want to use the HTML API if possible.
thanks
Do you have some simple code to share?
In the Back Office I have 3 (comma delimited) property aliases: size, colour and productType
Attempt 1
Dictionary
IEnumerable
OrderLine orderLine = TC.AddOrUpdateOrderLine(_StoreId, addToBasketModel.ProductIdentifier, addToBasketModel.Quantity,properties: customproperties,false);
Attempt 2 (trying to manually update the TeaCommerce_CustomOrderLineProperty tbl)
Order order = TC.GetCurrentOrder(1); //got my current order int lastOrderline = order.OrderLines.Count() - 1; //I've got the last orderline number which I want to ensure has the 3 property values
getSize = Request["sizes"].ToString().Trim();//got my size property value
MyProject.OrderModel.dbContextOrderProperties orderProperties = new MyProject.Models.OrderModel.dbContextOrderProperties();
//now call a sp to update the entry with the appropriate value var updateProperty = orderProperties.Database.ExecuteSqlCommand("sp_updateOrderProperties @alias, @value, @orderlineID ", new SqlParameter("@alias", "size"), new SqlParameter("@value", getSize), new SqlParameter("@orderlineID", order.OrderLines[lastOrderline].Id.ToString()));
Attempt 1 doesn't do anything (the table isn't updated with the appropriate values) Attempt 2 updates the table with the values but as soon as a new product is added to the basket, the previous orderline values are deleted
NOTE: at the end of the basket/cart process, the property values are added to the TeaCommerce_CustomOrderProperty table but I need to be able to retain and use those properties throughout the process.
thanks
Try login into the backoffice of demo.teacommerce.net and see the Product template line 29-33. This is an example of how to do it - and it works. Just tested it at the site. Be sure to go there before midnight as the server resets every night :)
ok I'll check it out. thanks
Hi Anders Yup got it working. Many thanks stephen
is working on a reply...