Forum

The forum is a free service supported by community members. Please consider opening a support ticket if you need timely help.

PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 29 Apr 2024 06:38 PM by  Steve L
Place Order Action Rule and setting SalesOrderDetails data problem.
 3 Replies
Sort:
You are not authorized to post a reply.
Author Messages


New Member


Posts:48
New Member


--
15 Apr 2024 09:31 AM

    I've defined a Place Order Action Rule for my product. I want it o set order status and all sales order detail statuses for following values:

    <xsl:transform version="2.0" xmlns:xsl = "http://www.w3.org/1999/XSL/Transform">
      <xsl:template match="/">
        <out>
            <setData>
               <salesOrder>
                    <status>4</status>
                    <salesPaymentStatus>2</salesPaymentStatus>
                    <shippingStatus>3</shippingStatus> 
                </salesOrder>
            </setData>
            <xsl:for-each select="/in/salesOrder/salesOrderDetails/salesOrderDetail">
                <setData>
                    <salesOrderDetail>
                        <status>4</status>
                           <shippingStatus>3</shippingStatus>
                    </salesOrderDetail>
                </setData>
            </xsl:for-each>
        </out>
      </xsl:template>
    </xsl:transform>

    Setting SalesOrder values works. But for SalesOrderDetails I got following error:

    Message:Object reference not set to an instance of an object.

    StackTrace:

    at Revindex.Business.Revindex.Revindex.Storefront.ProductVariantController.<>c__DisplayClass68_0.<PlaceOrderAction>b__0(SalesOrderDetail sod) at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext() at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source) at Revindex.Business.Revindex.Revindex.Storefront.ProductVariantController.PlaceOrderAction(SalesOrderDetail effectiveSalesOrderDetail, SalesOrder salesOrder, List`1 salesPayments, ProductVariant variant, UserInfo user, String userHostAddress, Int32 portalID)

    Also I wanted to achieve a situation where after invoking Place Order Action Rule and changing SalesOrderStatus to Paid the Issue Rights mechanism will work - but it doesn't.

    0


    Veteran Member


    Posts:2956
    Veteran Member


    --
    26 Apr 2024 02:29 PM

    I believe you're missing the salesOrderDetailID node.

    <xsl:transform version="2.0" xmlns:xsl = "http://www.w3.org/1999/XSL/Transform">
      <xsl:template match="/">
        <out>
            <setData>
               <salesOrder>
                    <status>4</status>
                    <salesPaymentStatus>2</salesPaymentStatus>
                    <shippingStatus>3</shippingStatus> 
                </salesOrder>
            </setData>
            <xsl:for-each select="/in/salesOrder/salesOrderDetails/salesOrderDetail">
                <setData>
                    <salesOrderDetail>
                        <salesOrderDetailID><xsl:value-of select="salesOrderDetailID" /></salesOrderDetailID>
                        <status>4</status>
                           <shippingStatus>3</shippingStatus>
                    </salesOrderDetail>
                </setData>
            </xsl:for-each>
        </out>
      </xsl:template>
    </xsl:transform>

     

    You need to set at least the SalesPaymentStatus to Paid (not SalesOrderStatus) for it to generate the rights.

    I hope this helps.

    1


    New Member


    Posts:48
    New Member


    --
    29 Apr 2024 08:24 AM
    Thanks!

    That solves the problem with exception. Now it works as expected: Statuses of order and order details are set as I wish.
    Is it possible to extend this Action so that after setting proper values for SalesPaymentStatus I can automatically invoke IssueRights on items in an order?
    Process looks someting like this:
    Customer places order for a product which have two downloadable components. For sales order to complete, customer needs to attach document scan (done with Custom Field). Storefront operator manually verifies attached scanned document and invokes 'Place Order Action'. After this, statuses of order and order details are set to completed/paid/shipped AND Issue Rights command is made.
    0


    Veteran Member


    Posts:2956
    Veteran Member


    --
    29 Apr 2024 06:38 PM

    If you're wanting the operator to check certain things, I think they should just go ahead and click on the Issue rights button as part of their operational flow. Currently, it wouldn't be possible to have the Storefront trigger the issuing of the rights after the manual steps the way you described.

     

    0
    You are not authorized to post a reply.