Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • stephen 83 posts 124 karma points
    Sep 22, 2015 @ 15:06
    stephen
    0

    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

  • Anders Burla 2560 posts 8256 karma points
    Sep 23, 2015 @ 08:25
    Anders Burla
    0

    Hi Stephen

    What Tea Commerce version? And Umbraco? And have you tried using the HTML API or which API?

    Kind regards

    Anders

  • stephen 83 posts 124 karma points
    Sep 23, 2015 @ 15:35
    stephen
    0

    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

  • Anders Burla 2560 posts 8256 karma points
    Sep 24, 2015 @ 06:30
    Anders Burla
    0

    Do you have some simple code to share?

  • stephen 83 posts 124 karma points
    Sep 24, 2015 @ 08:28
    stephen
    0

    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

  • Anders Burla 2560 posts 8256 karma points
    Sep 24, 2015 @ 08:41
    Anders Burla
    0

    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 :)

  • stephen 83 posts 124 karma points
    Sep 24, 2015 @ 09:49
    stephen
    0

    ok I'll check it out. thanks

  • stephen 83 posts 124 karma points
    Sep 24, 2015 @ 10:17
    stephen
    0

    Hi Anders Yup got it working. Many thanks stephen

Please Sign in or register to post replies

Write your reply to:

Draft