Forums / Addon Shipping Modules / Code to read fields from db for freightquote shipping module

Code to read fields from db for freightquote shipping module

Results 1 to 20 of 20
24 Dec 2014, 18:31
#1
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Posts:
968
Plugin Contributions:
0

Code to read fields from db for freightquote shipping module

trying to add something like this in my shipping module
foreach ($products as $product) {
        $data = $db->Execute(
          "SELECT products_freightquote_length, products_freightquote_width, products_freightquote_height " .
          "FROM " . TABLE_PRODUCTS . " " .
          "WHERE products_id = " . (int)$product['id'] . " " .
          "LIMIT 1"
        );

To be read in this section
<Dimensions>
		<Length>ceil($data->fields['products_freightquote_length']),</Length>
		<Width>ceil($data->fields['products_freightquote_width']),</Width>
		<Height>ceil($data->fields['products_freightquote_height']),</Height>
		<Units>IN</Units>
	  </Dimensions>
    </RequestedPackageLineItems>
</RequestedShipment>
</RateRequest>";

what is the proper way
29 Dec 2014, 00:30
#2
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Posts:
968
Plugin Contributions:
0

Re: Code to read fields from db for freightquote shipping module

try to add dimensions to my fedex module, this piece of code is from another module that uses the fields i want to use
      foreach ($products as $product) {
        $data = $db->Execute(
          "SELECT products_freightquote_length, products_freightquote_width, products_freightquote_height " .
          "FROM " . TABLE_PRODUCTS . " " .
          "WHERE products_id = " . (int)$product['id'] . " " .
          "LIMIT 1"
        );

Been try to add it in here with no luck
<?php

/**
 * Ceon Advanced Shipper Fedex Calculation class. 
 *
 * @package     ceon_advanced_shipper
 * @author      Waqas Hussain <waqas20######################>
 * @author      Conor Kerr <[email protected]>
 * @copyright   Copyright 2010-2012 Waqas Hussain
 * @copyright   Copyright 2007-2012 Ceon
 * @copyright   Portions Copyright 2003-2006 Zen Cart Development Team
 * @copyright   Portions Copyright 2003 osCommerce
 * @link        http://dev.ceon.net/web/zen-cart/advanced-shipper
 * @license     http://www.gnu.org/copyleft/gpl.html   GNU Public License V2.0
 * @version     $Id: class.AdvancedShipperFedExCalculator.php 981 2012-03-27 16:28:46Z conor $
 */

// {{{ AdvancedShipperFedExCalculator

/**
 * Connects to FedEx online calculator and gets quotes for the shipping methods enabled in the
 * configuration.
 *
 * @author      Waqas Hussain <waqas20######################>
 * @author      Conor Kerr <[email protected]>
 * @copyright   Copyright 2010-2012 Waqas Hussain
 * @copyright   Copyright 2007-2012 Ceon
 * @copyright   Portions Copyright 2003-2006 Zen Cart Development Team
 * @copyright   Portions Copyright 2003 osCommerce
 * @license     http://www.gnu.org/copyleft/gpl.html   GNU Public License V2.0
 */
class AdvancedShipperFedExCalculator
{
	// {{{ properties
	
	/**
	 * The configuration settings for this instance.
	 *
	 * @var     array
	 * @access  public
	 */
	var $_config = null;
	
	// }}}
	
	
	// {{{ Class Constructor
	
	/**
	 * Create a new instance of the AdvancedShipperFedExCalculator class
	 *
	 * @param   array     $fedex_config   An associative array with the configuration settings for
	 *                                    this instance.
	 */
	function AdvancedShipperFedExCalculator($fedex_config)
	{
		$this->_config = $fedex_config;
	}
	
	// }}}
	
	
	// {{{ quote()

	/**
	 * Contacts Fedex and gets a quote for the specified weight and configuration settings.
	 *
	 * @access  public
	 * @param   float     $weight    The weight of the package to be shipped.
	 * @param   float     $price     The total price of the items in package to be shipped.
	 * @param   array     $min_max   Any minimum/maximum limits which should be applied to the final
	 *                               rate calculated.
	 * @return  none
	 */
	function quote($weight, $price, $min_max)
	{
		global $order;
		
		if ($weight < 0.1) {
			$weight = 0.1;
		}
		
		$rate_info = $this->_getQuote($weight, $min_max);
		
		return $rate_info;
	}
	
	// }}}
	
	
	// {{{ _getQuote()
	
	/**
	 * Contacts FedEx, gets a quote, parses the response and builds the list of quotes.
	 *
	 * @access  protected
	 * @return  array|boolean   Array of results or boolean false if no results.
	 */
	function _getQuote($weight, $min_max)
	{
		global $db, $order, $currencies;
		
		if (strtolower($this->_config['server']) == 'p') {
			$fedex_url = 'https://gateway.fedex.com:443/xml';
		} else {
			$fedex_url = 'https://gatewaybeta.fedex.com:443/xml';
		}
		
		$fedex_key = $this->_config['fedex_key'];
		$fedex_password = $this->_config['fedex_password'];
		$fedex_account = $this->_config['fedex_account'];
		$fedex_meter = $this->_config['fedex_meter'];
		
		$shipper_country_sql = "
			SELECT
				countries_iso_code_2
            FROM
				" . TABLE_COUNTRIES . "
            WHERE
				countries_id = '" . (int) $this->_config['source_country'] . "';";
		
        $shipper_country_result = $db->Execute($shipper_country_sql);
		
		if (!$shipper_country_result->EOF) {
			$shipper_country = strtoupper($shipper_country_result->fields['countries_iso_code_2']);
		}
		
		$shipper_postcode = $this->_config['source_postcode'];
		$recipient_country = $order->delivery['country']['iso_code_2'];
		$recipient_postcode = $order->delivery['postcode'];
		$timestamp = gmdate('c');//'2010-08-06T21:48:17+06:00'
		$saturday_delivery = ($this->_config['shipping_saturday'] != 0);
		
		//BOF Residential Company Name Check
        $residential = ($order->delivery['company'] != '' ? 'false' : 'true');
        //EOF Residential Company Name Check
		
		$drop_off_type = strtoupper($this->_config['drop_off_type']);
		
		$packaging_type = strtoupper($this->_config['packaging_type']);
		
		$get_account_rates = ($this->_config['rate_request_types'] == 1 ||
			$this->_config['rate_request_types'] == 3 ? true: false);
		
		$get_list_rates = ($this->_config['rate_request_types'] == 2 ||
			$this->_config['rate_request_types'] == 3 ? true: false);
		
		$weight_units = strtoupper($this->_config['weight_units']);
		
		
		$request = "
<RateRequest xmlns='http://fedex.com/ws/rate/v16'>
	<WebAuthenticationDetail>
		<UserCredential>
			<Key>$fedex_key</Key>
			<Password>$fedex_password</Password>
		</UserCredential>
	</WebAuthenticationDetail>
	<ClientDetail>
		<AccountNumber>$fedex_account</AccountNumber>
		<MeterNumber>$fedex_meter</MeterNumber>
	</ClientDetail>
	<TransactionDetail>
		<CustomerTransactionId>ACTIVESHIPPING</CustomerTransactionId>
	</TransactionDetail>
	
	<Version>
		<ServiceId>crs</ServiceId>
		<Major>16</Major>
		<Intermediate>0</Intermediate>
		<Minor>0</Minor>
	</Version>
	
	<ReturnTransitAndCommit>true</ReturnTransitAndCommit>
	" . ($saturday_delivery ? '<VariableOptions>SATURDAY_DELIVERY</VariableOptions>' : '') . "
	
	<RequestedShipment>
		<ShipTimestamp>$timestamp</ShipTimestamp>
		<DropoffType>$drop_off_type</DropoffType>
		<PackagingType>$packaging_type</PackagingType>
		
		<Shipper>
			<Address>
				<PostalCode>$shipper_postcode</PostalCode>
				<CountryCode>$shipper_country</CountryCode>
			</Address>
		</Shipper>
		<Recipient>
			<Address>
			    <StreetLines>$recipient_street_address</StreetLines>
				<City>$recipient_city</City>
				<StateOrProvinceCode>$recipient_state</StateOrProvinceCode>
				<PostalCode>$recipient_postcode</PostalCode>
				<CountryCode>$recipient_country</CountryCode>	
			    <Residential>".$residential."</Residential>
			</Address>
		</Recipient>
		<ShippingChargesPayment>
<PaymentType>SENDER</PaymentType>
<Payor>
<AssociatedAccounts>
<AccountNumber></AccountNumber>
</AssociatedAccounts>
</Payor>
</ShippingChargesPayment>
		" . ($get_account_rates ? '<RateRequestTypes>NONE</RateRequestTypes>' : '') . "
		" . ($get_list_rates ? '<RateRequestTypes>LIST</RateRequestTypes>' : '') . "
		
		<CustomerSelectedActualRateType>PAYOR_LIST_PACKAGE</CustomerSelectedActualRateType>
		<PackageCount>1</PackageCount>
		<RequestedPackageLineItems>
		<SequenceNumber>1</SequenceNumber>
        <GroupPackageCount>1</GroupPackageCount>
			<Weight>
				<Units>$weight_units</Units>
				<Value>$weight</Value>
			</Weight>
			<Dimensions>
				<Length>ceil($data->fields['products_freightquote_length'])</Length>
				<Width>ceil($data->fields['products_freightquote_width'])</Width>
				<Height>ceil($data->fields['products_freightquote_height'])</Height>
				<Units>IN</Units>
			</Dimensions>
		</RequestedPackageLineItems>
	</RequestedShipment>
</RateRequest>";
		
		advshipper::debug("Data being sent to FedEx: <br />\n<br />\n" .
			nl2br(htmlentities($request)) . "<br />\n<br />\n", true);
		
		$body = $this->_post($fedex_url, $request);
		
		if (!$body) {
			advshipper::debug('Failed to connect to FedEx' . "\n\n");
			
			return array('error' => 'Failed to connect to FedEx');
		}
		
		// Strip namespace prefixes
		$body =
			preg_replace(array('/<[a-zA-Z0-9]+:/', '/<\/[a-zA-Z0-9]+:/'), array('<', '</'), $body); 
		
		advshipper::debug("Data received from FedEx (with namespaces removed): <br />\n<br />\n" .
			nl2br(htmlentities($body)) . "<br />\n<br />\n", true);
		
		$xml = @simplexml_load_string($body);
		
		if (!$xml) {
			advshipper::debug('Unable to parse XML returned from FedEx' . "<br />\n<br />\n");
			
			return array(
				'error' => 'Invalid response from FedEx: '. $body
				);
		}
		
		if (strtolower($xml->getName()) == 'fault') {
			$error_code = $xml->detail->fault->errorCode;
			$reason = $xml->detail->fault->reason;
			
			return array(
				'error' => 'FedEx: ' . $error_code . ': ' . $reason
				);
		}
		
		$severity = $xml->HighestSeverity;
		$message = $xml->Notifications->Message;
		
		// Check for problem with postcode
		if ($severity == 'ERROR' &&
				strpos($message, 'Destination postal code missing or invalid') !== false) {
			return array(
				'error' => MODULE_ADVANCED_SHIPPER_ERROR_INVALID_POSTCODE
				);
		}
		
		if ($severity != 'SUCCESS' && $severity != 'NOTE' && $severity != 'WARNING') {
			advshipper::debug('Error occured when attempting to get response from FedEx. Severity' .
				' was ' . $severity . "<br />\n<br />\n");
			
			return array(
				'error' => "FedEx: $message"
				);
		}
		
		$rate_info = array();
		
		foreach ($xml->RateReplyDetails as $child) {
			$service_type = trim(strtolower((string) $child->ServiceType));
			
			$service_name = constant('MODULE_ADVANCED_SHIPPER_TEXT_FEDEX_' .
				str_replace('FEDEX_', '', strtoupper($service_type)));
			
			if ($this->_config['shipping_service_' . $service_type] == 0) {
				advshipper::debug('FedEx ' . $service_name . ' service not to be offered as it is' .
					" not enabled in the FedEx configuration for the region.<br />\n<br />\n",
					true);
				
				continue;
			}
			
			if ($child->AppliedOptions == 'SATURDAY_DELIVERY') {
				$service_name .= MODULE_ADVANCED_SHIPPER_TEXT_FEDEX_SATURDAY_DELIVERY;
			}
			
			$rate = (string) $child->RatedShipmentDetails->ShipmentRateDetail->TotalNetCharge->
				Amount;
			
			//If the method is configured to use list rates find the payor_list_package rate otherwise use account rates - RB
			if ($get_list_rates == '1') {
				foreach ($child->RatedShipmentDetails as $ratedetail) {
					$ratetype =	$ratedetail->ShipmentRateDetail->RateType;
					if ($ratetype == 'PAYOR_LIST_PACKAGE') {
					$rate = (string) $ratedetail->ShipmentRateDetail->TotalNetCharge->Amount;
					}
				}
			}
			//End of account rate change
			
			// Rate is always returned in currency of account holder. Must convert to currency in
			// use
			$rate_currency = strtoupper((string) $child->RatedShipmentDetails->ShipmentRateDetail->
				TotalNetCharge->Currency);
			
			// Get the current currency in which the customer is viewing prices
			$current_display_currency = strtoupper($_SESSION['currency']);
			
			if ($rate_currency != $current_display_currency) {
				// Must convert from FedEx currency to base currency
				$rate_currency_conv_rate = $currencies->get_value($rate_currency);
				
				if (is_null($rate_currency_conv_rate) || !is_numeric($rate_currency_conv_rate)) {
					// FedEx currency doesn't have a conversion value, can't proceed!
					return array(
						'error' => sprintf(
							MODULE_ADVANCED_SHIPPER_ERROR_FEDEX_CURRENCY_CONV_VALUE_MISSING,
							$rate_currency)
						);
				} else if ($rate_currency_conv_rate <= 0) {
					return array(
						'error' => sprintf(
							MODULE_ADVANCED_SHIPPER_ERROR_FEDEX_CURRENCY_CONV_VALUE_INVALID,
							$rate_currency)
						);
				}
				
				$rate_base_conv_rate = 1 / $currencies->get_value($rate_currency);
				
				$rate = number_format($rate * $rate_base_conv_rate, 2, '.', '');
			}
			
			if ($min_max != false) {
				// Apply the limit(s) to the rate
				$rate_limited = advshipper::calcMinMaxValue($rate, $min_max['min'],
					$min_max['max']);
				
				if ($rate_limited != $rate) {
					$rate = $rate_limited;
				}
			}
			
			$rate_info[] = array(
				'rate' => $rate,
				'rate_components_info' => array(
					array(
						'value_band_total' => $rate,
						'individual_value' => null,
						'num_individual_values' => $weight,
						'additional_charge' => null,
						'calc_method' => ADVSHIPPER_CALC_METHOD_FEDEX
						)
					),
				'rate_extra_title' => MODULE_ADVANCED_SHIPPER_TEXT_FEDEX_TITLE_PREFIX .
					$service_name
				);
		}
		
		if (count($rate_info) == 0) {
			// No quotes
			return false;
		}
		
		return $rate_info;
	}
	
	// }}}
	
	
	// {{{ _post()
	
	/**
	 * Do an HTTP POST call on a URL with given data.
	 *
	 * @access  protected
	 * @param   string    $url   The URL to send the request to.
	 * @param   string    $data  The data to send in the request.
	 * @return  string    Data or false on error
	 */
	function _post($url, $data)
	{
		$ch = curl_init($url) or die('Failed to load curl');
		
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
		//curl_set_opt($ch, CURLOPT_HEADER, FALSE);
		curl_setopt($ch, CURLOPT_POST, TRUE);
		curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
		
		$data = curl_exec($ch);
		curl_close($ch);
		
		return $data;
	}
	
	// }}}
}

// }}}

?>

Updated Post to show complete code
29 Dec 2014, 16:42
#3
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,907
Plugin Contributions:
1

Re: Code to read fields from db for freightquote shipping module

Thing with this is and as said it is code from something else that is attempted to be added, the issue is basically variable scope/definition. The first piece of code (that I didn't see in the second) assumes that the products ($products) are known and in some sort of data structure such as returned by a sql query. That code then takes information about each product from the database and retrieves it as $data. This current module doesn't look like it evaluates the individual products, but instead the weight of the shipment, which I believe is calculated elsewhere before getting to this module/section of code based on the $weight being passed into the function(s).
29 Dec 2014, 20:09
#4
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Posts:
968
Plugin Contributions:
0

Re: Code to read fields from db for freightquote shipping module

When i pasted the code in i reverted it back to the original code.( taking out some of my changes, they didnt work)
when i put numbers here it changes my rate quote, so i need a way to read those db entries and and fill in the dimensions,
			<Dimensions>
				<Length>12</Length>
				<Width>12</Width>
				<Height>12</Height>
				<Units>IN</Units>
			</Dimensions>
30 Dec 2014, 14:44
#5
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: Code to read fields from db for freightquote shipping module

And if you change this section of code to something like:
			<Dimensions>
				<Length>" . ceil($data->fields['products_freightquote_length']) . "</Length>
				<Width>" . ceil($data->fields['products_freightquote_width']) . "</Width>
				<Height>" . ceil($data->fields['products_freightquote_height']) . "</Height>
				<Units>IN</Units>
			</Dimensions>
30 Dec 2014, 16:11
#6
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Posts:
968
Plugin Contributions:
0

Re: Code to read fields from db for freightquote shipping module

ajeh this is what was returned
<Dimensions>
<Length>0</Length>
<Width>0</Width>
<Height>0</Height>
<Units>IN</Units>
</Dimensions>
30 Dec 2014, 16:32
#7
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: Code to read fields from db for freightquote shipping module

This needs something in that section for the $data as that is not defined in your code to get the data that should be there to use the change that I posted ...

I do not know what you need to create that, I just posted what you needed in the code to use set that information if the $data existed ...
30 Dec 2014, 17:09
#8
lhungil avatar

lhungil

Totally Zenned

Join Date:
Feb 2012
Posts:
1,818
Plugin Contributions:
2

Re: Code to read fields from db for freightquote shipping module

What are the current database fields for the database table "products" (TABLE_PRODUCTS)?
Is data present in the "additional" fields for the product being tested? What is the data?

When multiple products are in an order how will you handle them? Do they all go into one shipping package? Each product in their own shipping package? Different packaging depending on the quantity of each product? Using some sort of algorithm to place multiple products into a package (resulting in less packages than products)?



NOTE: I would argue strongly against adding "shipping" dimensions to a product. Why (data domain reason)? Because shipping dimensions are not dependent on the product alone and based on the packaging used when shipping. And the packaging used will be based on: product dimensions, selected packaging, and selected shipping carrier. Another reason (KISS reason)? When one alters an existing database table, upgrades and troubleshooting now need to take additional steps based upon the alterations. This can increase the amount of work required to maintain and upgrade Zen Cart in the future.
30 Dec 2014, 17:42
#9
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Posts:
968
Plugin Contributions:
0

Re: Code to read fields from db for freightquote shipping module

products_freightquote_length, products_freightquote_width, products_freightquote_height,
These products can only ship by themselves no other packaging can go with them.
i havent setup all product dimensions yet but this one is
http://floorz-n-more.com/index.php?main_page=product_info&cPath=59_181&products_id=1843
Length 44
Width 16
height 3
30 Dec 2014, 20:41
#10
lhungil avatar

lhungil

Totally Zenned

Join Date:
Feb 2012
Posts:
1,818
Plugin Contributions:
2

Re: Code to read fields from db for freightquote shipping module

jimmie:

... These products can only ship by themselves no other packaging can go with them. ...

Are you saying...

Modifications have been made to Zen Cart:
  • Customer is not allowed to add this product to their shopping cart when a product is already in the shopping cart.
  • Customer is not allowed to add other products to their shopping cart when this product is already in the cart.
  • This product is restricted to only allow a quantity of one.


OR

Multiple (mixed) products are allowed and:
  • Customer can have multiple products in the shopping cart.
  • Customer can add quantities greater than one.
  • One package (with dimensions) per quantity of each product for shipping.
30 Dec 2014, 21:05
#11
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Posts:
968
Plugin Contributions:
0

Re: Code to read fields from db for freightquote shipping module

this one. i use advanced shipper by ceon
Multiple (mixed) products are allowed and:
Customer can have multiple products in the shopping cart.
Customer can add quantities greater than one.
One package (with dimensions) per quantity of each product for shipping.
30 Dec 2014, 21:25
#12
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Posts:
968
Plugin Contributions:
0

Re: Code to read fields from db for freightquote shipping module

if a customer orders more than 4 it will switch automatically switch to freight, which will than ship on a pallet.(1 size)
30 Dec 2014, 22:14
#13
lhungil avatar

lhungil

Totally Zenned

Join Date:
Feb 2012
Posts:
1,818
Plugin Contributions:
2

Re: Code to read fields from db for freightquote shipping module

jimmie:

...
Multiple (mixed) products are allowed and:
Customer can have multiple products in the shopping cart.
Customer can add quantities greater than one.
One package (with dimensions) per quantity of each product for shipping.

This means you will need to code the shipping module (for parcel shipping) to add each package (with product) individually to the order with the correct weight and dimensions. This will require creating custom code.

At the minimum the custom code will need to loop through the order / shopping cart to add each package to the shipping quote request. It may need to split up the order into multiple quote requests if the number of packages exceeds the number allowed by the shipping carriers quote API. There are a number of other factors which may also come into play.


jimmie:

if a customer orders more than 4 it will switch automatically switch to freight, which will than ship on a pallet.(1 size)

Do you already have modifications made to your existing shipping modules to trigger this "switch"?
Do you have ONE set size box or packaging you always utilize on the pallet?
How are you determining the freight class (weight + dimensions) when multiple (mixed) products are shipped on one pallet?
30 Dec 2014, 23:07
#14
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Posts:
968
Plugin Contributions:
0

Re: Code to read fields from db for freightquote shipping module

advanced shipper has the ability to ship by category,number of packages,weight,product,manufacturers,ups,fedex,usps, i plan to have a notice that explains that these items require special shipping and handling and will ship independently of any others. The way my fedex is setup it is preset to
		<Dimensions>
				<Length>1</Length>
				<Width>1</Width>
				<Height>1</Height>
				<Units>IN</Units>
			</Dimensions>

so no matter what is in cart dimensions never change
30 Dec 2014, 23:14
#15
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Posts:
968
Plugin Contributions:
0

Re: Code to read fields from db for freightquote shipping module

i had the freightquote module merged into advanced shipper
31 Dec 2014, 03:32
#16
lhungil avatar

lhungil

Totally Zenned

Join Date:
Feb 2012
Posts:
1,818
Plugin Contributions:
2

Re: Code to read fields from db for freightquote shipping module

Hope you do not mind all the questions, but the answers are very important. Hopefully they will help anyone reading this thread get a more detailed picture of what is involved (and the complexity involved with handling all scenarios involving dimensional shipping).

jimmie:

... so no matter what is in cart dimensions never change ...

You are asking for trouble and incorrect shipping quotes if the dimensions sent to the shipping carrier (parcel or freight) never change. The bulkier a package, typically the greater cost to ship. If dimensions are sent in the quote request, the dimensions need to be specified for each package (or shipping container) to avoid an operating loss due to under-billing. This is especially true for freight, were one is always charged based on freight class (combination of volume + weight) and the overall weight.

jimmie:

... freightquote module merged into advanced shipper ...

A quick look at the code from your post on the subject reveals a couple red flags in the shipping module portion of the code. For example if no freight class is present it defaults to the cheapest possible freight class. The code handling dimensions also fails to take into consideration a quantity greater than one.

For Example: One product which is 6x6x6 may fit in a 6x6x6 space, but five of those products will take up considerable more space (at least 5 times the volume - possibly more as square volume is used for most freight shipping).

Most of the freight API's I've worked with for quotes will ignore dimensions if the freight class is sent (thus quotes should usually be close if the freight class is correct and dimensions are wrong). However if the API uses the dimensions to calculate the class (and ignores the class or detects the class is incorrect) you may run into issues. You will also run into issues when an order contains large products and / or quantities (taking up more volume than the truck can carry); especially if the volume exceeds a TruckLoad.

From the shipping module in the other thread:
...
$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'] * $product['weight']),
  'Length' => ceil($data->fields['products_freightquote_length']),
  'Width' => ceil($data->fields['products_freightquote_width']),
  'Height' => ceil($data->fields['products_freightquote_height']),
...
31 Dec 2014, 03:50
#17
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Posts:
968
Plugin Contributions:
0

Re: Code to read fields from db for freightquote shipping module

i sell flooring most of that will ship freight handled by freightquote (freight class is set it products) if a customer buys flooring everything is fine cause it ships freight, but if they didint buy enough and need another box or roll of pad i can send it fedex. In theory i could set up my weights like this, L x w x H /166 and take the higher number as weight, but than my freightquote would get wrong weight. If they order other than flooring they will see another quote from fedex or ups or usps.
Ex.
7 rolls of pad, 700 ft of Laminate flooring, Moldings all ship freight Price:$140.00
2 Knives, roll of tape, Nails all ship from Fedex or ETC. Price: 30.00
1 special laminate cutter made by crain shipped by crain Price: $15.00
Total Shipping is $ 185.00
31 Dec 2014, 03:53
#18
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Posts:
968
Plugin Contributions:
0

Re: Code to read fields from db for freightquote shipping module

i have made a clone of advanced shipper and run it side by side 1 handles stock and 1 handles drop shipping
31 Dec 2014, 03:56
#19
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Posts:
968
Plugin Contributions:
0

Re: Code to read fields from db for freightquote shipping module

i can setup box weight in advanced shipper