Skip to content

Instantly share code, notes, and snippets.

@creitve
Created December 21, 2015 13:11
Show Gist options
  • Save creitve/3b4949158ad0b87b1f4b to your computer and use it in GitHub Desktop.
Save creitve/3b4949158ad0b87b1f4b to your computer and use it in GitHub Desktop.
diff --git a/app/controllers/backend/shippings.php b/app/controllers/backend/shippings.php
index d9a7503..ddd4c73 100644
--- a/app/controllers/backend/shippings.php
+++ b/app/controllers/backend/shippings.php
@@ -74,7 +74,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (!empty($shipping_data['service_id']) && !empty($_REQUEST['shipping_id'])) {
// Set package information (weight is only needed)
$weight = floatval($shipping_data['test_weight']);
- $weight = !empty($weight) ? sprintf("%.2f", $weight) : '0.01';
+ $weight = !empty($weight) ? sprintf("%.3f", $weight) : '0.001';
$package_info = array(
'W' => $weight,
diff --git a/app/functions/fn.cart.php b/app/functions/fn.cart.php
index 2704390..08e9c28 100644
--- a/app/functions/fn.cart.php
+++ b/app/functions/fn.cart.php
@@ -3399,7 +3399,7 @@ function fn_get_products_weight($cart, $cart_products, $type = 'S')
}
}
- return !empty($weight) ? sprintf("%.2f", $weight) : '0.01';
+ return !empty($weight) ? sprintf("%.3f", $weight) : '0.001';
}
/**
diff --git a/app/Tygh/Shippings/Shippings.php b/app/Tygh/Shippings/Shippings.php
index 71fb87e..61dea7c 100644
--- a/app/Tygh/Shippings/Shippings.php
+++ b/app/Tygh/Shippings/Shippings.php
@@ -181,7 +181,7 @@ class Shippings
}
}
- $package_info['W'] = !empty($package_info['W']) ? sprintf("%.2f", $package_info['W']) : '0.01';
+ $package_info['W'] = !empty($package_info['W']) ? sprintf("%.3f", $package_info['W']) : '0.001';
$package_groups = array(
'personal' => array(),
@@ -418,8 +418,8 @@ class Shippings
$condition .= db_quote('?:shippings.status = ?s', 'A');
$condition .= db_quote(' AND ?:shippings.shipping_id IN (?n)', $shippings);
- $condition .= db_quote(' AND (?:shippings.min_weight <= ?d', $package_weight);
- $condition .= db_quote(' AND (?:shippings.max_weight >= ?d OR ?:shippings.max_weight = 0.00))', $package_weight);
+ $condition .= db_quote(' AND (?:shippings.min_weight <= ?i', $package_weight);
+ $condition .= db_quote(' AND (?:shippings.max_weight >= ?i OR ?:shippings.max_weight = 0.00))', $package_weight);
$condition .= db_quote(' AND ?:shipping_descriptions.lang_code = ?s', $lang);
if ($area == 'C') {
diff --git a/design/backend/templates/views/shippings/components/rates.tpl b/design/backend/templates/views/shippings/components/rates.tpl
index 0baf7e8..ae25360 100644
--- a/design/backend/templates/views/shippings/components/rates.tpl
+++ b/design/backend/templates/views/shippings/components/rates.tpl
@@ -140,7 +140,7 @@
{if $smarty.foreach.rdf.first}
<input type="hidden" name="shipping_data[rates][{$destination_id}][rate_value][W][0][amount]" value="0" />&nbsp;&nbsp;0 {$settings.General.weight_symbol}
{else}
- <input type="text" name="shipping_data[rates][{$destination_id}][rate_value][W][{$k}][amount]" data-p-sign="s" data-a-sign=" {$settings.General.weight_symbol nofilter}" size="5" value="{$k}" class="cm-numeric input-small input-hidden" />
+ <input type="text" name="shipping_data[rates][{$destination_id}][rate_value][W][{$k}][amount]" data-p-sign="s" data-v-min="0.000" data-a-sign=" {$settings.General.weight_symbol nofilter}" size="5" value="{$k}" class="cm-numeric input-small input-hidden" />
{/if}
</td>
@@ -182,7 +182,7 @@
<td>
<input type="checkbox" disabled="disabled" value="Y" class="checkbox cm-item-weight cm-item" /></td>
<td>
- {__("more_than")}&nbsp; <input type="text" name="shipping_data[add_rates][{$destination_id}][rate_value][W][0][amount]" data-p-sign="s" data-a-sign=" {$settings.General.weight_symbol nofilter}" size="5" value="" class="cm-numeric input-small input-hidden" /></td>
+ {__("more_than")}&nbsp; <input type="text" name="shipping_data[add_rates][{$destination_id}][rate_value][W][0][amount]" data-p-sign="s" data-v-min="0.000" data-a-sign=" {$settings.General.weight_symbol nofilter}" size="5" value="" class="cm-numeric input-small input-hidden" /></td>
<td>
<input type="text" name="shipping_data[add_rates][{$destination_id}][rate_value][W][0][value]" size="5" value="" class="input-small input-hidden" /></td>
<td>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment