function quote($method = '') { global $_POST, $order, $shipping_weight, $shipping_num_boxes; if (tep_not_null($method) && isset($this->types[$method])) { $prod = $method; } else { if ($order->delivery['country']['iso_code_2'] == 'CA') { $prod = 'STD'; } else { $prod = 'GNDRES'; } } if ($method) { $this->_upsAction('3'); } // return a single quote $this->_upsProduct($prod); $country_name = tep_get_countries(SHIPPING_ORIGIN_COUNTRY, true); $this->_upsOrigin(SHIPPING_ORIGIN_ZIP, $country_name['countries_iso_code_2']); $this->_upsDest($order->delivery['postcode'], $order->delivery['country']['iso_code_2']); $this->_upsRate(MODULE_SHIPPING_UPS_PICKUP); $this->_upsContainer(MODULE_SHIPPING_UPS_PACKAGE); $this->_upsWeight($shipping_weight); $this->_upsRescom(MODULE_SHIPPING_UPS_RES); $upsQuote = $this->_upsGetQuote(); if (is_array($upsQuote) && sizeof($upsQuote) > 0) { $this->quotes = array('id' => $this->code, 'module' => $this->title . ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . 'lbs)'); $methods = array(); $allowed_methods = explode(", ", MODULE_SHIPPING_UPS_TYPES); $std_rcd = false; $qsize = sizeof($upsQuote); for ($i = 0; $i < $qsize; $i++) { list($type, $cost) = each($upsQuote[$i]); if ($type == 'STD') { if ($std_rcd) { continue; } else { $std_rcd = true; } } if (!in_array($type, $allowed_methods)) { continue; } $methods[] = array('id' => $type, 'title' => $this->types[$type], 'cost' => ($cost + MODULE_SHIPPING_UPS_HANDLING) * $shipping_num_boxes); } $this->quotes['methods'] = $methods; if ($this->tax_class > 0) { $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); } } else { $this->quotes = array('module' => $this->title, 'error' => 'We are unable to obtain a rate quote for UPS shipping.<br>Please contact the store if no other alternative is shown.'); } if (tep_not_null($this->icon)) { $this->quotes['icon'] = tep_image($this->icon, $this->title); } return $this->quotes; }
function quote($method = '') { global $osC_Tax, $order, $shipping_weight, $shipping_num_boxes, $osC_Weight; if (tep_not_null($method) && isset($this->types[$method])) { $prod = $method; } else { $prod = 'GNDRES'; } if ($method) { $this->_upsAction('3'); } // return a single quote $this->_upsProduct($prod); $shipping_weight = $osC_Weight->convert($shipping_weight, SHIPPING_WEIGHT_UNIT, MODULE_SHIPPING_UPS_WEIGHT_UNIT); $country_name = tep_get_countries(SHIPPING_ORIGIN_COUNTRY, true); $this->_upsOrigin(SHIPPING_ORIGIN_ZIP, $country_name['countries_iso_code_2']); $this->_upsDest($order->delivery['postcode'], $order->delivery['country']['iso_code_2']); $this->_upsRate(MODULE_SHIPPING_UPS_PICKUP); $this->_upsContainer(MODULE_SHIPPING_UPS_PACKAGE); $this->_upsWeight($shipping_weight); $this->_upsRescom(MODULE_SHIPPING_UPS_RES); $upsQuote = $this->_upsGetQuote(); if (is_array($upsQuote) && sizeof($upsQuote) > 0) { $this->quotes = array('id' => $this->code, 'module' => $this->title . ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . 'lbs)', 'tax' => 0); $methods = array(); $qsize = sizeof($upsQuote); for ($i = 0; $i < $qsize; $i++) { list($type, $cost) = each($upsQuote[$i]); $methods[] = array('id' => $type, 'title' => $this->types[$type], 'cost' => ($cost + MODULE_SHIPPING_UPS_HANDLING) * $shipping_num_boxes); } $this->quotes['methods'] = $methods; if ($this->tax_class > 0) { $this->quotes['tax'] = $osC_Tax->getTaxRate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); } } else { $this->quotes = array('module' => $this->title, 'error' => 'An error occured with the UPS shipping calculations.<br>' . $upsQuote . '<br>If you prefer to use UPS as your shipping method, please contact the store owner.'); } if (tep_not_null($this->icon)) { $this->quotes['icon'] = tep_image($this->icon, $this->title); } return $this->quotes; }
function quote($method = '') { global $shipping_weight, $shipping_num_boxes, $cart, $offer_order; if (defined("SHIPPING_ORIGIN_COUNTRY")) { $countries_array = tep_get_countries(SHIPPING_ORIGIN_COUNTRY, true); $this->country = $countries_array['countries_iso_code_2']; } /* $SHIPPING_BOX_WEIGHT=1; $SHIPPING_BOX_PADDING=0; $this->cart_weight_per_one = $this->total_weight; if ($SHIPPING_BOX_WEIGHT >= $this->cart_weight_per_one*$SHIPPING_BOX_PADDING/100) { $this->cart_weight_per_one = $this->cart_weight_per_one+$SHIPPING_BOX_WEIGHT; } else { $this->cart_weight_per_one = $this->cart_weight_per_one + ($this->cart_weight_per_one*$SHIPPING_BOX_PADDING/100); } $this->_setPackageType('01'); //$this->_setPackageType('01'); if ($this->packageType == '01' && $this->cart_weight_per_one < 1) { $this->_setWeight(1); } else { */ $this->_setPackageType('01'); $weight = $this->total_weight + $this->pack_nums * $this->pack_weight; // ONLY 150 LBS IN PACKAGE !!!!!!!!!!!! if ($weight > 150) { $addition_packs_num = ceil($weight / '150') - 1; $addition_packs_num = 2; $this->pack_nums = $this->pack_nums + $addition_packs_num; $weight = $weight + $addition_packs_num * $this->pack_weight; } //echo $weight; echo "<br/>"; $this->_setWeight($weight); $fedexQuote = $this->_getQuote(); return $fedexQuote; }
case 'new': $heading[] = array('text' => '<strong>' . TEXT_INFO_HEADING_NEW_ZONE . '</strong>'); $contents = array('form' => tep_draw_form('zones', FILENAME_ZONES, 'page=' . $HTTP_GET_VARS['page'] . '&action=insert')); $contents[] = array('text' => TEXT_INFO_INSERT_INTRO); $contents[] = array('text' => '<br>' . TEXT_INFO_ZONES_NAME . '<br>' . tep_draw_input_field('zone_name')); $contents[] = array('text' => '<br>' . TEXT_INFO_ZONES_CODE . '<br>' . tep_draw_input_field('zone_code')); $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_NAME . '<br>' . tep_draw_pull_down_menu('zone_country_id', tep_get_countries())); $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_insert.gif', IMAGE_INSERT) . ' <a href="' . tep_href_link(FILENAME_ZONES, 'page=' . $HTTP_GET_VARS['page']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); break; case 'edit': $heading[] = array('text' => '<strong>' . TEXT_INFO_HEADING_EDIT_ZONE . '</strong>'); $contents = array('form' => tep_draw_form('zones', FILENAME_ZONES, 'page=' . $HTTP_GET_VARS['page'] . '&zID=' . $zInfo->zone_id . '&action=save')); $contents[] = array('text' => TEXT_INFO_EDIT_INTRO); $contents[] = array('text' => '<br>' . TEXT_INFO_ZONES_NAME . '<br>' . tep_draw_input_field('zone_name', $zInfo->zone_name)); $contents[] = array('text' => '<br>' . TEXT_INFO_ZONES_CODE . '<br>' . tep_draw_input_field('zone_code', $zInfo->zone_code)); $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_NAME . '<br>' . tep_draw_pull_down_menu('zone_country_id', tep_get_countries(), $zInfo->countries_id)); $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_update.gif', IMAGE_UPDATE) . ' <a href="' . tep_href_link(FILENAME_ZONES, 'page=' . $HTTP_GET_VARS['page'] . '&zID=' . $zInfo->zone_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); break; case 'delete': $heading[] = array('text' => '<strong>' . TEXT_INFO_HEADING_DELETE_ZONE . '</strong>'); $contents = array('form' => tep_draw_form('zones', FILENAME_ZONES, 'page=' . $HTTP_GET_VARS['page'] . '&zID=' . $zInfo->zone_id . '&action=deleteconfirm')); $contents[] = array('text' => TEXT_INFO_DELETE_INTRO); $contents[] = array('text' => '<br><strong>' . $zInfo->zone_name . '</strong>'); $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . tep_href_link(FILENAME_ZONES, 'page=' . $HTTP_GET_VARS['page'] . '&zID=' . $zInfo->zone_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); break; default: if (isset($zInfo) && is_object($zInfo)) { $heading[] = array('text' => '<strong>' . $zInfo->zone_name . '</strong>'); $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_ZONES, 'page=' . $HTTP_GET_VARS['page'] . '&zID=' . $zInfo->zone_id . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_ZONES, 'page=' . $HTTP_GET_VARS['page'] . '&zID=' . $zInfo->zone_id . '&action=delete') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a>'); $contents[] = array('text' => '<br>' . TEXT_INFO_ZONES_NAME . '<br>' . $zInfo->zone_name . ' (' . $zInfo->zone_code . ')'); $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_NAME . ' ' . $zInfo->countries_name);
function tep_get_boards_countries() { $countries_array = array(array('id' => '', 'text' => '')); $countries = tep_get_countries(); reset($countries); while (list(, $country_info) = each($countries)) { $countries_array[] = array('id' => $country_info['text'], 'text' => $country_info['text']); } return $countries_array; }
<td class="smallText" width="40%"><?php echo '<b>' . TEXT_INFO_ZONES_CODE . '</b>'; ?> </td> <td class="smallText" width="60%"><?php echo osc_draw_input_field('zone_code', $zInfo->zone_code); ?> </td> </tr> <tr> <td class="smallText" width="40%"><?php echo '<b>' . TEXT_INFO_COUNTRY_NAME . '</b>'; ?> </td> <td class="smallText" width="60%"><?php echo osc_draw_pull_down_menu('zone_country_id', tep_get_countries(), $zInfo->countries_id); ?> </td> </tr> </table> <p align="center"><?php echo '<input type="submit" value="' . IMAGE_UPDATE . '" class="operationButton"> <input type="button" value="' . IMAGE_CANCEL . '" onClick="toggleInfoBox(\'zDefault\');" class="operationButton">'; ?> </p> </form> </div> </div> <div id="infoBox_zDelete" <?php
function tep_get_country_list($name, $selected = '', $parameters = '') { $countries_array = array(array('id' => '', 'text' => OSCOM::getDef('pull_down_default'))); $countries = tep_get_countries(); for ($i = 0, $n = sizeof($countries); $i < $n; $i++) { $countries_array[] = array('id' => $countries[$i]['countries_id'], 'text' => $countries[$i]['countries_name']); } return HTML::selectField($name, $countries_array, $selected, $parameters); }
$contents = array(); if ($action == 'list') { switch ($saction) { case 'new': $heading[] = array('text' => '<strong>' . OSCOM::getDef('text_info_heading_new_sub_zone') . '</strong>'); $contents = array('form' => HTML::form('zones', OSCOM::link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&' . (isset($_GET['sID']) ? 'sID=' . $_GET['sID'] . '&' : '') . 'saction=insert_sub'))); $contents[] = array('text' => OSCOM::getDef('text_info_new_sub_zone_intro')); $contents[] = array('text' => '<br />' . OSCOM::getDef('text_info_country') . '<br />' . HTML::selectField('zone_country_id', tep_get_countries(OSCOM::getDef('text_all_countries')), '', 'onchange="update_zone(this.form);"')); $contents[] = array('text' => '<br />' . OSCOM::getDef('text_info_country_zone') . '<br />' . HTML::selectField('zone_id', tep_prepare_country_zones_pull_down())); $contents[] = array('align' => 'center', 'text' => '<br />' . HTML::button(OSCOM::getDef('image_save'), 'fa fa-save') . HTML::button(OSCOM::getDef('image_cancel'), 'fa fa-close', OSCOM::link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&' . (isset($_GET['sID']) ? 'sID=' . $_GET['sID'] : '')))); break; case 'edit': $heading[] = array('text' => '<strong>' . OSCOM::getDef('text_info_heading_edit_sub_zone') . '</strong>'); $contents = array('form' => HTML::form('zones', OSCOM::link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $sInfo->association_id . '&saction=save_sub'))); $contents[] = array('text' => OSCOM::getDef('text_info_edit_sub_zone_intro')); $contents[] = array('text' => '<br />' . OSCOM::getDef('text_info_country') . '<br />' . HTML::selectField('zone_country_id', tep_get_countries(OSCOM::getDef('text_all_countries')), $sInfo->zone_country_id, 'onchange="update_zone(this.form);"')); $contents[] = array('text' => '<br />' . OSCOM::getDef('text_info_country_zone') . '<br />' . HTML::selectField('zone_id', tep_prepare_country_zones_pull_down($sInfo->zone_country_id), $sInfo->zone_id)); $contents[] = array('align' => 'center', 'text' => '<br />' . HTML::button(OSCOM::getDef('image_save'), 'fa fa-save') . HTML::button(OSCOM::getDef('image_cancel'), 'fa fa-close', OSCOM::link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $sInfo->association_id))); break; case 'delete': $heading[] = array('text' => '<strong>' . OSCOM::getDef('text_info_heading_delete_sub_zone') . '</strong>'); $contents = array('form' => HTML::form('zones', OSCOM::link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $sInfo->association_id . '&saction=deleteconfirm_sub'))); $contents[] = array('text' => OSCOM::getDef('text_info_delete_sub_zone_intro')); $contents[] = array('text' => '<br /><strong>' . $sInfo->countries_name . '</strong>'); $contents[] = array('align' => 'center', 'text' => '<br />' . HTML::button(OSCOM::getDef('image_delete'), 'fa fa-trash') . HTML::button(OSCOM::getDef('image_cancel'), 'fa fa-close', OSCOM::link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $sInfo->association_id))); break; default: if (isset($sInfo) && is_object($sInfo)) { $heading[] = array('text' => '<strong>' . $sInfo->countries_name . '</strong>'); $contents[] = array('align' => 'center', 'text' => HTML::button(OSCOM::getDef('image_edit'), 'fa fa-edit', OSCOM::link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $sInfo->association_id . '&saction=edit')) . HTML::button(OSCOM::getDef('image_delete'), 'fa fa-trash', OSCOM::link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $sInfo->association_id . '&saction=delete'))); $contents[] = array('text' => '<br />' . OSCOM::getDef('text_info_date_added') . ' ' . DateTime::toShort($sInfo->date_added));
function tep_cfg_pull_down_country_list($country_id) { return HTML::selectField('configuration_value', tep_get_countries(), $country_id); }
case 'new': $heading[] = array('text' => '<strong>' . OSCOM::getDef('text_info_heading_new_zone') . '</strong>'); $contents = array('form' => HTML::form('zones', OSCOM::link(FILENAME_ZONES, 'page=' . $_GET['page'] . '&action=insert'))); $contents[] = array('text' => OSCOM::getDef('text_info_insert_intro')); $contents[] = array('text' => '<br />' . OSCOM::getDef('text_info_zones_name') . '<br />' . HTML::inputField('zone_name')); $contents[] = array('text' => '<br />' . OSCOM::getDef('text_info_zones_code') . '<br />' . HTML::inputField('zone_code')); $contents[] = array('text' => '<br />' . OSCOM::getDef('text_info_country_name') . '<br />' . HTML::selectField('zone_country_id', tep_get_countries())); $contents[] = array('align' => 'center', 'text' => '<br />' . HTML::button(OSCOM::getDef('image_save'), 'fa fa-save') . HTML::button(OSCOM::getDef('image_cancel'), 'fa fa-close', OSCOM::link(FILENAME_ZONES, 'page=' . $_GET['page']))); break; case 'edit': $heading[] = array('text' => '<strong>' . OSCOM::getDef('text_info_heading_edit_zone') . '</strong>'); $contents = array('form' => HTML::form('zones', OSCOM::link(FILENAME_ZONES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->zone_id . '&action=save'))); $contents[] = array('text' => OSCOM::getDef('text_info_edit_intro')); $contents[] = array('text' => '<br />' . OSCOM::getDef('text_info_zones_name') . '<br />' . HTML::inputField('zone_name', $cInfo->zone_name)); $contents[] = array('text' => '<br />' . OSCOM::getDef('text_info_zones_code') . '<br />' . HTML::inputField('zone_code', $cInfo->zone_code)); $contents[] = array('text' => '<br />' . OSCOM::getDef('text_info_country_name') . '<br />' . HTML::selectField('zone_country_id', tep_get_countries(), $cInfo->countries_id)); $contents[] = array('align' => 'center', 'text' => '<br />' . HTML::button(OSCOM::getDef('image_save'), 'fa fa-save') . HTML::button(OSCOM::getDef('image_cancel'), 'fa fa-close', OSCOM::link(FILENAME_ZONES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->zone_id))); break; case 'delete': $heading[] = array('text' => '<strong>' . OSCOM::getDef('text_info_heading_delete_zone') . '</strong>'); $contents = array('form' => HTML::form('zones', OSCOM::link(FILENAME_ZONES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->zone_id . '&action=deleteconfirm'))); $contents[] = array('text' => OSCOM::getDef('text_info_delete_intro')); $contents[] = array('text' => '<br /><strong>' . $cInfo->zone_name . '</strong>'); $contents[] = array('align' => 'center', 'text' => '<br />' . HTML::button(OSCOM::getDef('image_delete'), 'fa fa-trash') . HTML::button(OSCOM::getDef('image_cancel'), 'fa fa-close', OSCOM::link(FILENAME_ZONES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->zone_id))); break; default: if (isset($cInfo) && is_object($cInfo)) { $heading[] = array('text' => '<strong>' . $cInfo->zone_name . '</strong>'); $contents[] = array('align' => 'center', 'text' => HTML::button(OSCOM::getDef('image_edit'), 'fa fa-edit', OSCOM::link(FILENAME_ZONES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->zone_id . '&action=edit')) . HTML::button(OSCOM::getDef('image_delete'), 'fa fa-trash', OSCOM::link(FILENAME_ZONES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->zone_id . '&action=delete'))); $contents[] = array('text' => '<br />' . OSCOM::getDef('text_info_zones_name') . '<br />' . $cInfo->zone_name . ' (' . $cInfo->zone_code . ')'); $contents[] = array('text' => '<br />' . OSCOM::getDef('text_info_country_name') . ' ' . $cInfo->countries_name);
?> <tr> <td class="main"><?php echo OSCOM::getDef('entry_country'); ?> </td> <td class="main"> <?php if ($error == true) { if ($entry_country_error == true) { echo HTML::selectField('entry_country_id', tep_get_countries(), $cInfo->entry_country_id) . ' ' . OSCOM::getDef('entry_country_error'); } else { echo tep_get_country_name($cInfo->entry_country_id) . HTML::hiddenField('entry_country_id'); } } else { echo HTML::selectField('entry_country_id', tep_get_countries(), $cInfo->entry_country_id); } ?> </td> </tr> </table></td> </tr> <tr> <td class="formAreaTitle"><?php echo OSCOM::getDef('category_contact'); ?> </td> </tr> <tr> <td class="formArea"><table border="0" cellspacing="2" cellpadding="2"> <tr>
echo '<a href="' . tep_href_link(FILENAME_SELF_DELIVERY, 'action=new&page=' . $HTTP_GET_VARS['page']) . '">' . tep_image_button('button_insert.gif', IMAGE_INSERT) . '</a>'; ?> </td> </tr> <?php } ?> </table></td> <?php $heading = array(); $contents = array(); switch ($action) { case 'new': case 'edit': $city_field = ''; $countries = tep_get_countries('', true); if ($action == 'new') { $self_delivery = array('country_id' => $countries[0]['id'], 'postcode' => '', 'zone_id' => 0, 'suburb' => '', 'city' => '', 'street_address' => '', 'telephone' => '', 'self_delivery_status' => 0, 'self_delivery_description' => '', 'self_delivery_cost' => '', 'self_delivery_free' => '', 'self_delivery_days' => '', 'self_delivery_only_periodicals' => ''); $dInfo = new objectInfo($self_delivery); } if (sizeof($countries == 1)) { $country_cities = array(); $old_city_name = ''; $parent_cities_query = tep_db_query("select city_id, city_name from " . TABLE_CITIES . " where parent_id = '0' and suburb_name = '' order by city_id"); while ($parent_cities = tep_db_fetch_array($parent_cities_query)) { if ($old_city_name != $parent_cities['city_name']) { $country_cities[$parent_cities['city_id']] = $parent_cities['city_name']; $old_city_name = $parent_cities['city_name']; } } asort($country_cities, SORT_LOCALE_STRING);
<td class="formArea"><table border="0" cellspacing="2" cellpadding="2"> <tr> <td class="main" width="200"><?php echo ENTRY_COUNTRY; ?> </td> <td class="main"> <?php if ($error == true) { if ($entry_country_error == true) { echo tep_draw_pull_down_menu('entry_country_id', array_merge(array(array('id' => '', 'text' => TEXT_DEFAULT_SELECT)), tep_get_countries()), $cInfo->entry_country_id) . ' ' . ENTRY_COUNTRY_ERROR; } else { echo tep_get_country_name($cInfo->entry_country_id) . tep_draw_hidden_field('entry_country_id'); } } else { echo tep_draw_pull_down_menu('entry_country_id', array_merge(array(array('id' => '', 'text' => TEXT_DEFAULT_SELECT)), tep_get_countries()), $cInfo->entry_country_id, '', ENTRY_COUNTRY_MIN_LENGTH == 'true' ? true : false); } ?> </td> </tr> <?php if (ACCOUNT_STATE == 'true') { ?> <tr> <td class="main" width="200"><?php echo ENTRY_STATE; ?> </td> <td class="main"> <?php $entry_state = tep_get_zone_name($cInfo->entry_country_id, $cInfo->entry_zone_id, $cInfo->entry_state);
echo tep_image('templates/' . $template . '/images/icons/16x16/configure.png', IMAGE_EDIT, '16', '16') . ' ' . $zeInfo->countries_name . ': ' . $zeInfo->zone_name; ?> </div> <div class="infoBoxContent"> <?php echo tep_draw_form('zeEdit', FILENAME_GEO_ZONES, 'page=' . $_GET['page'] . '&zID=' . $_GET['zID'] . '&action=list&entriesPage=' . $_GET['entriesPage'] . '&zeID=' . $zeInfo->association_id . '&entriesAction=zeSave'); ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="smallText" width="40%"><?php echo '<b>' . TEXT_INFO_COUNTRY . '</b>'; ?> </td> <td class="smallText" width="60%"><?php echo osc_draw_pull_down_menu('zone_country_id', tep_get_countries(TEXT_ALL_COUNTRIES), $zeInfo->zone_country_id, 'onChange="update_zone(this.form);"'); ?> </td> </tr> <tr> <td class="smallText" width="40%"><?php echo '<b>' . TEXT_INFO_COUNTRY_ZONE . '</b>'; ?> </td> <td class="smallText" width="60%"><?php echo osc_draw_pull_down_menu('zone_id', tep_prepare_country_zones_pull_down($zeInfo->zone_country_id), $zeInfo->zone_id); ?> </td> </tr> </table>
if (ORDER_EDITOR_USE_AJAX == 'true') { ?> onChange="updateOrdersField('billing_postcode', encodeURIComponent(this.value))"<?php } ?> ></td> <td class="dataTableContent" valign="middle" align="right" nowrap><?php echo ENTRY_COUNTRY; ?> </td> <td class="dataTableContent" valign="top"> <?php if (ORDER_EDITOR_USE_AJAX == 'true') { echo tep_draw_pull_down_menu('update_billing_country_id', tep_get_countries(), $order->billing['country_id'], 'style="width: 200px;" onchange="update_zone(\'update_billing_country_id\', \'update_billing_zone_id\', \'billingStateInput\', \'billingStateMenu\'); updateOrdersField(\'billing_country\', this.options[this.selectedIndex].text);"'); } else { echo tep_draw_pull_down_menu('update_billing_country_id', tep_get_countries(), $order->billing['country_id'], 'style="width: 200px;" onchange="update_zone(\'update_billing_country_id\', \'update_billing_zone_id\', \'billingStateInput\', \'billingStateMenu\'); updateOrdersField(\'billing_country\', this.options[this.selectedIndex].text);"'); } ?> </td> </tr> </table> </td> </tr> <!-- billing_address_eof //--> <!-- payment_method bof //--> <tr> <td class="dataTableContent"> <table cellspacing="0" cellpadding="2" width="100%"> <tr class="dataTableHeadingRow"> <td colspan="2" class="dataTableHeadingContent"><?php
<td class="main"><?php echo ENTRY_POST_CODE; ?> </td> <td class="main"><?php echo tep_draw_input_field('affiliate_postcode', $aInfo->affiliate_postcode, 'maxlength="8"', true); ?> </td> </tr> <tr> <td class="main"><?php echo ENTRY_COUNTRY; ?> </td> <td class="main"><?php echo tep_draw_pull_down_menu('affiliate_country_id', tep_get_countries(), $aInfo->affiliate_country_id, 'onChange="update_zone(this.form);"'); ?> </td> </tr> <?php if (ACCOUNT_STATE == 'true') { ?> <tr> <td class="main"><?php echo ENTRY_STATE; ?> </td> <td class="main"><?php echo tep_draw_pull_down_menu('affiliate_zone_id', tep_prepare_country_zones_pull_down($aInfo->affiliate_country_id), $aInfo->affiliate_zone_id, 'onChange="resetStateText(this.form);"'); ?> </td>
</tr> </table> <?php } ?> </td> <?php $heading = array(); $contents = array(); if ($action == 'list') { switch ($saction) { case 'new': $heading[] = array('text' => '<strong>' . TEXT_INFO_HEADING_NEW_SUB_ZONE . '</strong>'); $contents = array('form' => tep_draw_form('zones', FILENAME_GEO_ZONES, 'zpage=' . $HTTP_GET_VARS['zpage'] . '&zID=' . $HTTP_GET_VARS['zID'] . '&action=list&spage=' . $HTTP_GET_VARS['spage'] . '&' . (isset($HTTP_GET_VARS['sID']) ? 'sID=' . $HTTP_GET_VARS['sID'] . '&' : '') . 'saction=insert_sub')); $contents[] = array('text' => TEXT_INFO_NEW_SUB_ZONE_INTRO); $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY . '<br>' . tep_draw_pull_down_menu('zone_country_id', tep_get_countries(TEXT_ALL_COUNTRIES), '', 'onChange="getXMLDOM(\'' . FILENAME_GEO_ZONES . '?country_id=\'+this.options[this.selectedIndex].value, \'zone_id\');"') . '<br><div id="zone_id"></div>'); $contents[] = array('text' => '<br>' . TEXT_INFO_FACTOR . '<br>' . tep_draw_input_field('zone_factor', '', 'size="4"')); $contents[] = array('text' => '<br>' . TEXT_INFO_DELIVERY_TIME . '<br>' . tep_draw_input_field('zone_delivery_time')); $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_insert.gif', IMAGE_INSERT) . ' <a href="' . tep_href_link(FILENAME_GEO_ZONES, 'zpage=' . $HTTP_GET_VARS['zpage'] . '&zID=' . $HTTP_GET_VARS['zID'] . '&action=list&spage=' . $HTTP_GET_VARS['spage'] . '&' . (isset($HTTP_GET_VARS['sID']) ? 'sID=' . $HTTP_GET_VARS['sID'] : '')) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); break; case 'edit': $heading[] = array('text' => '<strong>' . TEXT_INFO_HEADING_EDIT_SUB_ZONE . '</strong>'); $contents = array('form' => tep_draw_form('zones', FILENAME_GEO_ZONES, 'zpage=' . $HTTP_GET_VARS['zpage'] . '&zID=' . $HTTP_GET_VARS['zID'] . '&action=list&spage=' . $HTTP_GET_VARS['spage'] . '&sID=' . $sInfo->association_id . '&saction=save_sub')); $contents[] = array('text' => TEXT_INFO_EDIT_SUB_ZONE_INTRO); $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY . '<br>' . tep_draw_hidden_field('zone_country_id', $sInfo->zone_country_id) . $sInfo->countries_name); $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_ZONE . '<br>' . tep_draw_hidden_field('zone_id', $sInfo->zone_id) . $sInfo->zone_name); $zone_cities = tep_get_cities_tree($sInfo->zone_id, 0, '', 0); $contents[] = array('text' => '<br>' . TEXT_INFO_CITY_NAME . '<br>' . tep_draw_pull_down_menu('city_id[]', $zone_cities, $sInfo->zone_localities, 'size="15" style="width: 100%;" multiple="multiple"')); $contents[] = array('text' => '<br>' . TEXT_INFO_FACTOR . '<br>' . tep_draw_input_field('zone_factor', $sInfo->zone_factor, 'size="4"')); $contents[] = array('text' => '<br>' . TEXT_INFO_DELIVERY_TIME . '<br>' . tep_draw_input_field('zone_delivery_time', $sInfo->zone_delivery_time)); $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_update.gif', IMAGE_UPDATE) . ' <a href="' . tep_href_link(FILENAME_GEO_ZONES, 'zpage=' . $HTTP_GET_VARS['zpage'] . '&zID=' . $HTTP_GET_VARS['zID'] . '&action=list&spage=' . $HTTP_GET_VARS['spage'] . '&sID=' . $sInfo->association_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
function quote($method = '') { global $shipping_weight, $shipping_num_boxes, $cart, $order; if (tep_not_null($method)) { $this->_setService($method); } if (MODULE_SHIPPING_FEDEX1_ENVELOPE == 'True') { if ($shipping_weight <= 0.5 && MODULE_SHIPPING_FEDEX1_WEIGHT == 'LBS' || $shipping_weight <= 0.2 && MODULE_SHIPPING_FEDEX1_WEIGHT == 'KGS') { $this->_setPackageType('06'); } else { $this->_setPackageType('01'); } } else { $this->_setPackageType('01'); } if ($this->packageType == '01' && $shipping_weight < 1) { $this->_setWeight(1); } else { $this->_setWeight($shipping_weight); } $totals = $cart->show_total(); $this->_setInsuranceValue($totals / $shipping_num_boxes); if (defined("SHIPPING_ORIGIN_COUNTRY")) { $countries_array = tep_get_countries(SHIPPING_ORIGIN_COUNTRY, true); $this->country = $countries_array['countries_iso_code_2']; } else { $this->country = STORE_ORIGIN_COUNTRY; } $fedexQuote = $this->_getQuote(); if (is_array($fedexQuote)) { if (isset($fedexQuote['error'])) { $this->quotes = array('module' => $this->title, 'error' => $fedexQuote['error']); } else { $this->quotes = array('id' => $this->code, 'module' => $this->title . ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . strtolower(MODULE_SHIPPING_FEDEX1_WEIGHT) . ')'); $methods = array(); foreach ($fedexQuote as $type => $cost) { $skip = FALSE; $this->surcharge = 0; if ($this->intl === FALSE) { if (strlen($type) > 2 && MODULE_SHIPPING_FEDEX1_TRANSIT == 'True') { $service_descr = $this->domestic_types[substr($type, 0, 2)] . ' (' . substr($type, 2, 1) . ' days)'; } else { $service_descr = $this->domestic_types[substr($type, 0, 2)]; } switch (substr($type, 0, 2)) { case 90: if ($order->delivery['company'] != '') { $skip = TRUE; } break; case 92: if ($this->country == "CA") { if ($order->delivery['company'] == '') { $this->surcharge = MODULE_SHIPPING_FEDEX1_RESIDENTIAL; } } else { if ($order->delivery['company'] == '') { $skip = TRUE; } } break; default: if ($this->country != "CA" && substr($type, 0, 2) < "90" && $order->delivery['company'] == '') { $this->surcharge = MODULE_SHIPPING_FEDEX1_RESIDENTIAL; } break; } } else { if (strlen($type) > 2 && MODULE_SHIPPING_FEDEX1_TRANSIT == 'True') { $service_descr = $this->international_types[substr($type, 0, 2)] . ' (' . substr($type, 2, 1) . ' days)'; } else { $service_descr = $this->international_types[substr($type, 0, 2)]; } } if ($method) { if (substr($type, 0, 2) != $method) { $skip = TRUE; } } if (!$skip) { $methods[] = array('id' => substr($type, 0, 2), 'title' => $service_descr, 'cost' => (SHIPPING_HANDLING + MODULE_SHIPPING_FEDEX1_SURCHARGE + $this->surcharge + $cost) * $shipping_num_boxes); } } $this->quotes['methods'] = $methods; if ($this->tax_class > 0) { $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); } } } else { $this->quotes = array('module' => $this->title, 'error' => 'An error occured with the fedex shipping calculations.<br>Fedex may not deliver to your country, or your postal code may be wrong.'); } if (tep_not_null($this->icon)) { $this->quotes['icon'] = tep_image($this->icon, $this->title); } return $this->quotes; }
function quote($method = '') { global $order, $cart, $customer_id, $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' => $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', 'PickupDate' => $this->next_business_day(), '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 = tep_get_countries(MODULE_SHIPPING_FREIGHTQUOTE_SHIP_COUNTRY, true); $ship_country = $ship_country['countries_iso_code_2']; //Retrieve all products in the cart $products = $cart->get_products(); //Determine the type of location selected by the customer $delivery_location = 1; 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) { $product_query = tep_db_query("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"); $data = tep_db_fetch_array($product_query); if ($data['products_freightquote_enable'] == '1') { $product_list[] = array('Class' => tep_not_null($data['products_freightquote_class']) ? $data['products_freightquote_class'] : '50', 'ProductDescription' => $product['name'], 'Weight' => ceil($product['quantity'] * (int) $product['weight']), 'Length' => ceil($data['products_freightquote_length']), 'Width' => ceil($data['products_freightquote_width']), 'Height' => ceil($data['products_freightquote_height']), 'PackageType' => tep_not_null($data['products_freightquote_package_type']) ? $data['products_freightquote_package_type'] : 'Boxes', 'DeclaredValue' => round($product['price']), 'CommodityType' => tep_not_null($data['products_freightquote_commodity_type']) ? $data['products_freightquote_commodity_type'] : 'GeneralMerchandise', 'ContentType' => tep_not_null($data['products_freightquote_content_type']) ? $data['products_freightquote_content_type'] : 'NewCommercialGoods', 'IsHazardousMaterial' => $data['products_freightquote_hzmt'], 'NMFC' => $data['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 * $n; $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=\'' . tep_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; 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'])) { $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'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); } if (tep_not_null($this->icon)) { $this->quotes['icon'] = tep_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 tep_get_country_name($country_id) { $country_array = tep_get_countries($country_id); return $country_array['countries_name']; }
</td> </tr> <?php } ?> <tr> <td class="main"> <?php echo ENTRY_COUNTRY; ?> </td> <td class="main"> <?php if ($address['entry_country_id']) { echo tep_draw_pull_down_menu('entry_country', tep_get_countries(), $address['entry_country_id']); } else { echo tep_draw_pull_down_menu('entry_country', tep_get_countries(), STORE_COUNTRY); } tep_draw_hidden_field('step', '3'); ?> </td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td class="formAreaTitle"><br><?php echo CATEGORY_CONTACT; ?> </td> </tr>
$contents = array(); if ($action == 'list') { switch ($saction) { case 'new': $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_NEW_SUB_ZONE . '</b>'); $contents = array('form' => tep_draw_form('zones', FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . (int) $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&' . (isset($_GET['sID']) ? 'sID=' . $_GET['sID'] . '&' : '') . 'saction=insert_sub')); $contents[] = array('text' => TEXT_INFO_NEW_SUB_ZONE_INTRO); $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY . '<br>' . tep_draw_pull_down_menu('zone_country_id', tep_get_countries(TEXT_ALL_COUNTRIES), '', 'onChange="update_zone(this.form);"')); $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_ZONE . '<br>' . tep_draw_pull_down_menu('zone_id', tep_prepare_country_zones_pull_down())); $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_insert.gif', IMAGE_INSERT) . ' <a href="' . tep_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . (int) $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&' . (isset($_GET['sID']) ? 'sID=' . $_GET['sID'] : '')) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); break; case 'edit': $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_EDIT_SUB_ZONE . '</b>'); $contents = array('form' => tep_draw_form('zones', FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . (int) $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $sInfo->association_id . '&saction=save_sub')); $contents[] = array('text' => TEXT_INFO_EDIT_SUB_ZONE_INTRO); $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY . '<br>' . tep_draw_pull_down_menu('zone_country_id', tep_get_countries(TEXT_ALL_COUNTRIES), $sInfo->zone_country_id, 'onChange="update_zone(this.form);"')); $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_ZONE . '<br>' . tep_draw_pull_down_menu('zone_id', tep_prepare_country_zones_pull_down($sInfo->zone_country_id), $sInfo->zone_id)); $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_update.gif', IMAGE_UPDATE) . ' <a href="' . tep_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . (int) $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $sInfo->association_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); break; case 'delete': $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_SUB_ZONE . '</b>'); $contents = array('form' => tep_draw_form('zones', FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . (int) $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $sInfo->association_id . '&saction=deleteconfirm_sub')); $contents[] = array('text' => TEXT_INFO_DELETE_SUB_ZONE_INTRO); $contents[] = array('text' => '<br><b>' . $sInfo->countries_name . '</b>'); $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . tep_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . (int) $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $sInfo->association_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); break; default: if (isset($sInfo) && is_object($sInfo)) { $heading[] = array('text' => '<b>' . $sInfo->countries_name . '</b>'); $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . (int) $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $sInfo->association_id . '&saction=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . (int) $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $sInfo->association_id . '&saction=delete') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a>'); $contents[] = array('text' => '<br>' . TEXT_INFO_DATE_ADDED . ' ' . tep_date_short($sInfo->date_added));
function before_process() { global $HTTP_POST_VARS, $order, $sendto, $messageStack, $currencies; if (isset($HTTP_POST_VARS['cc_owner']) && !empty($HTTP_POST_VARS['cc_owner']) && isset($HTTP_POST_VARS['cc_type']) && isset($this->cc_types[$HTTP_POST_VARS['cc_type']]) && isset($HTTP_POST_VARS['cc_number_nh-dns']) && !empty($HTTP_POST_VARS['cc_number_nh-dns'])) { if (MODULE_PAYMENT_PAYPAL_DIRECT_TRANSACTION_SERVER == 'Live') { $api_url = 'https://api-3t.paypal.com/nvp'; } else { $api_url = 'https://api-3t.sandbox.paypal.com/nvp'; } $new_order_number_query = tep_db_query("show table status like '" . TABLE_ORDERS . "'"); $new_order_number_row = tep_db_fetch_array($new_order_number_query); $new_order_number = (int) $new_order_number_row['Auto_increment']; $params = array('METHOD' => 'DoDirectPayment', 'VERSION' => '51.0', 'PWD' => MODULE_PAYMENT_PAYPAL_DIRECT_API_PASSWORD, 'USER' => MODULE_PAYMENT_PAYPAL_DIRECT_API_USERNAME, 'SIGNATURE' => MODULE_PAYMENT_PAYPAL_DIRECT_API_SIGNATURE, 'PAYMENTACTION' => MODULE_PAYMENT_PAYPAL_DIRECT_TRANSACTION_METHOD == 'Sale' ? 'Sale' : 'Authorization', 'IPADDRESS' => tep_get_ip_address(), 'DESC' => 'Payment against an invoice #' . $new_order_number, 'CUSTOM' => '', 'INVNUM' => $new_order_number, 'NOTIFYURL' => HTTPS_SERVER . DIR_WS_CATALOG . 'ext/modules/payment/paypal/index.php', 'AMT' => $this->format_raw($order->info['total'], $HTTP_POST_VARS['cc_currency']), 'CREDITCARDTYPE' => $HTTP_POST_VARS['cc_type'], 'ACCT' => $HTTP_POST_VARS['cc_number_nh-dns'], 'EXPDATE' => $HTTP_POST_VARS['cc_expires_month'] . $HTTP_POST_VARS['cc_expires_year'], 'CVV2' => $HTTP_POST_VARS['cc_cvc_nh-dns'], 'FIRSTNAME' => substr($HTTP_POST_VARS['cc_owner'], 0, strpos($HTTP_POST_VARS['cc_owner'], ' ')), 'LASTNAME' => substr($HTTP_POST_VARS['cc_owner'], strpos($HTTP_POST_VARS['cc_owner'], ' ') + 1), 'STREET' => $HTTP_POST_VARS['cc_billing_street'], 'CITY' => $HTTP_POST_VARS['cc_billing_city'], 'STATE' => $HTTP_POST_VARS['cc_billing_state'], 'ZIP' => $HTTP_POST_VARS['cc_billing_postcode'], 'COUNTRYCODE' => $HTTP_POST_VARS['cc_billing_country'], 'CURRENCYCODE' => $HTTP_POST_VARS['cc_currency'], 'EMAIL' => $order->customer['email_address'], 'PHONENUM' => $order->delivery['telephone']); if ($HTTP_POST_VARS['cc_type'] == 'SWITCH' || $HTTP_POST_VARS['cc_type'] == 'SOLO') { $params['ISSUENUMBER'] = $HTTP_POST_VARS['cc_issue_nh-dns']; } $post_string = ''; reset($params); while (list($key, $value) = each($params)) { $post_string .= $key . '=' . urlencode(trim($value)) . '&'; } $post_string = substr($post_string, 0, -1); $response = $this->sendTransactionToGateway($api_url, $post_string); $response_array = array(); parse_str($response, $response_array); if ($response_array['ACK'] != 'Success' && $response_array['ACK'] != 'SuccessWithWarning') { $messageStack->add_session('header', $response_array['L_LONGMESSAGE0']); $payment_error_return = 'cc_owner=' . urlencode($HTTP_POST_VARS['cc_owner']) . '&cc_type=' . $HTTP_POST_VARS['cc_type'] . '&cc_expires_month=' . $HTTP_POST_VARS['cc_expires_month'] . '&cc_expires_year=' . $HTTP_POST_VARS['cc_expires_year'] . '&cc_currency=' . $HTTP_POST_VARS['cc_currency'] . '&cc_billing_country=' . urlencode($HTTP_POST_VARS['cc_billing_country']) . '&cc_billing_postcode=' . urlencode($HTTP_POST_VARS['cc_billing_postcode']) . '&cc_billing_state=' . urlencode($HTTP_POST_VARS['cc_billing_state']) . '&cc_billing_city=' . urlencode($HTTP_POST_VARS['cc_billing_city']) . '&cc_billing_street=' . urlencode($HTTP_POST_VARS['cc_billing_street']) . ''; tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL')); } else { $billing_country_info = tep_get_countries('', true, $HTTP_POST_VARS['cc_billing_country']); if (sizeof($billing_country_info) == 0) { $countries = file(DIR_WS_MODULES . 'payment/all_countries.csv'); reset($countries); while (list(, $country_info) = each($countries)) { list($country_code, $country_name, $country_iso_code_3) = explode(';', $country_info); if ($country_code == $HTTP_POST_VARS['cc_billing_country']) { $billing_country_info = array('countries_id' => '', 'countries_name' => $country_name, 'countries_iso_code_2' => $country_code, 'countries_iso_code_3' => $country_iso_code_3); } } } $order->info['cc_type'] = $HTTP_POST_VARS['cc_type']; $order->info['cc_owner'] = $HTTP_POST_VARS['cc_owner']; $order->info['cc_number'] = $HTTP_POST_VARS['cc_number_nh-dns']; $order->info['cc_expires'] = $HTTP_POST_VARS['cc_expires_month'] . '/' . $HTTP_POST_VARS['cc_expires_year']; list($billing_firstname, $billing_lastname) = explode(' ', $HTTP_POST_VARS['cc_owner']); $order->billing['firstname'] = $billing_firstname; $order->billing['lastname'] = $billing_lastname; $order->billing['street_address'] = $HTTP_POST_VARS['cc_billing_street']; $order->billing['city'] = $HTTP_POST_VARS['cc_billing_city']; $order->billing['country'] = array('id' => $billing_country_info['countries_id'], 'title' => $billing_country_info['countries_name'], 'iso_code_2' => $billing_country_info['countries_iso_code_2'], 'iso_code_3' => $billing_country_info['countries_iso_code_3']); $order->billing['postcode'] = $HTTP_POST_VARS['cc_billing_postcode']; $order->billing['state'] = $HTTP_POST_VARS['cc_billing_state']; $order->info['currency'] = $HTTP_POST_VARS['cc_currency']; $order->info['currency_value'] = $currencies->currencies[$HTTP_POST_VARS['cc_currency']]['value']; $order->info['is_paid'] = '1'; } } else { $messageStack->add_session('header', MODULE_PAYMENT_PAYPAL_DIRECT_ERROR_ALL_FIELDS_REQUIRED); tep_redirect(tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL')); } }
?> <tr> <td class="main"><?php echo ENTRY_COUNTRY; ?> </td> <td class="main"> <?php if ($error == true) { if ($entry_country_error == true) { echo tep_draw_pull_down_menu('entry_country_id', tep_get_countries(), $cInfo->entry_country_id) . ' ' . ENTRY_COUNTRY_ERROR; } else { echo tep_get_country_name($cInfo->entry_country_id) . tep_draw_hidden_field('entry_country_id'); } } else { echo tep_draw_pull_down_menu('entry_country_id', tep_get_countries(), $cInfo->entry_country_id); } ?> </td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?> </td> </tr> <tr> <td class="formAreaTitle"><?php echo CATEGORY_CONTACT;
} else { echo osc_draw_input_field('ab_state', isset($Qab) ? tep_get_zone_name($Qab->value('entry_country_id'), $Qab->value('entry_zone_id'), $Qab->value('entry_state')) : '', '', ACCOUNT_STATE > 0); } ?> </td> </tr> <?php } ?> <tr> <td class="main" width="30%"><?php echo ENTRY_COUNTRY; ?> </td> <td class="main" width="70%"><?php echo osc_draw_pull_down_menu('ab_country', tep_get_countries(), isset($Qab) ? $Qab->value('entry_country_id') : STORE_COUNTRY, '', true); ?> </td> </tr> <?php if (ACCOUNT_TELEPHONE > -1) { ?> <tr> <td class="main" width="30%"><?php echo ENTRY_TELEPHONE_NUMBER; ?> </td> <td class="main" width="70%"><?php echo osc_draw_input_field('ab_telephone', isset($Qab) ? $Qab->value('entry_telephone') : '', '', ACCOUNT_TELEPHONE > 0); ?> </td>
function tep_get_country_list($name, $selected = '', $parameters = '') { $countries_array = array(array('id' => '', 'text' => PULL_DOWN_DEFAULT)); $countries = tep_get_countries(); for ($i = 0, $n = sizeof($countries); $i < $n; $i++) { $countries_array[] = array('id' => $countries[$i]['countries_id'], 'text' => $countries[$i]['countries_name']); } return tep_draw_pull_down_menu($name, $countries_array, $selected, $parameters); }
$cart_country_id = $_POST['country_id']; tep_session_register('cart_country_id'); //add state zone_id $cart_zone = $_POST['zone_id']; tep_session_register('cart_zone'); $cart_zip_code = $_POST['zip_code']; tep_session_register('cart_zip_code'); } elseif (tep_session_is_registered('cart_country_id')) { // session is available $country_info = tep_get_countries($cart_country_id, true); $order->delivery = array('postcode' => $cart_zip_code, 'country' => array('id' => $cart_country_id, 'title' => $country_info['countries_name'], 'iso_code_2' => $country_info['countries_iso_code_2'], 'iso_code_3' => $country_info['countries_iso_code_3']), 'country_id' => $cart_country_id, 'format_id' => tep_get_address_format_id($cart_country_id)); } else { // first timer $cart_country_id = STORE_COUNTRY; tep_session_register('cart_country_id'); $country_info = tep_get_countries(STORE_COUNTRY, true); tep_session_register('cart_zip_code'); $order->delivery = array('country' => array('id' => STORE_COUNTRY, 'title' => $country_info['countries_name'], 'iso_code_2' => $country_info['countries_iso_code_2'], 'iso_code_3' => $country_info['countries_iso_code_3']), 'country_id' => STORE_COUNTRY, 'format_id' => tep_get_address_format_id($_POST['country_id'])); } // set the cost to be able to calculate free shipping $order->info = array('total' => $cart->show_total(), 'currency' => $currency, 'currency_value' => $currencies->currencies[$currency]['value']); } // weight and count needed for shipping $total_weight = $cart->show_weight(); $total_count = $cart->count_contents(); require DIR_WS_CLASSES . 'shipping.php'; $shipping_modules = new shipping(); $quotes = $shipping_modules->quote(); $order->info['subtotal'] = $cart->total; // set selections for displaying $selected_country = $order->delivery['country']['id'];
function tep_cfg_pull_down_country_list($country_id) { return tep_draw_pull_down_menu('configuration_value', tep_get_countries(), $country_id); }
function quote($method = '') { global $shipping_weight, $shipping_num_boxes, $cart, $cart_cs, $order; if (tep_not_null($method)) { $this->_setService($method); } if (defined("SHIPPING_ORIGIN_COUNTRY")) { $countries_array = tep_get_countries(SHIPPING_ORIGIN_COUNTRY, true); $this->country = $countries_array['countries_iso_code_2']; } else { $this->country = STORE_ORIGIN_COUNTRY; } ///////////////////////////////////////////////////////// // Was modified 21-04-2007 by // Dimon Gubanov aka dadsim, // simeon75@mail.ru ///////////////////////////////////////////////////////// // Process items with disabled Ship-Separately's flag $this->cart_total = 0; $this->cart_total_per_one = 0; $this->cart_weight = 0; $this->cart_weight_per_one = 0; $this->cart_shipping_num_boxes = 0; $this->cart_qty = 0; if ($_SESSION['ordertype'] == "cs") { reset($cart_cs->contents); } else { reset($cart->contents); } if ($_SESSION['ordertype'] == "cs") { while (list($products_id, ) = each($cart_cs->contents)) { $this->_CartCount($products_id); } } else { while (list($products_id, ) = each($cart->contents)) { $this->_CartCount($products_id); } } if ($this->cart_qty > 0) { if (SHIPPING_BOX_WEIGHT >= $this->cart_weight * SHIPPING_BOX_PADDING / 100) { $this->cart_weight = $this->cart_weight + SHIPPING_BOX_WEIGHT; } else { $this->cart_weight = $this->cart_weight + $this->cart_weight * SHIPPING_BOX_PADDING / 100; } if ($this->cart_weight > SHIPPING_MAX_WEIGHT) { // Split into many boxes $this->cart_shipping_num_boxes = ceil($this->cart_weight / SHIPPING_MAX_WEIGHT); $cart_weight = $this->cart_weight / $this->cart_shipping_num_boxes; } else { $this->cart_shipping_num_boxes = 1; $cart_weight = $this->cart_weight; } if (MODULE_SHIPPING_FEDEX1_ENVELOPE == 'True') { if ($cart_weight <= 0.5 && MODULE_SHIPPING_FEDEX1_WEIGHT == 'LBS' || $cart_weight <= 0.2 && MODULE_SHIPPING_FEDEX1_WEIGHT == 'KGS') { $this->_setPackageType('06'); } else { $this->_setPackageType('01'); } } else { $this->_setPackageType('01'); } if ($this->packageType == '01' && $cart_weight < 1) { $this->_setWeight(1); } else { $this->_setWeight($cart_weight); } $this->_setInsuranceValue($this->cart_total / $this->cart_shipping_num_boxes); $fedexQuote = $this->_getQuote(); if (is_array($fedexQuote)) { if (isset($fedexQuote['error'])) { $this->quotes = array('module' => $this->title, 'error' => $fedexQuote['error']); } else { $methods = array(); foreach ($fedexQuote as $type => $cost) { $skip = FALSE; $this->surcharge = 0; if ($this->intl === FALSE) { if (strlen($type) > 2 && MODULE_SHIPPING_FEDEX1_TRANSIT == 'True') { $service_descr = $this->domestic_types[substr($type, 0, 2)] . ' (' . substr($type, 2, 1) . ' days)'; } else { $service_descr = $this->domestic_types[substr($type, 0, 2)]; } switch (substr($type, 0, 2)) { case 90: if ($order->delivery['company'] != '') { $skip = TRUE; } break; case 92: if ($this->country == "CA") { if ($order->delivery['company'] == '') { $this->surcharge = MODULE_SHIPPING_FEDEX1_RESIDENTIAL; } } else { if ($order->delivery['company'] == '') { $skip = TRUE; } } break; default: if ($this->country != "CA" && substr($type, 0, 2) < "90" && $order->delivery['company'] == '') { $this->surcharge = MODULE_SHIPPING_FEDEX1_RESIDENTIAL; } break; } } else { if (strlen($type) > 2 && MODULE_SHIPPING_FEDEX1_TRANSIT == 'True') { $service_descr = $this->international_types[substr($type, 0, 2)] . ' (' . substr($type, 2, 1) . ' days)'; } else { $service_descr = $this->international_types[substr($type, 0, 2)]; } } if ($method) { if (substr($type, 0, 2) != $method) { $skip = TRUE; } } if (!$skip) { $this->quotes['methods'][] = array('id' => substr($type, 0, 2), 'title' => $service_descr, 'cost' => (SHIPPING_HANDLING + MODULE_SHIPPING_FEDEX1_SURCHARGE + $this->surcharge + $cost) * $this->cart_shipping_num_boxes); } } if ($this->tax_class > 0) { $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); } } } else { $this->quotes = array('module' => $this->title, 'error' => 'An error occured with the fedex shipping calculations.<br>Fedex may not deliver to your country, or your postal code may be wrong.'); } } // Process items with enabled Ship-Separately's flag $total_qty = $this->cart_qty; if ($_SESSION['ordertype'] == "cs") { reset($cart_cs->contents); } else { reset($cart->contents); } if ($_SESSION['ordertype'] == "cs") { $cc = $cart_cs->contents; } else { $cc = $cart->contents; } while (list($products_id, ) = each($cc)) { $this->cart_total_per_one = 0; $this->cart_weight_per_one = 0; $this->cart_qty = 0; $this->_CartCount($products_id, '1'); if ($this->cart_qty > 0) { $total_qty += $this->cart_qty; if (SHIPPING_BOX_WEIGHT >= $this->cart_weight_per_one * SHIPPING_BOX_PADDING / 100) { $this->cart_weight_per_one = $this->cart_weight_per_one + SHIPPING_BOX_WEIGHT; } else { $this->cart_weight_per_one = $this->cart_weight_per_one + $this->cart_weight_per_one * SHIPPING_BOX_PADDING / 100; } $this->cart_shipping_num_boxes += $this->cart_qty; if (MODULE_SHIPPING_FEDEX1_ENVELOPE == 'True') { if ($this->cart_weight_per_one <= 0.5 && MODULE_SHIPPING_FEDEX1_WEIGHT == 'LBS' || $this->cart_weight_per_one <= 0.2 && MODULE_SHIPPING_FEDEX1_WEIGHT == 'KGS') { $this->_setPackageType('06'); } else { $this->_setPackageType('01'); } } else { $this->_setPackageType('01'); } if ($this->packageType == '01' && $this->cart_weight_per_one < 1) { $this->_setWeight(1); } else { $this->_setWeight($this->cart_weight_per_one); } $this->_setInsuranceValue($this->cart_total_per_one); $fedexQuote = $this->_getQuote(); if (is_array($fedexQuote)) { if (isset($fedexQuote['error'])) { $this->quotes = array('module' => $this->title, 'error' => $fedexQuote['error']); } else { foreach ($fedexQuote as $type => $cost) { $skip = FALSE; $this->surcharge = 0; if ($this->intl === FALSE) { if (strlen($type) > 2 && MODULE_SHIPPING_FEDEX1_TRANSIT == 'True') { $service_descr = $this->domestic_types[substr($type, 0, 2)] . ' (' . substr($type, 2, 1) . ' days)'; } else { $service_descr = $this->domestic_types[substr($type, 0, 2)]; } switch (substr($type, 0, 2)) { case 90: if ($order->delivery['company'] != '') { $skip = TRUE; } break; case 92: if ($this->country == "CA") { if ($order->delivery['company'] == '') { $this->surcharge = MODULE_SHIPPING_FEDEX1_RESIDENTIAL; } } else { if ($order->delivery['company'] == '') { $skip = TRUE; } } break; default: if ($this->country != "CA" && substr($type, 0, 2) < "90" && $order->delivery['company'] == '') { $this->surcharge = MODULE_SHIPPING_FEDEX1_RESIDENTIAL; } break; } } else { if (strlen($type) > 2 && MODULE_SHIPPING_FEDEX1_TRANSIT == 'True') { $service_descr = $this->international_types[substr($type, 0, 2)] . ' (' . substr($type, 2, 1) . ' days)'; } else { $service_descr = $this->international_types[substr($type, 0, 2)]; } } if ($method) { if (substr($type, 0, 2) != $method) { $skip = TRUE; } } if (!$skip) { $new_method_flag = true; if (is_array($this->quotes['methods'])) { foreach ($this->quotes['methods'] as $key => $value) { if ($this->quotes['methods'][$key]['id'] == substr($type, 0, 2)) { $this->quotes['methods'][$key]['cost'] += (SHIPPING_HANDLING + MODULE_SHIPPING_FEDEX1_SURCHARGE + $this->surcharge + $cost) * $this->cart_qty; $new_method_flag = false; } } } if ($new_method_flag) { $this->quotes['methods'][] = array('id' => substr($type, 0, 2), 'title' => $service_descr, 'cost' => (SHIPPING_HANDLING + MODULE_SHIPPING_FEDEX1_SURCHARGE + $this->surcharge + $cost) * $this->cart_qty); } } } } } else { $this->quotes = array('module' => $this->title, 'error' => 'An error occured with the fedex shipping calculations.<br>Fedex may not deliver to your country, or your postal code may be wrong.'); } } } if (MODULE_SHIPPING_FEDEX1_MAX_WEIGHT != 'NONE' && MODULE_SHIPPING_FEDEX1_MAX_WEIGHT != '' && $this->cart_weight > MODULE_SHIPPING_FEDEX1_MAX_WEIGHT || MODULE_SHIPPING_FEDEX1_MAX_QUANTITY_OF_SHIP_BOXES != 'NONE' && MODULE_SHIPPING_FEDEX1_MAX_QUANTITY_OF_SHIP_BOXES != '' && $this->cart_shipping_num_boxes > MODULE_SHIPPING_FEDEX1_MAX_QUANTITY_OF_SHIP_BOXES) { return false; } if (ctype_digit(MODULE_SHIPPING_FEDEX1_TIER1_DISCOUNT_WEIGHT) && ctype_digit(MODULE_SHIPPING_FEDEX1_TIER2_DISCOUNT_WEIGHT) && (ctype_digit(MODULE_SHIPPING_FEDEX1_TIER1_DISCOUNT_PERCENTAGE) || ctype_digit(MODULE_SHIPPING_FEDEX1_TIER2_DISCOUNT_PERCENTAGE)) && is_array($this->quotes['methods'])) { foreach ($this->quotes['methods'] as $key => $value) { if ($this->cart_weight > MODULE_SHIPPING_FEDEX1_TIER1_DISCOUNT_WEIGHT && $this->cart_weight < MODULE_SHIPPING_FEDEX1_TIER2_DISCOUNT_WEIGHT && ctype_digit(MODULE_SHIPPING_FEDEX1_TIER1_DISCOUNT_PERCENTAGE) && $order->delivery['company'] != '') { $this->quotes['methods'][$key]['cost'] = $this->quotes['methods'][$key]['cost'] * (1 - MODULE_SHIPPING_FEDEX1_TIER1_DISCOUNT_PERCENTAGE / 100); } elseif ($this->cart_weight > MODULE_SHIPPING_FEDEX1_TIER2_DISCOUNT_WEIGHT && ctype_digit(MODULE_SHIPPING_FEDEX1_TIER2_DISCOUNT_PERCENTAGE) && $order->delivery['company'] != '') { $this->quotes['methods'][$key]['cost'] = $this->quotes['methods'][$key]['cost'] * (1 - MODULE_SHIPPING_FEDEX1_TIER2_DISCOUNT_PERCENTAGE / 100); } } } $this->quotes['id'] = $this->code; // Begin truncate to 2 decimals // $c_e = explode(".", $this->cart_weight); $this->quotes['module'] = $this->title . " (Total items: " . $total_qty . ' pcs. Total weight: ' . $c_e[0] . (isset($c_e[1]) == FALSE ? "" : "." . substr($c_e[1], 0, 2)) . ' ' . strtolower(MODULE_SHIPPING_FEDEX1_WEIGHT) . ')'; // End truncate to 2 decimals // ///////////////////////////////////////////////////// // End of dadsim's modification ///////////////////////////////////////////////////// if (tep_not_null($this->icon)) { $this->quotes['icon'] = tep_image($this->icon, $this->title); } return $this->quotes; }