Hi Everyone,
I need help on my opencart site,
I have free shipping and weight based shipping enabled, now,I want the free shipping to disappear or to be inactive when the weight of the cart is equal to or more than 25kg.
your quick response will be appreciated.
Thanks
I need help on my opencart site,
I have free shipping and weight based shipping enabled, now,I want the free shipping to disappear or to be inactive when the weight of the cart is equal to or more than 25kg.
your quick response will be appreciated.
Thanks
Thanks Johnathan, but does 25:0.00 means when the weight is 25, the price should be zero, what i want is this, I want the free shipping option to disappear whenever the weight of the cart is => than 25kg, I want something like this
if ($weight in kg) is >= 25kg {
(free shipping weight display option)= false
}
above is the algorythim, but i need it in pure php ,
Thanks, I know you can help me Jonathan
Your quick response will be appreciated.
if ($weight in kg) is >= 25kg {
(free shipping weight display option)= false
}
above is the algorythim, but i need it in pure php ,
Thanks, I know you can help me Jonathan
Your quick response will be appreciated.
I mean
if ($weight of cart in kg) is >= 25kg {
(free shipping display option)= false
}
above is the algorythim, but i need it in pure php ,
if ($weight of cart in kg) is >= 25kg {
(free shipping display option)= false
}
above is the algorythim, but i need it in pure php ,
Edit catalog/model/shipping/free.php
Find:
Add after:
Find:
Code: Select all
if ($this->cart->getSubTotal() < $this->config->get('free_total')) {
$status = false;
}
Code: Select all
if ( $this->cart->getWeight() >= 25 ) {
$status = false;
}
you mean i should add
if ( $this->cart->getWeight() >= 25 ) {
$status = false;
}
after this code
if ($this->cart->getSubTotal() < $this->config->get('free_total')) {
$status = false;
}
am i right?
if ( $this->cart->getWeight() >= 25 ) {
$status = false;
}
after this code
if ($this->cart->getSubTotal() < $this->config->get('free_total')) {
$status = false;
}
am i right?
<?php
class ModelShippingFree extends Model {
function getQuote($address) {
$this->load->language('shipping/free');
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int)$this->config->get('free_geo_zone_id') . "' AND country_id = '" . (int)$address['country_id'] . "' AND (zone_id = '" . (int)$address['zone_id'] . "' OR zone_id = '0')");
if (!$this->config->get('free_geo_zone_id')) {
$status = true;
} elseif ($query->num_rows) {
$status = true;
} else {
$status = false;
}
if ($this->cart->getSubTotal() < $this->config->get('free_total')) {
$status = false;
}
$method_data = array();
if ($status) {
$quote_data = array();
$quote_data['free'] = array(
'code' => 'free.free',
'title' => $this->language->get('text_description'),
'cost' => 0.00,
'tax_class_id' => 0,
'text' => $this->currency->format(0.00)
);
$method_data = array(
'code' => 'free',
'title' => $this->language->get('text_title'),
'quote' => $quote_data,
'sort_order' => $this->config->get('free_sort_order'),
'error' => false
);
}
return $method_data;
}
}
?>
class ModelShippingFree extends Model {
function getQuote($address) {
$this->load->language('shipping/free');
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int)$this->config->get('free_geo_zone_id') . "' AND country_id = '" . (int)$address['country_id'] . "' AND (zone_id = '" . (int)$address['zone_id'] . "' OR zone_id = '0')");
if (!$this->config->get('free_geo_zone_id')) {
$status = true;
} elseif ($query->num_rows) {
$status = true;
} else {
$status = false;
}
if ($this->cart->getSubTotal() < $this->config->get('free_total')) {
$status = false;
}
$method_data = array();
if ($status) {
$quote_data = array();
$quote_data['free'] = array(
'code' => 'free.free',
'title' => $this->language->get('text_description'),
'cost' => 0.00,
'tax_class_id' => 0,
'text' => $this->currency->format(0.00)
);
$method_data = array(
'code' => 'free',
'title' => $this->language->get('text_title'),
'quote' => $quote_data,
'sort_order' => $this->config->get('free_sort_order'),
'error' => false
);
}
return $method_data;
}
}
?>
No changes made to the file?
Add :
before:
and it works.
Tested with product 24.9 kg - Free shipping available
Tested with product 25 kg - Free shipping not available
Tested with product 27 kg - Free shipping not available
Note: Store settings - Local - Weight Class - Kilogram
Add :
Code: Select all
if ( $this->cart->getWeight() >= 25 ) {
$status = false;
}
Code: Select all
$method_data = array();
Tested with product 24.9 kg - Free shipping available
Tested with product 25 kg - Free shipping not available
Tested with product 27 kg - Free shipping not available
Note: Store settings - Local - Weight Class - Kilogram
<?php
class ModelShippingFree extends Model {
function getQuote($address) {
$this->load->language('shipping/free');
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int)$this->config->get('free_geo_zone_id') . "' AND country_id = '" . (int)$address['country_id'] . "' AND (zone_id = '" . (int)$address['zone_id'] . "' OR zone_id = '0')");
if (!$this->config->get('free_geo_zone_id')) {
$status = true;
} elseif ($query->num_rows) {
$status = true;
} else {
$status = false;
}
if ($this->cart->getSubTotal() < $this->config->get('free_total')) {
$status = false;
}
$method_data = array();
if ( $this->cart->getWeight() >= 25 ) {
$status = false;
}
if ($status) {
$quote_data = array();
$quote_data['free'] = array(
'code' => 'free.free',
'title' => $this->language->get('text_description'),
'cost' => 0.00,
'tax_class_id' => 0,
'text' => $this->currency->format(0.00)
);
$method_data = array(
'code' => 'free',
'title' => $this->language->get('text_title'),
'quote' => $quote_data,
'sort_order' => $this->config->get('free_sort_order'),
'error' => false
);
}
return $method_data;
}
}
?>
is the above correct?
class ModelShippingFree extends Model {
function getQuote($address) {
$this->load->language('shipping/free');
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int)$this->config->get('free_geo_zone_id') . "' AND country_id = '" . (int)$address['country_id'] . "' AND (zone_id = '" . (int)$address['zone_id'] . "' OR zone_id = '0')");
if (!$this->config->get('free_geo_zone_id')) {
$status = true;
} elseif ($query->num_rows) {
$status = true;
} else {
$status = false;
}
if ($this->cart->getSubTotal() < $this->config->get('free_total')) {
$status = false;
}
$method_data = array();
if ( $this->cart->getWeight() >= 25 ) {
$status = false;
}
if ($status) {
$quote_data = array();
$quote_data['free'] = array(
'code' => 'free.free',
'title' => $this->language->get('text_description'),
'cost' => 0.00,
'tax_class_id' => 0,
'text' => $this->currency->format(0.00)
);
$method_data = array(
'code' => 'free',
'title' => $this->language->get('text_title'),
'quote' => $quote_data,
'sort_order' => $this->config->get('free_sort_order'),
'error' => false
);
}
return $method_data;
}
}
?>
is the above correct?
Thanks pprmkr, It works perfectly, Thanks, can you please send me your contact, I have a job for you, send your email address to clementcrownrise@gmail.com..
Thanks one more time
Thanks one more time
Awesome - helps me out too.
One question - is there a way to change the weight text if the weight is over the threshold? I set it for 100 lbs and would like the shipping option in the cart to say "Shipping quote will be provided" or something like that instead of showing the amount.
I'd also like to display something on the product page that says "This item does NOT qualify for free shipping" if it's over that weight. (so okay, 2 questions
)
Thanks.
One question - is there a way to change the weight text if the weight is over the threshold? I set it for 100 lbs and would like the shipping option in the cart to say "Shipping quote will be provided" or something like that instead of showing the amount.
I'd also like to display something on the product page that says "This item does NOT qualify for free shipping" if it's over that weight. (so okay, 2 questions

Thanks.
Running Opencart v3.0.3.9 with multi-stores and the default template from https://www.labeshops.com which has links to all my stores.
Who is online
Users browsing this forum: No registered users and 1 guest