•  914-288-5685
  •   sales@revindex.com
   Search
0
 
  • Register
 
Login
Revindex
  • Products
    • -Comodo PCI Scan
    • -RapidSSL Certificate
    • -RapidSSL Wildcard Certificate
    • -Revindex Generic Skin
    • -Revindex Impersonator
    • -Revindex Omni Skin
    • -Revindex Optimizer
    • -Revindex Polo Skin
    • -Revindex Priority Support
    • -Revindex Storefront
    • -Revindex Storefront Service Plan
    • -Revindex Storefront Source
    • -Revindex Storefront Source Service Plan
    • -Revindex Task Scheduler
    • -Revindex Wiki
    • -Software License Modification
  • Services
    • -Design
    • -Programming
    • -Hosting
    • -Merchant Account
  • Resources
    • -Downloads
    • -Knowledge Base
      • --ASCII Characters
      • --HTML Entities
      • --Revindex Impersonator
      • --Revindex Optimizer
      • --Revindex Storefront
      • --Revindex Task Scheduler
      • --Revindex Wiki
      • --Standard DNN Tokens
    • -Tools
      • --Remote Ping
      • --Unit Converter
      • --URL Encoder Decoder
      • --HTML Encoder Decoder
      • --GUID Generator
    • -Blogs
  • Support
    • -Forum
    • -Frequently Asked Questions
    • -Support Ticket
  • Company
    • -About Us
    • -Customer Portfolio
    • -Customer Reviews
    • -Resellers
  • Free Trial
You are here: Support ⁄ Forum

Forum

The forum is a community resource with lower priority than support tickets. Please consider purchasing priority support credits as we prioritize for paying customers first.

Include as much info (platform, browser, error messages...). To attach a picture, click the Insert Media button and on the Image Manager dialog, select Forums > Attachments folder.

 
ForumForumProduct Discuss...Product Discuss...Revindex Storef...Revindex Storef...Flat discount with couponFlat discount with coupon
Previous Previous
 
Next Next
New Post
 9/27/2018 4:35 PM
 
Coding Strategies
No Ranking

Joined: 8/23/2014
Posts: 54
Flat discount with coupon 
 Modified By Coding Strategies  on 9/27/2018 8:37:14 PM
Hi,

I want to give a $50 discount to anyone with the coupon code I created. The coupon is for anything in the store. However the system is giving the discount based on each item in the cart. I can't use percentage because the prices vary. Here's the custom rule for flat discount with coupon. How do I change the amount to a flat rate of $50? If there is one item in the cart discount $50. if there is more than one item discount $50.

<xsl:transform version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<out>
<discountAmount>
<!-- Coupon code is always tested in lowercase -->
<xsl:if test="in/salesOrder/couponCodes[couponCode = 'free2']" >
<xsl:value-of select="-0.10 * in/this/salesOrderDetail/amount" />
</xsl:if>
</discountAmount>
</out>
</xsl:template>
</xsl:transform>

Please advise,

Kenyatta


 

New Post
 10/10/2018 2:39 PM
 
J T
3rd Level Poster

J T's Avatar

Joined: 3/16/2015
Posts: 364
Re: Flat discount with coupon 

Hi Kenyatta

The Storefront is Avalara certified for tax compliance. In normal accounting practice, a discount needs to be subtracted from something materially sold so that the appropriate tax due can be calculated for each product sold against its net final price after discount. This makes sense for the same reason you can't give a $50 discount if the user buys less than $50 as it will come to a negative total. A easy way is to check the order exceeds $50 subtotal and simply split the $50 discount proportionally to each sales order detail amount relative to the subtotal.

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
  <xsl:template match="/">
    <out>
      <xsl:variable name="SubTotalExclDiscounts" select="sum(in/salesOrder/salesOrderDetails/salesOrderDetail/amount)"/>
      <xsl:if test="in/salesOrder/couponCodes[couponCode = 'free2'] and $SubTotalExclDiscounts &gt; 50">
        <discountAmount>
          <xsl:value-of select="-50 * (/in/this/salesOrderDetail/amount div $SubTotalExclDiscounts)"/>
        </discountAmount>
      </xsl:if>
    </out>
  </xsl:template>
</xsl:transform>



JT

Encourage us so we keep making great software! Tell your friends, link back to us to spread the word...
New Post
 10/11/2018 9:03 AM
 
Coding Strategies
No Ranking

Joined: 8/23/2014
Posts: 54
Re: Flat discount with coupon 

Thank you JT... Works great!

 Page 1 of 1
Previous Previous
 
Next Next
ForumForumProduct Discuss...Product Discuss...Revindex Storef...Revindex Storef...Flat discount with couponFlat discount with coupon

Survey

Do you prefer multiple step or single page checkout mode?


Submit Survey  View Results
Copyright Revindex Inc. : Terms Of Use : Privacy Statement
Copyright Revindex Inc. : Terms Of Use : Privacy Statement