Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Altered Carts - Cash Rewards changes for jQuery 3.4.0

 
Reply
   X-Cart forums > X-Cart 4 > Third Party Add-Ons for X-Cart 4
 
Thread Tools
  #1  
Old 05-14-2019, 04:59 PM
 
elmirage001 elmirage001 is offline
 

X-Wizard
  
Join Date: Apr 2007
Posts: 1,966
 

Default Altered Carts - Cash Rewards changes for jQuery 3.4.0

I'm still using Altered Carts Cash Rewards and I had to make a few changes for it to work with jQuery 3.4.0 on 4.7.11.

In skin/common_files/modules/One_Page_Checkout/ajax.checkout.js the new 3 blocks of code are.


Code:
// Cash Rewards :: www.alteredcart.com // s._applyRewards = function(e) { return !s.applyRewards(this, e); }; s._unsetRewards = function(e) { return !s.unsetRewards(this, e); }; // Cash Rewards :: www.alteredcart.com //

Code:
// Cash Rewards :: www.alteredcart.com // ajax.widgets.checkout.obj.prototype.applyRewards = function(elm){ if (!this.isReady() || !this.checkElement()) { return false; } var container = $('#applyCashRewardsContainer'); var form = $('#applyCashRewardsContainer form'); var s = this; this.totals.block(); return ajax.query.add({ type: 'GET', url: 'cart.php?action=apply_rewards', data: {rewards_amount:$('#available_rewards_text_field').val()}, success: function(a, b, c, d) { for (var i = 0; i < c.messages.length; i++) { if (c.messages[i].name == 'opcUpdateCall' && c.messages[i].params.action) { $('#applyCashRewardsContainer')[0].innerHTML = c.messages[i].params.display; break; } } s._updateTotals(); }, error: function(a, b, c, d) { return s.callback(false, a, b, c, d); } } ) !== false; }; ajax.widgets.checkout.obj.prototype.unsetRewards = function(elm) { if (!this.isReady() || !this.checkElement()) { return false; } var container = $('#applyCashRewardsContainer'); var form = $('#applyCashRewardsContainer form'); var s = this; this.totals.block(); return ajax.query.add({ type: 'GET', url: 'cart.php?action=unset_rewards', data: {}, success: function(a, b, c, d) { s._updateTotals(); }, error: function(a, b, c, d) { return s.callback(false, a, b, c, d); } } ) !== false; }; // Cash Rewards :: www.alteredcart.com //

Code:
// Cash Rewards :: www.alteredcart.com // $(document).on('click','.unsetCashRewards',this._unsetRewards); $(document).on('click','.applyRewardButton',this._applyRewards); // Cash Rewards :: www.alteredcart.com //

The only changes in the first 2 blocks were adding a ; after the last }

The 3rd block used .live with is deprecated ( http://api.jquery.com/live/ ) and I had to change to .on with it's formatting change. It's working for me on my dev 4.7.11 site but use at your own risk as this is way above my pay scale

Paul
__________________
X-Cart GoldPlus v4.7.12 | reBOOT (reDUX) Template v4.7.12.9 | Always The Best
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Third Party Add-Ons for X-Cart 4



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 06:43 PM.

   

 
X-Cart forums © 2001-2020