catalog\model\extension\total\coupon.php---->public function getTotal
which gets called first.
and I need to retrieve it in
catalog\controller\extension\total\coupon.php--->public function coupon
It didn't work. I also tried to make the variable global by first creating it at the top of model coupon.php but that didn't work either.
How can I achieve what I need, thanks?
v3.0.3.9 php 8.1
I'm here for a reason, if your response is contact a/the developer, just don't reply.
Might be better if you tell us what you're trying to do as it sounds like there will be a better way ...
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
The correct way would depend on where and why you need to set the variable and what you intend to use it for.
Also on another note, by default with OC, regarding coupon notification in case I run into the same type of issue. Based on my default selection, when someone is not signed in a message is passed stating problems with the COUPON, again poor notifications that will confuse a consumer. This should state the person needs to be signed in first. I was planning on passing a true/false variable the same way for this.
v3.0.3.9 php 8.1
I'm here for a reason, if your response is contact a/the developer, just don't reply.
v3.0.3.9 php 8.1
I'm here for a reason, if your response is contact a/the developer, just don't reply.
If I understand you correctly, You need to do your check in the getCoupon function, Not getTotal.
In the coupon controller:
Code: Select all
if ($coupon_info['coupon_message'] != "") {
$json['message'] = $coupon_info['coupon_message'];
$json['info'] = $this->url->link('checkout/cart');
} else {
$this->session->data['success'] = $this->language->get('text_success');
$json['redirect'] = $this->url->link('checkout/cart');
}
Code: Select all
success: function(json) {
$('.alert-dismissible').remove();
if (json['error']) {
$('.container').prepend('<div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> ' + json['error'] + '<button type="button" class="close" data-dismiss="alert">×</button></div>');
$('html, body').animate({ scrollTop: 0 }, 'slow');
}
if (json['info']) {
$('.container').prepend('<div class="alert alert-info alert-dismissible"><i class="fa fa-exclamation-circle"></i> ' + json['message'] + '<button type="button" class="close" data-dismiss="alert">×</button></div>');
location = json['info'];
}
if (json['redirect']) {
location = json['redirect'];
}
},
v3.0.3.9 php 8.1
I'm here for a reason, if your response is contact a/the developer, just don't reply.
Didn't work. Server access logs / Developers Kit results.Joe1234 wrote: ↑Mon Sep 26, 2022 10:34 amI'm setting a "true" variable in
catalog\model\extension\total\coupon.php---->public function getTotal
which gets called first.
and I need to retrieve it in
catalog\controller\extension\total\coupon.php--->public function coupon
It didn't work. I also tried to make the variable global by first creating it at the top of model coupon.php but that didn't work either.
How can I achieve what I need, thanks?
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
The cart template does have a 'attention' alert. So maybe you could use that. If you set a message in the session the same way as the success.
In checkout/cart, change.
Code: Select all
} else {
$data['attention'] = '';
}
Code: Select all
} elseif (isset($this->session->data['message'])) {
$data['attention'] = $this->session->data['message'];
} else {
$data['attention'] = '';
}
v3.0.3.9 php 8.1
I'm here for a reason, if your response is contact a/the developer, just don't reply.
Users browsing this forum: Semrush [Bot] and 465 guests