Post by amber1 » Mon Aug 29, 2016 7:58 pm

I am getting the following error: TypeError: $ is undefined, when clicking on my coupon button and trying to apply a discount. As I am new to this I was wondering if someone could guide me on how to get the coupon working please? This is the code around it in case that helps. The problem seems to be $.ajax.

jQuery('#button-coupon').on('click', function() {
$.ajax({
url: 'index.php?route=checkout/coupon/coupon',
type: 'post',
data: 'coupon=' + encodeURIComponent($('input[name=\'coupon\']').val()),
dataType: 'json',
beforeSend: function() {
$('#button-coupon').button('loading');
},
complete: function() {
$('#button-coupon').button('reset');
},
success: function(json) {
$('.alert').remove();

if (json['error']) {
$('.breadcrumb').after('<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> ' + json['error'] + '<button type="button" class="close" data-dismiss="alert">&times;</button></div>');

$('html, body').animate({ scrollTop: 0 }, 'slow');
}

if (json['redirect']) {
location = json['redirect'];
}
}
});
});

Newbie

Posts

Joined
Mon Aug 29, 2016 7:42 pm

Post by knowband.plugins » Thu Sep 01, 2016 10:23 pm

It seems to be juery conflict issue with some module.

Could you please share your website URL so that issue can be checked.

Regards,
Knowband Plugins Team

Opencart Plugins: Knowband Store
Email: support@knowband.com


User avatar
Active Member

Posts

Joined
Thu Aug 04, 2016 2:56 pm


Post by amber1 » Fri Sep 02, 2016 7:47 pm

The webpage is http://www.amberco.com.au/cart. Enabled test coupon code is 2222.

Newbie

Posts

Joined
Mon Aug 29, 2016 7:42 pm

Post by knowband.plugins » Fri Sep 02, 2016 9:37 pm

Thank you for sharing your website url, we have checked your website. There is a script error which is causing the issue.

Issue seems to be coming from below file.
http://www.amberco.com.au/catalog/view/ ... _custom.js

Could you please try to rename this file to something else so that it doesn't load and don't cause the issue. If issue does not come after renaming this file, then replace its content with the code given below.

Code: Select all

jQuery('body').scrollspy({target:'.navbar-fixed-top'});jQuery('.navbar-collapse ul li a').click(function(){jQuery('.navbar-toggle:visible').click()});

Regards,
Knowband Plugins Team

Opencart Plugins: Knowband Store
Email: support@knowband.com


User avatar
Active Member

Posts

Joined
Thu Aug 04, 2016 2:56 pm


Post by amber1 » Sat Sep 03, 2016 7:34 pm

I tried to change the file name as you suggested by removing the underscore in riffbeat_custom.js on the catalog page. Unfortunately that didn't work and when I went to alter it back (using http://www.amberco.com.au/catalog -as I had originally done when altering the code in the first place) I'm unable to view the script and I get "The page you requested cannot be found", with an error message of Status Code 404 Not Found. I wonder if you could further assist me to get the catalog page back so I can replace the underscore and then use the alternative script you provided? . My apologies for my ignorance and thanks so much for your time and patience trying to assist me in this matter.

Newbie

Posts

Joined
Mon Aug 29, 2016 7:42 pm

Post by knowband.plugins » Sat Sep 03, 2016 7:41 pm

Your script is still available there, are you using some kind of cache?
http://www.amberco.com.au/catalog/view/ ... _custom.js

Could you please let us know how did you remove _ from riffbear_custom.js file name. Aren't using FTP or cPanel?

Regards,
Knowband Plugins Team

Opencart Plugins: Knowband Store
Email: support@knowband.com


User avatar
Active Member

Posts

Joined
Thu Aug 04, 2016 2:56 pm


Post by amber1 » Sat Sep 03, 2016 7:49 pm

I am not aware of a cache. All I did was type in www.amberco.com.au/catalog and it came up with the program which I edited from there and removed the _ from the script. I didn't use Cpanel - which is probably why I'm having the problems now.

Newbie

Posts

Joined
Mon Aug 29, 2016 7:42 pm

Post by knowband.plugins » Sat Sep 03, 2016 7:54 pm

Which program it loaded for you when you typed http://www.amberco.com.au/catalog/ in the browser URL?

Were you getting whole directory listing and were able to make changes in file name and code?

It is not possible to edit files with front end controller, there are modules that allows you to make changes in server files but they are accessible from admin panel only and makes ftp connection.

We suggest you to rename filenam back using FTP connection.

Regards,
Knowband Plugins Team

Opencart Plugins: Knowband Store
Email: support@knowband.com


User avatar
Active Member

Posts

Joined
Thu Aug 04, 2016 2:56 pm


Post by amber1 » Sat Sep 03, 2016 8:07 pm

I had logged into my admin opencart dashboard, typed in the www.amberco.com.au/catalog. It came up with code. I right clicked on my mouse, selected Inspect Element and changed it there. I will go into my FTP connection and see if I can fix it.

Newbie

Posts

Joined
Mon Aug 29, 2016 7:42 pm

Post by knowband.plugins » Sat Sep 03, 2016 8:12 pm

We see now, you must have visited below url after logged in to admin panel which should have bring you the content of this file.
http://www.amberco.com.au/catalog/view/ ... _custom.js

Please note that with inspect element you can't change code. For that you need either FTP access or CPanel access.


There is no such url in Oencart http://www.website.com.au/catalog until you create set SEO url for some page by yourself.

User avatar
Active Member

Posts

Joined
Thu Aug 04, 2016 2:56 pm


Post by amber1 » Sat Sep 03, 2016 8:55 pm

Thanks for your update. I am pleased I have not caused any problem on my site. I have since gone into CPanel and FTP and changed the riffbeat_custom to riffbeatcustom. The coupon code button still doesn't work by altering the name, so should I now go ahead and add your code?

Newbie

Posts

Joined
Mon Aug 29, 2016 7:42 pm

Post by knowband.plugins » Sat Sep 03, 2016 8:58 pm

Yes, try adding the given code and let us know if it helps.

Regards,
Knowband Plugins Team

Opencart Plugins: Knowband Store
Email: support@knowband.com


User avatar
Active Member

Posts

Joined
Thu Aug 04, 2016 2:56 pm


Post by amber1 » Sat Sep 03, 2016 9:30 pm

Unfortunately no luck with changes made. Coupon button still not working

Newbie

Posts

Joined
Mon Aug 29, 2016 7:42 pm

Post by knowband.plugins » Sat Sep 03, 2016 9:38 pm

We just noticed one more thing that $ is undefined error is coming only on your cart page. This means that there is some module which isbeing loaded only on this page and causing the issue.

Unfortuntely we can't help you further as it required deep debugging but we have suggestion for you. You should try disabling installed module one by one in order to know about culprit module.

DON'T forget to restore changes you have done to riffbear_custom.js file.

Regards,
Knowband Plugins Team

Opencart Plugins: Knowband Store
Email: support@knowband.com


User avatar
Active Member

Posts

Joined
Thu Aug 04, 2016 2:56 pm


Post by amber1 » Sat Sep 03, 2016 9:42 pm

I appreciate all your time, patience and help on this. Looks like I have a big job ahead of me. Thanks for your assistance.

Newbie

Posts

Joined
Mon Aug 29, 2016 7:42 pm
Who is online

Users browsing this forum: No registered users and 2 guests