i try to add to cart 1122.24, but can only get as far as 1122.2, wont let me get beyond that from product info page, but once in cart can add in the 4 then, how do i change this
Printable View
i try to add to cart 1122.24, but can only get as far as 1122.2, wont let me get beyond that from product info page, but once in cart can add in the 4 then, how do i change this
One place to look is the units for the product in the product informtion page. Generally speaking items are added in whole numbers, so setting up to accept decimals is one part, then setting up for hundreths is yet another.
Verify that on the product page for the item(s) in question any amount identified in the units box. If it currently is 0.1 or not 1, then please report. There may be other configuration settings to adjust.
Units should be:
.01
as you want .24 to work ...
Next, you need to update your template using your templates and overrides for:
Then you need to adjust the setting for how many decimals you allow on quantity in the Configuration ... Stock ... and set this to 2:Code:if ($products_qty_box_status == 0 or $products_quantity_order_max== 1) {
// hide the quantity box and default to 1
$the_button = '<input type="hidden" name="cart_quantity" value="1" " maxlength="8" size="8" />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
} else {
// show the quantity box
$the_button = PRODUCTS_ORDER_QTY_TEXT . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($_GET['products_id'])) . '" maxlength="8" size="8" /><br />' . zen_get_products_quantity_min_units_display((int)$_GET['products_id']) . '<br />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
}
Quote:
Product Quantity Decimals
Allow how many decimals on Quantity
0= off
0
1
2
3
Thank you
517.8 does not work
517.81 works
how do i get both Decimals working?
Warning Please update your order.
The item: SFI Floors Highlands 12.3mm Laminate Flooring-Barnwood ... Quantity Units errors -
You ordered a total of: 517.8 Min: 17.26 Units: 17.26
30 x 17.26 is 517.8
517.80, Does that work? Seeing as two decimals works. Doesn't seem right that 517.81 works. Does 517.82 or another number up to the next multiple work also?
Zen-cart makes the 0 disapear
2 decimals or even a whole number work, as you can see from earlier in this post i did that to get it to work with to decimals
Also i am using a Shipping module from freightquote.com, it wont work with decimals, Meaning when there is a Decimal in the cart it does not show as a shipping option, can this be fixed in the module file or is it on their server?
Looks like also have some sort of bulk purchase discount module.tried using 5178 units, and the price per unit went down...
What are your settings in Configuration ... Shipping/Packaging ...
What version of Zen Cart are you using?
Have you a copy of your freightquote.com shipping module?
Country of Origin Select the country of origin to be used in shipping quotes.
Postal Code Enter the Postal Code (ZIP) of the Store to be used in shipping quotes. NOTE: For USA zip codes, only use your 5 digit zip code.
Enter the Maximum Package Weight you will ship Carriers have a max weight limit for a single package. This is a common one for all.
Package Tare Small to Medium - added percentage:weight What is the weight of typical packaging of small to medium packages?
Example: 10% + 1lb 10:1
10% + 0lbs 10:0
0% + 5lbs 0:5
0% + 0lbs 0:0
Larger packages - added packaging percentage:weight What is the weight of typical packaging for Large packages?
Example: 10% + 1lb 10:1
10% + 0lbs 10:0
0% + 5lbs 0:5
0% + 0lbs 0:0
Display Number of Boxes and Weight Status Display Shipping Weight and Number of Boxes?
0= off
1= Boxes Only
2= Weight Only
3= Both Boxes and Weight 0
1
2
3
Order Free Shipping 0 Weight Status If there is no weight to the order, does the order have Free Shipping?
0= no
1= yes
Note: When using Free Shipping, Enable the Free Shipping Module this will only show when shipping is free. 0
1
Shipping Estimator Display Settings for Shopping Cart
0= Off
1= Display as Button on Shopping Cart
2= Display as Listing on Shopping Cart Page 0
1
2
Display Order Comments on Admin Invoice Do you want to display the Order Comments on the Admin Invoice?
0= OFF
1= First Comment by Customer only
2= All Comments for the Order 0
1
2
Display Order Comments on Admin Packing Slip Do you want to display the Order Comments on the Admin Packing Slip?
0= OFF
1= First Comment by Customer only
2= All Comments for the Order 0
1
2
here u go
v 1.51 is my version
What is the Maximum Weight set to?
10000 max
And the two Tare Rate settings?
I have not used this shipping module but your shipping quotes do not appear to be able to manage the weight and settings that you are using ...
NOTE: from the post of your Configuration ... Shipping/Packaging ... I cannot tell what are your actual settings and what is the display text
As to the decimal issue, edit the class:
/includes/modules/shopping_cart.php
and around line 1241, what happens if you add the code in RED:
NOTE: you may still get the message, but see if you can now get to checkout_shipping ...Code:if (false && $new_qty == (int)$new_qty) {
$new_qty = (int)$new_qty;
}
Then to manage the error message, test this, I am not done testing this idea, but see how it works for you ...
Edit the file:
/includes/classes/shopping_cart.php
and add the code in RED:
Code:// Check Quantity Units if not already an error on Quantity Minimum
if ($fix_once == 0) {
$check_units = $products->fields['products_quantity_order_units'];
// if ( fmod_round($check_quantity,$check_units) != 0 ) {
if ( fmod_round($check_quantity,$check_units) != $check_units && fmod_round($check_quantity,$check_units) != 0) {
$_SESSION['valid_to_checkout'] = false;
$_SESSION['cart_errors'] .= ERROR_PRODUCT . $products->fields['products_name'] . ERROR_PRODUCT_QUANTITY_UNITS_SHOPPING_CART . ERROR_PRODUCT_QUANTITY_ORDERED . $check_quantity . ' <span class="alertBlack">' . zen_get_products_quantity_min_units_display((int)$prid, false, true) . '</span> ' . '<br />';
}
}
// Verify Valid Attributes
Check the IF as I had an error in it that I just fixed ...
tare settings *:1.00
That isn't a valid setting ... if you want to add 1lb to all your quotes, us:
0:1
I'll change it, but it does show 1 lb was added in cart
You might read through the file:
/includes/classes/shipping.php
and see how Tare Rates are calculated ... you would get some strange logic trying to use * as a value in the calculations ...
i Dont have A shopping_cart.php in that location.
did a search in catalog for that file and this is what was returned.
/var/www/clients/client1/web4/web/includes/auto_loaders/config.core.php
Line #25 : * require(DIR_WS_CLASSES . 'shopping_cart.php');
Line #63 : 'loadFile'=>'shopping_cart.php');
/var/www/clients/client1/web4/web/includes/auto_loaders/paypal_ipn.core.php
Line #34 : 'loadFile'=>'shopping_cart.php');
/var/www/clients/client1/web4/web/includes/init_includes/auto_loaders/config.core.php
Line #25 : * require(DIR_WS_CLASSES . 'shopping_cart.php');
Line #63 : 'loadFile'=>'shopping_cart.php');
/var/www/clients/client1/web4/web/includes/init_includes/auto_loaders/paypal_ipn.core.php
Line #34 : 'loadFile'=>'shopping_cart.php');
/var/www/clients/client1/web4/web/includes/languages/english.php
Line #104 : // shopping_cart box text in sideboxes/shopping_cart.php
/var/www/clients/client1/web4/web/includes/languages/english/info_shopping_cart.php
Line #19 : // $Id: info_shopping_cart.php 1969 2005-09-13 06:57:21Z drbyte $
/var/www/clients/client1/web4/web/includes/languages/english/shopping_cart.php
Line #6 : * @version $Id: shopping_cart.php 3183 2006-03-14 07:58:59Z birdbrain $
/var/www/clients/client1/web4/web/includes/languages/sheffield_blue/english.php
Line #104 : // shopping_cart box text in sideboxes/shopping_cart.php
/var/www/clients/client1/web4/web/includes/modules/quick_checkout_process/sideboxes/shopping_cart.php
Line #8 : * @version $Id: shopping_cart.php 7437 2007-11-16 21:33:16Z drbyte $
Line #33 : require($template->get_template_dir('tpl_shopping_cart.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_shopping_cart.php');
/var/www/clients/client1/web4/web/includes/modules/sideboxes/shopping_cart.php
Line #8 : * @version $Id: shopping_cart.php 7437 2007-11-16 21:33:16Z drbyte $
Line #33 : require($template->get_template_dir('tpl_shopping_cart.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_shopping_cart.php');
/var/www/clients/client1/web4/web/includes/templates/sheffield_blue/sideboxes/tpl_shopping_cart.php
Line #9 : * @version $Id: tpl_shopping_cart.php 7192 2007-10-06 13:30:46Z drbyte $
/var/www/clients/client1/web4/web/includes/templates/template_default/sideboxes/tpl_shopping_cart.php
Line #9 : * @version $Id: tpl_shopping_cart.php 7192 2007-10-06 13:30:46Z drbyte $
Do this ... forget the shopping_cart.php class file you cannot find ...
Change the file:
/includes/functions/functions_general.php
and replace the function fmod_round with this new code:
Code:// replacement for fmod to manage values < 1
function fmod_round($x, $y) {
$x = strval($x);
$y = strval($y);
$zc_round = ($x*1000)/($y*1000);
$zc_round_ceil = round($zc_round,0);
$multiplier = $zc_round_ceil * $y;
$results = abs(round($x - $multiplier, 6));
return $results;
}
that worked, now is there a way to round up the weight to a whole number
517.8 ft = 899.998536, Would like it to be 900 lbs
I do not think this is a whole number issue ...
Try, for example to only add quantity 17.26 ... which is a weight of:
Weight: 29.9999512lbs
The while you do not see the shipping quote on your shopping_cart page, click to go to checkout_shipping ... and you will see a quote for shipping ...
The issue, I believe is the weight and trying to get a quote for:
Weight: 899.998536lbs
I think it is a total weight issue exceeding some limit in either your code or while freightquote.com not being able to provide you a quote for that excessive weight ...
if you put this in cart at 501 sq ft it is 1002 pounds and works as it should
http://floorz-n-more.com/index.php?m...oducts_id=3993
you should see a quote from freightquote .com
not in standard or express shipping options Those are Advanced shipper by ceon
Still not sure how it plays in the total process, but as was discovered with another product that was provided for an example, some of the values appear to get modified at certain cut-off points and possibly have problems at those points. The previous example was with enforcing units where the quantity of product was 30 times the units value and did not perform well. Could this also be related here where the cut-off point is met and causing an unknown result?
I am not following how your shipping works ...
Why wouldn't you see that same shipping quotes under the shopping_cart that you would in the checkout_shipping?
With the 501 sq ft it is 1002 pounds I see a shipping quote on the checkout_shipping but not the shopping_cart ...
As a customer, that is rather confusing ...
Is the quote in the checkout_shipping not valid?
i have noticed that to, sometimes it is there and sometimes it isn't, it is always there when not logged in
i have changed it to a button
Freightquote.com only shows when logged in
how do i change background in shipping estimator, hard to read text
i fixed estimator now shows
further inspection on freightquote module it is failing on the product quantity, what i need to figure out is to round the quantity.
i found this in the file. 'Weight' => ceil($product['quantity'] * (int)$product['weight']), and this 'PieceCount' => $product['quantity'], they dont seem to work.
here's an update to the freightquote.com module
here is the original file
Code:<?php
/*
Freightquote.com Shipping Module for Zen Cart
Copyright (c) 2010 Freightquote.com
Developed by Dynamo Effects - sales [at] dynamoeffects.com
Released under the GNU General Public License v2
*/
class freightquote {
var $code, $title, $description, $sort_order, $icon,
$tax_class, $enabled, $request, $response;
function freightquote() {
global $order, $db;
$this->code = 'freightquote';
$this->title = MODULE_SHIPPING_FREIGHTQUOTE_TEXT_TITLE;
$this->description = MODULE_SHIPPING_FREIGHTQUOTE_TEXT_DESCRIPTION;
$this->sort_order = MODULE_SHIPPING_FREIGHTQUOTE_SORT_ORDER;
$this->icon = '';
$this->tax_class = MODULE_SHIPPING_FREIGHTQUOTE_TAX_CLASS;
if (zen_get_shipping_enabled($this->code)) {
$this->enabled = (MODULE_SHIPPING_FREIGHTQUOTE_STATUS == 'True' ? true : false);
}
if (($this->enabled == true) && ((int)MODULE_SHIPPING_FREIGHTQUOTE_ZONE > 0)) {
$check_flag = false;
$check_query = $db->Execute(
"SELECT zone_id " .
"FROM " . TABLE_ZONES_TO_GEO_ZONES . " " .
"WHERE geo_zone_id = '" . MODULE_SHIPPING_FREIGHTQUOTE_ZONE . "' " .
" AND zone_country_id = '" . $order->delivery['country']['id'] . "' " .
"ORDER BY zone_id"
);
while (!$check_query->EOF) {
if ($check_query->fields['zone_id'] < 1) {
$check_flag = true;
break;
} elseif ($check_query->fields['zone_id'] == $order->delivery['zone_id']) {
$check_flag = true;
break;
}
$check_query->MoveNext();
}
if ($check_flag == false) {
$this->enabled = false;
}
}
}
function quote($method = '') {
global $db, $order, $currencies, $shipping;
//Array used to store data that will be fed into XML template
$shipping_info = array();
//This array will be turned into the XML that is sent to Freightquote.com
$request_xml = array(
'GetRatingEngineQuote' => array(
'request' => array(
'CustomerId' => $_SESSION['customer_id'],
'QuoteType' => 'B2B',
'ServiceType' => MODULE_SHIPPING_FREIGHTQUOTE_SERVICE_TYPE,
'QuoteShipment' => array(
'ShipmentLabel' => MODULE_SHIPPING_FREIGHTQUOTE_TEXT_SHIPMENT_LABEL,
'IsBlind' => (MODULE_SHIPPING_FREIGHTQUOTE_BLIND == 'True' ? 'true' : 'false'),
'ShipmentLocations' => array(
'Location' => array()
),
'ShipmentProducts' => array(
'Product' => array()
)
)
),
'user' => array(
'Name' => MODULE_SHIPPING_FREIGHTQUOTE_USERNAME,
'Password' => MODULE_SHIPPING_FREIGHTQUOTE_PASSWORD
)
)
);
//ZIP Code and country code of the destination address
$dest_zip = $order->delivery['postcode'];
$dest_country = $order->delivery['country']['iso_code_2'];
//Format the ZIP codes for the US and Canada
if ($dest_country == 'US') {
$dest_zip = preg_replace('/[^0-9]/', '', $dest_zip);
$dest_zip = substr($dest_zip, 0, 5);
} elseif ($dest_country == 'CA') {
$dest_zip = preg_replace('/[^0-9A-Z]/', '', strtoupper($dest_zip));
$dest_zip = substr($dest_zip, 0, 6);
}
$ship_country = zen_get_countries(MODULE_SHIPPING_FREIGHTQUOTE_SHIP_COUNTRY, true);
$ship_country = $ship_country['countries_iso_code_2'];
//Retrieve all products in the cart
$products = $_SESSION['cart']->get_products();
//Determine the type of location selected by the customer -- YW BEGIN
//$delivery_location = 1;
if (!isset($delivery_location)) {
switch (MODULE_SHIPPING_FREIGHTQUOTE_DELIVERY_LOCATION) {
case 'Residence':
$delivery_location = 0;
break;
case 'Commercial (with loading dock)':
$delivery_location = 2;
break;
case 'Construction Site':
$delivery_location = 3;
break;
case 'Commercial (no loading dock)':
default:
$delivery_location = 1;
break;
}
}
if (isset($_REQUEST['freightquote_delivery_location'])) {
$delivery_location = (int)$_REQUEST['freightquote_delivery_location'];
}
$delivery_info = array();
switch ($delivery_location) {
case '0':
$delivery_info['residence'] = 'true';
$delivery_info['construction_site'] = 'false';
$delivery_info['loading_dock'] = 'false';
break;
case '2':
$delivery_info['residence'] = 'false';
$delivery_info['construction_site'] = 'false';
$delivery_info['loading_dock'] = 'true';
break;
case '3':
$delivery_info['residence'] = 'false';
$delivery_info['construction_site'] = 'true';
$delivery_info['loading_dock'] = 'false';
break;
case '1':
default:
$delivery_info['residence'] = 'false';
$delivery_info['construction_site'] = 'false';
$delivery_info['loading_dock'] = 'false';
break;
}
$request_xml['GetRatingEngineQuote']['request']['QuoteShipment']['ShipmentLocations']['Location'] = array(
array(
'LocationName' => STORE_NAME,
'LocationType' => 'Origin',
'HasLoadingDock' => strtolower(MODULE_SHIPPING_FREIGHTQUOTE_LOADING_DOCK),
'IsConstructionSite' => strtolower(MODULE_SHIPPING_FREIGHTQUOTE_CONSTRUCTION_SITE),
'IsResidential' => strtolower(MODULE_SHIPPING_FREIGHTQUOTE_RESIDENCE),
'LocationAddress' => array(
'PostalCode' => MODULE_SHIPPING_FREIGHTQUOTE_SHIP_ZIP,
'CountryCode' => $ship_country
)
),
array(
'LocationName' => $order->delivery['firstname'] . ' ' . $order->delivery['lastname'],
'LocationType' => 'Destination',
'HasLoadingDock' => $delivery_info['loading_dock'],
'IsConstructionSite' => $delivery_info['construction_site'],
'IsResidential' => $delivery_info['residence'],
'LocationAddress' => array(
'PostalCode' => $dest_zip,
'CountryCode' => $dest_country
)
)
);
$product_list = array();
$counter = 1;
$excluded_items = 0;
foreach ($products as $product) {
$data = $db->Execute(
"SELECT products_freightquote_enable, products_freightquote_length, products_freightquote_width, " .
" products_freightquote_height, products_freightquote_class, products_freightquote_nmfc, " .
" products_freightquote_hzmt, products_freightquote_content_type, " .
" products_freightquote_package_type, products_freightquote_commodity_type " .
"FROM " . TABLE_PRODUCTS . " " .
"WHERE products_id = " . (int)$product['id'] . " " .
"LIMIT 1"
);
if ($data->fields['products_freightquote_enable'] == '1') {
$product_list[] = array(
'Class' => (zen_not_null($data->fields['products_freightquote_class']) ? $data->fields['products_freightquote_class'] : '50'),
'ProductDescription' => $product['name'],
'Weight' => ceil($product['quantity'] * (int)$product['weight']),
'Length' => ceil($data->fields['products_freightquote_length']),
'Width' => ceil($data->fields['products_freightquote_width']),
'Height' => ceil($data->fields['products_freightquote_height']),
'PackageType' => (zen_not_null($data->fields['products_freightquote_package_type']) ? $data->fields['products_freightquote_package_type'] : 'Boxes'),
'DeclaredValue' => round($product['price']),
'CommodityType' => (zen_not_null($data->fields['products_freightquote_commodity_type']) ? $data->fields['products_freightquote_commodity_type'] : 'GeneralMerchandise'),
'ContentType' => (zen_not_null($data->fields['products_freightquote_content_type']) ? $data->fields['products_freightquote_content_type'] : 'NewCommercialGoods'),
'IsHazardousMaterial' => $data->fields['products_freightquote_hzmt'],
'NMFC' => $data->fields['products_freightquote_nmfc'],
'PieceCount' => $product['quantity'],
'ItemNumber' => $counter
);
$counter++;
} else {
$excluded_items++;
}
}
$total_products = count($product_list);
if (count($total_products) < 1) {
if (MODULE_SHIPPING_FREIGHTQUOTE_DEBUG == 'True') {
return array(
'module' => $this->title,
'error' => "DEBUG: The products in your cart are not configured to be used with Freightquote.com"
);
}
return false;
}
/* Maximum 6 products allowed per query, so repeat the query multiple times if necessary */
$freightquote_queries = array();
$query_string = '';
/*
* Only 6 items allowed per query
*/
for ($x = 0; $x < $total_products; $x+=6) {
$product_request = array();
for ($n = 1; $n <= 6; $n++) {
$ret = ($n + $x) - 1;
if (isset($product_list[$ret])) {
$product_request[] = $product_list[$ret];
}
}
$request_xml['GetRatingEngineQuote']['request']['QuoteShipment']['ShipmentProducts']['Product'] = $product_request;
$request_result = $this->query_rates($request_xml);
if (isset($request_result['error'])) {
return array(
'module' => $this->title,
'error' => $request_result['error']
);
}
$freightquote_queries[] = $request_result['GetRatingEngineQuoteResponse'][0]['GetRatingEngineQuoteResult'][0];
}
$total_shipping_price = array(
'rate' => 0,
'shipment_id' => ''
);
$errors = array();
foreach ($freightquote_queries as $quote) {
if (is_array($quote['QuoteCarrierOptions'])) {
if ($total_shipping_price['shipment_id'] != '') $total_shipping_price['shipment_id'] .= ' & ';
$total_shipping_price['shipment_id'] .= $quote['QuoteId'];
$total_shipping_price['rate'] += preg_replace('/[^0-9\.]/', '', $quote['QuoteCarrierOptions'][0]['CarrierOption'][0]['QuoteAmount']);
} elseif (count($quote['ValidationErrors']) > 0) {
foreach ($quote['ValidationErrors'][0]['B2BError'] as $error_msg) {
$errors[] = $error_msg['ErrorMessage'];
}
}
}
/* If the shipping price is 0 and no errors were returned, don't display this shipping option */
if ($total_shipping_price['rate'] <= 0 && count($errors) < 1) {
if (MODULE_SHIPPING_FREIGHTQUOTE_DEBUG == 'True') {
return array(
'module' => $this->title,
'error' => "DEBUG: No shipping rates or errors were returned from Freightquote.com, so no shipping option is being returned."
);
}
return false;
}
//Add price modifier
if (MODULE_SHIPPING_FREIGHTQUOTE_PRICE_MODIFIER > 0) {
$total_shipping_price['rate'] = $total_shipping_price['rate'] * MODULE_SHIPPING_FREIGHTQUOTE_PRICE_MODIFIER;
}
//Add handling charges
$total_shipping_price['rate'] += MODULE_SHIPPING_FREIGHTQUOTE_HANDLING * $total_products;
$shipping_form = '';
if ($_POST['action'] != 'process') {
$shipping_form = '<table border="0" cellspacing="0" cellpadding="2">';
$shipping_form .= '<tr><td class="main" width="120">Delivery Location:</td><td class="main">';
$shipping_form .= '<select name="freightquote_delivery_location" onchange="window.location.href=\'' . zen_href_link(FILENAME_CHECKOUT_SHIPPING, 'freightquote_delivery_location=') . '\'+this.value">';
$shipping_form .= '<option value="0"' . ($delivery_location == '0' ? ' SELECTED' : '') . '>Residence</option>';
$shipping_form .= '<option value="1"' . (!isset($delivery_location) || $delivery_location == '1' ? ' SELECTED' : '') . '>Commercial (no loading dock)</option>';
$shipping_form .= '<option value="2"' . ($delivery_location == '2' ? ' SELECTED' : '') . '>Commercial (with loading dock)</option>';
$shipping_form .= '<option value="3"' . ($delivery_location == '3' ? ' SELECTED' : '') . '>Construction Site</option>';
$shipping_form .= '</select></td></tr>';
$shipping_form .= '</table>';
} else {
$shipping_form = '<br>Delivery Location: ';
switch ($delivery_location) {
case '0':
$shipping_form .= 'Residence';
break;
case '2':
$shipping_form .= 'Commercial (with loading dock)';
break;
case '3':
$shipping_form .= 'Construction Site';
break;
I changedCode:case '1':
default:
$shipping_form .= 'Commercial (no loading dock)';
break;
}
}
if (count($errors) < 1) {
$shipping_options = array();
$shipping_options[] = array('id' => 'CHEAPEST',
'title' => MODULE_SHIPPING_FREIGHTQUOTE_TEXT_WAY . $total_shipping_price['shipment_id'] . ($excluded_items > 0 ? MODULE_SHIPPING_FREIGHTQUOTE_TEXT_EXCLUDED . $excluded_items : '') . $shipping_form,
'cost' => $total_shipping_price['rate'],
'tfrc_quote_id' => $total_shipping_price['shipment_id']);
$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_FREIGHTQUOTE_TEXT_TITLE,
'methods' => $shipping_options);
if (isset($_REQUEST['freightquote_delivery_location'])) {
$_SESSION['shipping'] = array(
'id' => $this->code . '_CHEAPEST',
'title' => $this->quotes['methods'][0]['title'],
'cost' => $this->quotes['methods'][0]['title'],
'module' => $this->code
);
}
if ($this->tax_class > 0) {
$this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
}
if (zen_not_null($this->icon)) $this->quotes['icon'] = zen_image($this->icon, $this->title);
} else {
$error_message = '<ul><li>' . implode('</li><li>', $errors) . '</li></ul>';
$this->quotes = array('module' => $this->title . $shipping_form,
'error' => $error_message);
}
return $this->quotes;
}
function query_rates($request_xml) {
//Make sure cURL exists
if (!function_exists('curl_init')) {
return array('error' => MODULE_SHIPPING_FREIGHTQUOTE_TEXT_ERROR_CURL);
}
//URL to send requests to
$service_url = 'https://b2b.Freightquote.com/WebService/QuoteService.asmx';
//XML template file used for request
$query_xml = $xml = $this->array_to_xml($request_xml);
//Make sure the XML file exists
$this->request = $query_xml;
//Initialize curl
$ch = curl_init();
$headers = array(
'Content-Type: text/xml; charset=utf-8',
'Content-Length: ' . strlen($this->request),
'SOAPAction: "http://tempuri.org/GetRatingEngineQuote"'
);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 180);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_URL, $service_url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->request);
$this->response = curl_exec($ch);
if (curl_errno($ch) == 0) {
curl_close($ch);
//Simple check to make sure that this is a valid XML response
if (strpos(strtolower($this->response), 'soap:envelope') === false) {
return array('error' => MODULE_SHIPPING_FREIGHTQUOTE_TEXT_ERROR_DESCRIPTION);
}
if ($this->response) {
//Convert the XML into an easy-to-use associative array
$this->response = $this->parse_xml($this->response);
}
return $this->response;
} else {
//Collect the error returned
$curl_errors = curl_error($ch) . ' (Error No. ' . curl_errno($ch) . ')';
curl_close($ch);
return array('error' => $curl_errors);
}
}
function array_to_xml($array, $wrapper = true) {
$xml = '';
$first_key = false;
if ($wrapper) {
$xml = '<?xml version="1.0" encoding="utf-8"?>' . "\n" .
'<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' . "\n" .
'xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">' . "\n" .
'<soap:Body>' . "\n";
$first_key = true;
}
foreach ($array as $key => $value) {
$position = 0;
if (is_array($value)) {
$is_value_assoc = $this->is_assoc($value);
$xml .= "<$key" . ($first_key ? ' xmlns="http://tempuri.org/"' : '') . ">\n";
$first_key = false;
foreach ($value as $key2 => $value2) {
if (is_array($value2)) {
if ($is_value_assoc) {
$xml .= "<$key2>\n" . $this->array_to_xml($value2, false) . "</$key2>\n";
} elseif (is_array($value2)) {
$xml .= $this->array_to_xml($value2, false);
$position++;
if ($position < count($value) && count($value) > 1) $xml .= "</$key>\n<$key>\n";
}
} else {
$xml .= "<$key2>" . $this->xml_safe($value2) . "</$key2>\n";
}
}
$xml .= "</$key>\n";
} else {
$xml .= "<$key>" . $this->xml_safe($value) . "</$key>\n";
}
}
if ($wrapper) {
$xml .= '</soap:Body>' . "\n" .
'</soap:Envelope>';
}
return $xml;
}
function is_assoc($array) {
return (is_array($array) && 0 !== count(array_diff_key($array, array_keys(array_keys($array)))));
}
function parse_xml($text) {
$reg_exp = '/<(\w+)[^>]*>(.*?)<\/\\1>/s';
preg_match_all($reg_exp, $text, $match);
foreach ($match[1] as $key=>$val) {
if ( preg_match($reg_exp, $match[2][$key]) ) {
$array[$val][] = $this->parse_xml($match[2][$key]);
} else {
$array[$val] = $match[2][$key];
}
}
return $array;
}
function xml_safe($str) {
//The 5 evil characters in XML
$str = str_replace('<', '<', $str);
$str = str_replace('>', '>', $str);
$str = str_replace('&', '&', $str);
$str = str_replace("'", ''', $str);
$str = str_replace('"', '"', $str);
return $str;
}
function check() {
global $db;
if (!isset($this->_check)) {
$check_query = $db->Execute(
"SELECT configuration_value " .
"FROM " . TABLE_CONFIGURATION . " " .
"WHERE configuration_key = 'MODULE_SHIPPING_FREIGHTQUOTE_STATUS' " .
"LIMIT 1"
);
$this->_check = $check_query->RecordCount();
}
return $this->_check;
}
function next_business_day() {
$next_date = date("U")+86400;
$workday = date("w", $next_date);
if ($workday > 0 && $workday < 6) {
return date(DATE_ATOM, $next_date);
} else {
while ($workday < 1 || $workday > 5) {
$next_date += 86400;
$workday = date("w", $next_date);
if ($workday > 0 && $workday < 6) {
return date(DATE_ATOM, $next_date);
}
}
}
}
function install() {
global $db;
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Freightquote.com Shipping Module', 'MODULE_SHIPPING_FREIGHTQUOTE_STATUS', 'True', 'Do you want to offer Freightquote.com shipping?', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Freightquote.com Debug Mode', 'MODULE_SHIPPING_FREIGHTQUOTE_DEBUG', 'False', 'Enable debug mode? This will dump the data string to the user\'s screen when an error occurs. Should not be turned on unless there are problems.', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Username', 'MODULE_SHIPPING_FREIGHTQUOTE_USERNAME', '[email protected]', 'Enter your Freightquote.com Username', '6', '1', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Password', 'MODULE_SHIPPING_FREIGHTQUOTE_PASSWORD', 'XML', 'Enter your Freightquote.com Password', '6', '1', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Service Type', 'MODULE_SHIPPING_FREIGHTQUOTE_SERVICE_TYPE', 'LTL', 'What service type do you want to use?', '6', '0', 'zen_cfg_select_option(array(\'LTL\', \'Truckload\', \'Europe\', \'Groupage\', \'Haulage\'), ', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Shipping Origin: Zip Code', 'MODULE_SHIPPING_FREIGHTQUOTE_SHIP_ZIP', '', 'What zip code will you be shipping from?', '6', '1', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Shipping Origin: Country', 'MODULE_SHIPPING_FREIGHTQUOTE_SHIP_COUNTRY', '223', 'What country will you be shipping from?', '6', '1', 'zen_get_country_name', 'zen_cfg_pull_down_country_list(', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Shipping Origin: Loading Dock', 'MODULE_SHIPPING_FREIGHTQUOTE_LOADING_DOCK', 'True', 'Does the shipping location have a loading dock?', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Shipping Origin: Residence', 'MODULE_SHIPPING_FREIGHTQUOTE_RESIDENCE', 'True', 'Is the shipping location a residence?', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Shipping Origin: Construction Site', 'MODULE_SHIPPING_FREIGHTQUOTE_CONSTRUCTION_SITE', 'True', 'Is the shipping location a construction site?', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Blind Ship', 'MODULE_SHIPPING_FREIGHTQUOTE_BLIND', 'True', 'Blind shipments are used to keep the originating location and receiving destination unaware of each other.', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Price Modifier', 'MODULE_SHIPPING_FREIGHTQUOTE_PRICE_MODIFIER', '1', 'This number will be multiplied by the total shipping rate. If you\'d like to increase or decrease the price returned, modify this field. e.g. For a 10% price increase, enter 1.1', '6', '1', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Handling Fee', 'MODULE_SHIPPING_FREIGHTQUOTE_HANDLING', '0', 'Handling fee for this shipping method (peritem).', '6', '0', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_FREIGHTQUOTE_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'zen_get_tax_class_title', 'zen_cfg_pull_down_tax_classes(', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Shipping Zone', 'MODULE_SHIPPING_FREIGHTQUOTE_ZONE', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_SHIPPING_FREIGHTQUOTE_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Default delivery location', 'MODULE_SHIPPING_FREIGHTQUOTE_DELIVERY_LOCATION', 'Commercial (no loading dock)', 'Default delivery location type', '6', '0', 'zen_cfg_select_option(array(\'Residence\', \'Commercial (no loading dock)\', \'Commercial (with loading dock)\', \'Construction Site\'), ', now())");
$col_query = $db->Execute("SHOW COLUMNS FROM " . TABLE_PRODUCTS);
$found = array(
'products_freightquote_enable' => array('type' => "CHAR( 1 ) DEFAULT '0' NOT NULL"),
'products_freightquote_class' => array('type' => "VARCHAR( 6 ) DEFAULT '50' NOT NULL"),
'products_freightquote_length' => array('type' => "INT DEFAULT '0' NOT NULL"),
'products_freightquote_width' => array('type' => "INT DEFAULT '0' NOT NULL"),
'products_freightquote_height' => array('type' => "INT DEFAULT '0' NOT NULL"),
'products_freightquote_nmfc' => array('type' => "VARCHAR(32) NULL"),
'products_freightquote_hzmt' => array('type' => "VARCHAR(5) DEFAULT 'false' NOT NULL"),
'products_freightquote_package_type' => array('type' => "VARCHAR(32) DEFAULT 'Boxes' NOT NULL"),
'products_freightquote_commodity_type' => array('type' => "VARCHAR(32) DEFAULT 'GeneralMerchandise' NOT NULL"),
'products_freightquote_content_type' => array('type' => "VARCHAR(32) DEFAULT 'NewCommercialGoods' NOT NULL")
);
while (!$col_query->EOF) {
$columns[] = $col_query->fields['Field'];
$col_query->MoveNext();
}
foreach ($found as $col => $info) {
if (!in_array($col, $columns)) {
$db->Execute("ALTER TABLE " . TABLE_PRODUCTS . " ADD `" . $col . "` " . $info['type']);
}
}
}
function remove() {
global $db;
$db->Execute("DELETE FROM " . TABLE_CONFIGURATION . " WHERE configuration_key IN ('" . implode("', '", $this->keys()) . "')");
}
function keys() {
return array(
'MODULE_SHIPPING_FREIGHTQUOTE_STATUS',
'MODULE_SHIPPING_FREIGHTQUOTE_DEBUG',
'MODULE_SHIPPING_FREIGHTQUOTE_USERNAME',
'MODULE_SHIPPING_FREIGHTQUOTE_PASSWORD',
'MODULE_SHIPPING_FREIGHTQUOTE_SERVICE_TYPE',
'MODULE_SHIPPING_FREIGHTQUOTE_SHIP_ZIP',
'MODULE_SHIPPING_FREIGHTQUOTE_SHIP_COUNTRY',
'MODULE_SHIPPING_FREIGHTQUOTE_LOADING_DOCK',
'MODULE_SHIPPING_FREIGHTQUOTE_RESIDENCE',
'MODULE_SHIPPING_FREIGHTQUOTE_CONSTRUCTION_SITE',
'MODULE_SHIPPING_FREIGHTQUOTE_BLIND',
'MODULE_SHIPPING_FREIGHTQUOTE_PRICE_MODIFIER',
'MODULE_SHIPPING_FREIGHTQUOTE_HANDLING',
'MODULE_SHIPPING_FREIGHTQUOTE_TAX_CLASS',
'MODULE_SHIPPING_FREIGHTQUOTE_ZONE',
'MODULE_SHIPPING_FREIGHTQUOTE_SORT_ORDER',
'MODULE_SHIPPING_FREIGHTQUOTE_DELIVERY_LOCATION'
);
}
}
?>
toCode:'Weight' => ceil($product['quantity'] * (int)$product['weight']),
also changed thisCode:'Weight' => ceil($_SESSION['cart']->weight),
to thisCode:'PieceCount' => $product['quantity'],
added thisCode:'PieceCount' => ceil($product['quantity'])
underCode:if (!IS_ADMIN_FLAG) {
global $cart;
if ($_SESSION['cart']->weight < 150 ) {
$this->enabled = false;
} }
Now need to get rates working without logging inCode:if (zen_get_shipping_enabled($this->code)) {
$this->enabled = (MODULE_SHIPPING_FREIGHTQUOTE_STATUS == 'True' ? true : false);
}
and the option for customer to choose location
Changed this
toCode:'CustomerId' => $_SESSION['customer_id'],
Now can see when not logged inCode:'CustomerId' => '0'
changed this
toCode:$shipping_form .= '<select name="freightquote_delivery_location" onchange="window.location.href=\'' . zen_href_link(FILENAME_CHECKOUT_SHIPPING, 'freightquote_delivery_location=') . '\'+this.value">';
but showing this in address barCode:$shipping_form .= '<select name="freightquote_delivery_location" onchange="window.location.href=\'' . zen_href_link(FILENAME_SHOPPING_CART, 'freightquote_delivery_location=') . '\'+this.value">';
http://floorz-n-more.com/index.php?m...ery_location=1
wound like it to refresh on same page if on shopping cart and they select commercial it will refresh on shopping cart, if in checkout and they select commercial it will refresh checkout
min max is set to 40.20, product info pages show 40.2(wont allow checkout as 40.2) how can i tell zencart not to strip the zero) stock quantity decimals set to 2)
Not sure if the above identifies this setting set this way or is asking where the setting is, but I would expect to support quantities that include at least.0.2 that the stock be allowed to exist or be modified in quantities of at least 0.1 or have 1 decimal place. This is controlled in configuration->stock->product Quantity Decimals. If this is set to 2, then quantities will work using 2 decimal places (0.01)
if a quantity has 40.20 the page only shows 40.2, suppose to be 40.20 - 2 decimals
http://1stchoiceflooringservice.com/...oducts_id=7403
How would I apply this to zen version 210