Announcement

Collapse
No announcement yet.

Coupon Cust Scope

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

    Coupon Cust Scope

    What is coupon custscope? Value is A?

    How can I test for a shipping coupon?
    Last edited by alphabet; 01-09-15, 01:55 PM.
    http://www.alphabetsigns.com/

    #2
    Re: Coupon Cust Scope

    I'm not 100% sure what you mean, can you clarify? Is custscope a custom field?
    Brennan Heyde
    VP Product
    Miva, Inc.
    [email protected]
    https://www.miva.com

    Comment


      #3
      Re: Coupon Cust Scope

      Hi Brennan,
      My purpose is to provide better coupon messaging.

      The s0x_coupon table has a custscope field with value of A. There is also an s0x_CouponAd table that has fields of error messages, example: s0x_CouponAd:freeship and s0x_CouponAd:already.

      I would like the error messaging to be displayed near the coupon redeem button instead of the global:error_messages array typically found above the basket form.

      I implemented an asynchronous coupon redemption that uses jquery to write the error/success message to a div just above the redeem button.

      Here is the example code. I would like to improve the error message controller to provide more robust messaging.

      1. Create a new page ACPN_XHR

      Code:
      <mvt:item name="toolkit" param="headeroutput|Cache-Control|no-cache, must-revalidate" />
      <mvt:item name="toolkit" param="headeroutput|Expires|Wed, 29 Dec 2010 05:00:00 GMT" />
      <mvt:item name="toolkit" param="headeroutput|Content-type|text/HTML" />
          <mvt:if expr="g.error_message_count">
              <mvt:foreach iterator="error_message" array="global:error_messages">
      <mvt:comment>
      
      
      ...
      
      
      Add error message controller here by testing s01_PriceGroups:config, s01_Coupons and s01_CouponsAd
      
      
      ...
      
      
      </mvt:comment>
      
      
              <div class="small text-danger">&mvt:error_message;</div>
              </mvt:foreach>
          <mvt:else>
              <div class="small text-success">Success! Your coupon has been redeemed. Discount will display during Check Out.</div>
          </mvt:if>
      2. Add to Jquery section:

      Code:
      <script type="text/javascript">
          jQuery(document).ready(function($){
      
      ...
      
      $('.basket-coupon').on('click', '#redeem', function(e) {
          e.preventDefault();
          $(this).prop("disabled", true);
          $('.coupon-message').hide();
          $('#loaderImage').show();        
          var form = $(this).closest('form');
          var formData = $(form).serialize();
          $.ajax({
              type: 'POST',
              url: '&mvt:global:sessionurl;Screen=ACPN_XHR',
              data: formData,
              dataType: 'html',
              success: function(data) {
                  $('.coupon-message').empty();
                      $('.coupon-message').html(data);
                      $('#loaderImage').hide();
                      $('.coupon-message').show();
                      $('#redeem').prop('disabled', false);
                  },
              error: function (xhr, status) {
                  alert("Sorry, there was a problem!");
              }
          });
      });
      
      ....
      
      });
      3. Add to javascript section:

      Code:
      <script type="text/javascript">
              function stripSpaces(obj) {
                  var oCoup = obj.value.replace(/\s/g, "");
                  obj.value = oCoup;
                  obj.innerHTML = oCoup;
              }
          </script>


      4. Add to BASK > Basket > Advance Mode

      // merchant to decide position
      // cannot be nested within a form
      // uses Bootstrap 3 style hooks


      Code:
              <div class="row basket-coupon">
                  <div class="col-xs-8 text-right pull-right">
                      <div class="coupon-message"></div>
                      <form method="post" action="&mvte:global:sessionurl;Screen=&mvte:global:Screen;">
                          <input type="hidden" name="Action" value="ACPN" />
                          <input type="hidden" name="Store_Code" value="&mvte:global:Store_Code;" />
                          <span>Coupon Code:</span>
                          <input type="text" name="Coupon_Code" onblur="stripSpaces(this)">
                          <button type="submit" value="Redeem" id="redeem" class="btn btn-primary">Redeem</button>
                      </form>
                      <div id="loaderImage" style="display:none;">
                          <img src="images/ajax-loader.gif" alt="Loading..."/>                    
                      </div>
                  </div>
              </div><!-- end .row -->
          <div class="clearfix"></div>
      I have found users trying to apply the same shipping coupon in the BASK page because they did not get a message that the coupon was redeemed successfully and that the discount will be displayed on the OSEL page. (Coupon may be applied but not yet already used to max count.) I believe my price groups and coupons are configured correctly.

      This may be more of a wish list issue, but a more robust price group error and information message hooks would be helpful.

      Do you know what the custscope field does?
      http://www.alphabetsigns.com/

      Comment

      Working...
      X