Good Morning all,
I am currently using Joels modification from this thread viewtopic.php?t=50670
I have tested it, and it seems to do what I need, but am looking for a little addition to this mod, I would like a "free shipping" image pinned to the image of the products with a weight of zero if this is possible...
Alternatively a modification to this mod, so that we can use the following:
if weight = 0, the cart disables all shipping details and forces free shipping
if weight = 1, the item can be a downloadable
if weight = 2, then a set rate shipping will be forced
not sure if this can be done, as my understanding is that all 3 weight options are basically the same code and only one set of codes can be used at a time.
I am not very familiar with the coding although I was able to follow the instruction Joel gave. I would love for some coders to create a uploadable file\vqmod if the above is doable...
TIA
Paul
I am currently using Joels modification from this thread viewtopic.php?t=50670
I have tested it, and it seems to do what I need, but am looking for a little addition to this mod, I would like a "free shipping" image pinned to the image of the products with a weight of zero if this is possible...
Alternatively a modification to this mod, so that we can use the following:
if weight = 0, the cart disables all shipping details and forces free shipping
if weight = 1, the item can be a downloadable
if weight = 2, then a set rate shipping will be forced
not sure if this can be done, as my understanding is that all 3 weight options are basically the same code and only one set of codes can be used at a time.
I am not very familiar with the coding although I was able to follow the instruction Joel gave. I would love for some coders to create a uploadable file\vqmod if the above is doable...
TIA
Paul
I am not entirely sure if the following is what you'd be looking for but I have tweaked the catalog/model/extension/shipping/weight.php file for v3.x releases in order to calculate the weight as mentioned:
Afterwards, not to forget to apply these steps: viewtopic.php?f=176&p=725084#p718325
Code: Select all
<?php
class ModelExtensionShippingWeight extends Model {
public function getQuote($address) {
$this->load->language('extension/shipping/weight');
$quote_data = array();
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "geo_zone ORDER BY name");
$weight = $this->cart->getWeight();
$products = $this->cart->getProducts();
if ((float)$weight == 0) {
$status = false;
} elseif ((float)$weight >= 1 && (float)$weight < 2) {
if ($this->cart->hasDownload()) {
$statuses = array();
foreach ($products as $product) {
if (!empty($product['download'])) {
$statuses[] = true;
}
}
if (in_array(true, $statuses)) {
$status = true;
}
}
} elseif ((float)$weight >= 2 && (float)$weight < 3) {
foreach ($query->rows as $result) {
if ($this->config->get('shipping_weight_' . $result['geo_zone_id'] . '_status')) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int)$result['geo_zone_id'] . "' AND country_id = '" . (int)$address['country_id'] . "' AND (zone_id = '" . (int)$address['zone_id'] . "' OR zone_id = '0')");
if ($query->num_rows) {
$status = true;
} else {
$status = false;
}
} else {
$status = false;
}
if ($status) {
$cost = '';
$rates = explode(',', $this->config->get('shipping_weight_' . $result['geo_zone_id'] . '_rate'));
foreach ($rates as $rate) {
$data = explode(':', $rate);
if ($data[0] >= $weight) {
if (isset($data[1])) {
$cost = $data[1];
}
break;
}
}
if ((string)$cost != '') {
$quote_data['weight_' . $result['geo_zone_id']] = array(
'code' => 'weight.weight_' . $result['geo_zone_id'],
'title' => $result['name'] . ' (' . $this->language->get('text_weight') . ' ' . $this->weight->format($weight, $this->config->get('config_weight_class_id')) . ')',
'cost' => $cost,
'tax_class_id' => $this->config->get('shipping_weight_tax_class_id'),
'text' => $this->currency->format($this->tax->calculate($cost, $this->config->get('shipping_weight_tax_class_id'), $this->config->get('config_tax')), $this->session->data['currency'])
);
}
}
}
}
$method_data = array();
if ($quote_data) {
$method_data = array(
'code' => 'weight',
'title' => $this->language->get('text_title'),
'quote' => $quote_data,
'sort_order' => $this->config->get('shipping_weight_sort_order'),
'error' => false
);
}
return $method_data;
}
}
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Thanks for the reply Straightlight,
Could you please explain what this code does, I tried reading it, but there isnt anything in there about pointing to an image for the free shipping tag to be placed on the images set to a 0 weight. Pardon my understanding, I am new to this, but do have a limited ability to read the code... Unless Im missing it completely.
I do already have the coding done for applying the free shipping to a cart weight of 0...
Edit:
Ok, I think I see the area where you made provision with the 3 options that I requested, please confirm if my understanding is correct...
Could you please explain what this code does, I tried reading it, but there isnt anything in there about pointing to an image for the free shipping tag to be placed on the images set to a 0 weight. Pardon my understanding, I am new to this, but do have a limited ability to read the code... Unless Im missing it completely.
I do already have the coding done for applying the free shipping to a cart weight of 0...
Edit:
Ok, I think I see the area where you made provision with the 3 options that I requested, please confirm if my understanding is correct...
Take note that Joel's code is based on the handling.php model file which no longer exists in newer OC versions.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Ok, I see that now, am I correct to say that this is the shipping calculation on the cart subtotal?
Im currently using OC 3.0.2.0. I have tested the mod using Product 1 @ Free at 0 weight and Product 2 @ R2.00 at 1 weight
Product one skips shipping details and forces free shipping, as soon as you add product 2 it adds the flat rate. Are you saying that Joel's mod could still add shipping if the subtotal increases over a certain amount even though the weight is set at 0
Im currently using OC 3.0.2.0. I have tested the mod using Product 1 @ Free at 0 weight and Product 2 @ R2.00 at 1 weight
Product one skips shipping details and forces free shipping, as soon as you add product 2 it adds the flat rate. Are you saying that Joel's mod could still add shipping if the subtotal increases over a certain amount even though the weight is set at 0
Nowhere to be said. It is rather mentioned from my previous reply that the handling shipping model file is no longer available in the newer OC versions. In other words, other than using a possible extension or by custom job, his codes are no longer supported.Are you saying that Joel's mod could still add shipping if the subtotal increases over a certain amount even though the weight is set at 0
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Who is online
Users browsing this forum: No registered users and 25 guests