Not sure if this was ever brought up, tried looking for it on forum but found nothing.
Here is an example. Let us say we have Free Shipping on all orders over $99. Is there a way so that let's say the customer adds products to cart that add up to only for $80. When they go to View Cart and do a Estimate Shipping cost and the window pops up with the shipping cost, can is also have a message in that box saying, example... "Only $19.01 to qualify for Free Shipping"
I hope I explained this correctly...
Thank you.
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
While this idea might be an interesting one, in order to develop this kind of information to guests / customers, a discounted field to the payment service provider must also be involved; not only from the store in order for the shipping service provider to consider the reduced price of delivery, once 99.01 and above are counted, with the serviceability quotes. There are shipping service providers requiring the payment's transaction ID (especially in the American continent) and checking the load balancing as well as the quality of the products during service.
The question would, then, become the knowing of the payment service provider you'd be using in order to achieve this request.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
------------------------------------------------------------------------------
CHARGE #1
Title: Free shipping informational message
Group: A
Charge Type: Text (Warning)
Charge Field: You only ${99.01 - [total] to qualify for Free Shipping!
Rule: Total of cart = 0-99.01
------------------------------------------------------------------------------
You can also set up the Free Shipping rate itself in that extension, though you don't have to. Feel free to take a look at the screenshots and demo site, and if you're interested let me know at www.getclearthinking.com/contact if you have any questions.
Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
file 1: catalog/controller/extension/total/shipping.php function quote
after this:
Code: Select all
if ($this->session->data['shipping_methods']) {
$json['shipping_method'] = $this->session->data['shipping_methods'];
} else {
$json['error']['warning'] = sprintf($this->language->get('error_no_shipping'), $this->url->link('information/contact'));
}
add:
Code: Select all
// show gap between cart sub total and global free shipping amount when the gap is half of the total on the shipping estimates popover window
// global free shipping, shipping_free_geo_zone_id equals zero
$freestatus = (!$this->config->get('shipping_free_geo_zone_id') ? true : false);
if ($freestatus) {
$threshold = $this->config->get('shipping_free_total');
$grand_total = $this->cart->getSubTotal();
if ($grand_total >= $threshold) {
$json['msgfreeshipping'] = '';
$json['slider_free_shipping'] = '';
} else {
$gap = $threshold - $grand_total;
$freeshipping_gap = $this->currency->format($gap, $this->session->data['currency']);
// display only if the gap is half the threshold or the amount towards free shipping is rather big.
if ($gap <= $threshold/2) {
$json['msgfreeshipping'] = '<div style="text-align:center;"><i class="fas fa-truck" data-toggle="tooltip" title="Free Shipping"></i>You are only <strong><span>'.$freeshipping_gap.'</span></strong> away from <strong>FREE Shipping</strong> on this order.</div>';
$json['slider_free_shipping'] = '<div><span style="float:left">'.$this->currency->format(1, $this->session->data['currency']).'</span><span style="float:right">'.$this->currency->format($threshold, $this->session->data['currency']).'</span></div><div><input disabled type="range" min="1" max="'.$threshold.'" value="'.$grand_total.'"></div>';
}
}
}
Code: Select all
// is free shipping extension enabled
if ($this->config->get('shipping_free_status')) {
// free shipping for all geo zones
$free_zone_global = (!$this->config->get('shipping_free_geo_zone_id') ? true : false);
if (!$free_zone_global) {
// free shipping for specific geo zone, does this zone belong to that geo zone?
$free_zone = false;
$sql = "SELECT zone_to_geo_zone_id
FROM oc_zone_to_geo_zone
WHERE geo_zone_id = ".(int)$this->config->get('shipping_free_geo_zone_id')."
AND country_id = ".(int)$this->request->post['country_id']."
AND (zone_id = ".(int)$this->request->post['zone_id']." OR zone_id = 0)";
$result = $this->db->query($sql);
if ($result->num_rows) $free_zone = true;
}
// free shipping for all or zone belongs to specific free shipping geo zone
if ($free_zone_global || $free_zone) {
$threshold = $this->config->get('shipping_free_total');
$grand_total = $this->cart->getSubTotal();
if ($grand_total >= $threshold) {
$json['msgfreeshipping'] = '';
$json['slider_free_shipping'] = '';
} else {
$gap = $threshold - $grand_total;
$freeshipping_gap = $this->currency->format($gap, $this->session->data['currency']);
// display only if the gap is half the threshold or the amount towards free shipping is rather big.
if ($gap <= $threshold/2) {
$json['msgfreeshipping'] = '<div style="text-align:center;"><i class="fas fa-truck" data-toggle="tooltip" title="Free Shipping"></i>You are only <strong><span>'.$freeshipping_gap.'</span></strong> away from <strong>FREE Shipping</strong> on this order.</div>';
$json['slider_free_shipping'] = '<div><span style="float:left">'.$this->currency->format(1, $this->session->data['currency']).'</span><span style="float:right">'.$this->currency->format($threshold, $this->session->data['currency']).'</span></div><div><input disabled type="range" min="1" max="'.$threshold.'" value="'.$grand_total.'"></div>';
}
}
}
The html in the messages you can best put in your language files and then use sprintf with the variables, better not put html in your php code.
This only works for global free shipping, if your free shipping is based on a specific geo zone, you need to find the zeo zone which the shipping address belongs to and compare that with the config value but you get the idea as to where these things have to go.
for the display part, message and slider:
file 2: catalog/view/theme/default/template/extension/total/shipping.twig function $('#button-quote').on('click', function()
before:
Code: Select all
for (i in json['shipping_method']) {
Code: Select all
if (json['msgfreeshipping']) {
html += json['msgfreeshipping'];
}
if (json['slider_free_shipping']) {
html += json['slider_free_shipping'];
}
file 3: catalog/view/theme/default/template/extension/total/shipping.php
here you can put the language dependent html with the %s parameters.
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
Users browsing this forum: Google [Bot], Semrush [Bot], Shiftcom and 406 guests