News:

Looking for documentation? Take a look on our wiki

Main Menu

VirtueMart 3.2.14: "class 'CouponHelper' not found"

Started by aka.deton, April 13, 2018, 10:40:27 AM

Previous topic - Next topic

aka.deton

Joomla! 3.8.6
VirtueMart 3.2.14


[message] => Class 'CouponHelper' not found
[file] => components/com_virtuemart/helpers/cart.php
[line] => 1300

Do not forget to add:

if (!class_exists('CouponHelper')) {
require(VMPATH_SITE . DS . 'helpers' . DS . 'coupon.php');
}

in function emptyCartValues?

Milbo

Hmmm, I wonder why it is not already loaded in your case, whatever. I added it.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Gingerweb

I have this error on a new store when using the coupon in the cart.
the above code is present in the file but like this

}

if (!class_exists('CouponHelper')) {
require(VMPATH_SITE . DS . 'helpers' . DS . 'coupon.php');
}

$this->prepareCartData();


How can i stop this from happening please?

hazael


Jörgen

No VM version, no Joomla version etc

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

dslove

Hi!

I'm having the same issue here, using Joomla 3.8.10, VM 3.2.14 and PHP 7.1.
Code in mentioned file/line looks as in the attachment

Should I apply the fix described above?

Thanks,
Alex

GJC Web Design

yes-- try

      if (!class_exists('CouponHelper')) {
         require(VMPATH_SITE. '/helpers/coupon.php');
      }

if your error is  Class 'CouponHelper' not found

GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

dslove

Exact error message is "0 - Class 'CouponHelper' not found",
code now (after fix) looks as attachment below,
problem has not been solved though.

Any ideas?

dslove

Oh, important note: This only happens when I use credit card payment. When I tried coupon checkout with Bank Deposit, no error appeared.

Jörgen

If I am not mistaken You have to load the helper before You use the helper. It does not do any good to load it on the next line.

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

GJC Web Design

had the wrong glasses on!

yes J,  it should be at the start

something like

static public function emptyCartValues(&$cart, $session = true){

//if we used a coupon, we must set it in final use now
$couponCode = '';
if(!empty($cart->couponCode)){
$couponCode = $cart->couponCode;
} else if(!empty($cart->cartData['couponCode'])){
$couponCode = $cart->cartData['couponCode'];
}
if(!empty($cart->couponCode)){
  if (!class_exists('CouponHelper')) {
require(VMPATH_SITE. '/helpers/coupon.php');
  }
CouponHelper::setInUseCoupon($couponCode, true, 1);
}


as Max says -- why doesn't everyone have this problem?
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

dslove

#11
Thank you all, code was rearranged as per GJC's suggestion and issue was resolved.

I have two more VM installations that are identical in setup, they even use the same front end framework and scripts. I can run some tests there too, and let you know if I have the same problem and if any minor differences exist between the websites. Just give me a couple of days, and I'll get back at you on this issue.

Have a great day :)

dslove

Hi all, the problem existed on one of my other vm sites too.

Same Joomla version (3.8.10), same Virtuemart version (3.2.14), same PHP version (7.1), same MySQL version (5.7), hosted on the same server.

As expected, the issue was resolved using the same fix.

The two websites were developed independently (website #2 was built ~10 months before website #1) but are being maintained in the same manner.

GJC Web Design

GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation