Announcement

Collapse
No announcement yet.

On the Invoice page, how can I get the subtotal less coupon discounts?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    On the Invoice page, how can I get the subtotal less coupon discounts?

    I am able to get the order Subtotal, before taxes and shipping. How can I get the total order discount?

    So if the subtotal was $50 and there was a couponcode for 10% off, how could I get the $5 value. Can I iterate through the order items to get the total discounted amount?

    <mvt:foreach iterator="item" array="order:items">
    <mvt:assign name="g.orderDiscount" value="g.orderDiscount + l.settings:item:discount" />
    </mvt:foreach>

    Thank you.

    #2
    You want to do something like that in the item:discounts array
    Code:
                <mvt:foreach iterator="discount" array="item:discounts">
                    <mvt:assign name="g.orderDiscount" value="g.orderDiscount + l.settings:item:discount" />
                </mvt:foreach>
    Bruce Golub
    Phosphor Media - "Your Success is our Business"

    Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
    phosphormedia.com

    Comment


      #3
      Thanks, Bruce, but it didn't produce a value. Did it need to be wrapped in any other array like below? I seen this before.

      <mvt:foreach iterator="item" array="order:groups">
      <mvt:foreach iterator="discount" array="item:discounts"> <mvt:assign name="g.orderDiscount" value="g.orderDiscount + l.settings:item:discount" /> </mvt:foreach>
      </mvt:foreach>

      Comment


        #4
        It would go into the existing foreach loop. You might need to check the variable that actually contains the price value (without the $ sign() as I was just surmising. You can use the Token List option on the invc screen to find it.
        Bruce Golub
        Phosphor Media - "Your Success is our Business"

        Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
        phosphormedia.com

        Comment


          #5
          Thank you again, I tried going to the invc page to edit and I get an error using the tokenlist. Any suggestions?

          Comment


            #6
            i think that means you either have an old payment module with a missing function or mis-match on a payment module id (i.e, an order is calling for a module that doesn't exist)...probably want miva support to take a look as those kind of issue are not good to have laying around.
            Bruce Golub
            Phosphor Media - "Your Success is our Business"

            Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
            phosphormedia.com

            Comment


              #7
              So there is no way to get the complete Order Discount without iterating through each item? If a coupon is used that applies to the whole order (e.g. $10 off) the discount isn't reflected per item.
              I'm just missing this last piece to my tracking script puzzle.

              Comment


                #8
                If you are looking at a price that has been discounted on an individual item through say a price group...that's a different story (and even more complicated). I thought you where just referring to order discounts applied against the whole order. (which would still require looping through the discount array).

                What, pray tell, are you actually trying to achieve (including the why part).

                Sounds like you might need to hire a developer to pull it off rather then spend days trying to work it out on your own.
                Bruce Golub
                Phosphor Media - "Your Success is our Business"

                Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
                phosphormedia.com

                Comment


                  #9
                  Thanks again, Bruce. I am writing a tracking pixel script on the Checkout (Invoice Page) that requires a determination of the subtotal (less taxes and shipping) less order discount. I have the script completed, but I am not able to able to produce that one value. subtotal (less taxes and shipping) less order discount. As I mentioned the Tokenlist has an error so I'm waiting for Miva Support to help resolve. Here is the script. I hope this won't take days... :)


                  <mvt:foreach iterator="item" array="order:items">

                  <mvt:if expr="g.productSKUs">
                  <mvt:assign name="g.productSKUs" value="g.productSKUs $ l.settings:item:code $ ','" />
                  <mvt:else>
                  <mvt:assign name="g.productSKUs" value="l.settings:item:code $ ','" />
                  </mvt:if>

                  <mvt:if expr="g.productQuantities">
                  <mvt:assign name="g.productQuantities" value="g.productQuantities $ l.settings:item:quantity $ ','" />
                  <mvt:else>
                  <mvt:assign name="g.productQuantities" value="l.settings:item:quantity $ ','" />
                  </mvt:if>

                  <mvt:if expr="g.productPrices">
                  <mvt:assign name="g.productPrices" value="g.productPrices $ l.settings:item:price $ ','" />
                  <mvt:else>
                  <mvt:assign name="g.productPrices" value="l.settings:item:price $ ','" />
                  </mvt:if>

                  </mvt:foreach>

                  <img id="_SHRSL_img_1" src="https://shareasale.com/sale.cfm?amount=&mvt:order:formatted_subtotal;&tra cking=&mvt:order:id;&transtype=sale&merchantID=123 45&skulist=&mvt:global:productSKUs;&quantitylist= & mvt:global:productQuantities;&pricelist=&mvt:globa l:productPrices&currency=USD&couponcode=&mvt:coupo n:code;" width="1" height="1">

                  Comment


                    #10
                    I figured it out using the order:coupon array

                    Comment

                    Working...
                    X