Copied to clipboard

Flag this post as spam?

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


  • Matt Bliss 176 posts 234 karma points c-trib
    Dec 21, 2011 @ 13:12
    Matt Bliss
    0

    Adding a new property to an order line

    I'm using the starter kit as a base point an want to add a new property to each orderline for product availability information. This is what I've tried:

    product_product.xslt
    I've added a new hidden field and added it to the 'AddOrderLine' list item

     <input name="prodAvail" type="hidden" value="{call to my own xslt helper}" />
     <input name="AddOrderLine" type="hidden" value="nodeId,quantity,prodAvail" />

    Settings:
    I've added a new property 'productAvail' to the orderline properties in Tea Commerce > Settings > General Setting page:

    cart_step01.xslt
    I try to pick up on the value here but it is blank

      <class="productNumber">
        <xsl:value-of select="'Product Code'" />:
        <xsl:value-of select="properties/productNumber" />
      </p>
      <class="productNumber">
        <xsl:value-of select="'Availability'" />:
        <xsl:value-of select="properties/productAvail" />
      </p>

    Have I missed something, or am I going about it the wrong way?

  • Anders Burla 2560 posts 8256 karma points
    Dec 21, 2011 @ 17:53
    Anders Burla
    0

    Hi Matt

    You are on the right track. You got the part to allow "no javascript" fallback. Now you need to implement the javascript part.

    So if you need to add this property you have to add another javascript call after the addOrderLine method in your javascript. You should call the TeaCommerce.updateOrderLineProperty or TeaCommerce.updateOrderLineProperties

    http://rune.gronkjaer.dk/en-US/2010/11/16/tea-commerce-javascript-api/

    By the way - if you dont have the prodAvail as a property at your product umbraco node you shouldn't have the productAvail in the Order line property aliases. Those specify which properties to copy from the node to the order line.

    Kind regards
    Anders

  • Matt Bliss 176 posts 234 karma points c-trib
    Dec 21, 2011 @ 18:49
    Matt Bliss
    0

    Thanks Anders,

    The form in the product page posts to an aspx page below (obviously for the no JavaScript fallback), but which JavaScript function gets called to override that and in which js file? I'm not quite sure where I should be adding the TeaCommerce.updateOrderLineProperty function call when add to basket is clicked from product_product.xslt.

    <form action="/tcbase/teacommerce/SubmitForm.aspx" method="post">
    

    That makes sense about not including the property in the Order line property aliases. 

    So just to confirm I need to: 

    1. Include a hidden field (as I have done above) doing for JavaScript fallback and
    2. Also call the  TeaCommerce.updateOrderLineProperty function (using the same id as the hidden field) for JavaScript (in the file/function I'm hoping you will point me at!)

    Thanks,
    Matt

     

  • Rune Grønkjær 1372 posts 3103 karma points
    Dec 22, 2011 @ 08:58
    Rune Grønkjær
    0

    Hi Matt,

    You should add the extra information to the orderline in the AddOrderline method in the advanced javascript file. You can either add it as properties in the addOrderline (around line 235 in the standard advanced script) settings as statet here: http://rune.gronkjaer.dk/en-US/2010/11/16/tea-commerce-javascript-api/#addOrderLine

    Otherwise you can make another method call and use the updateOrderLineProperty on the success call in the addOrderline method. Personally I wote for the first option. The fewer server calls the better performance.

    /Rune

Please Sign in or register to post replies

Write your reply to:

Draft