surfalot Posted March 3, 2007 Share Posted March 3, 2007 (edited) Answering my own posts again - OK the fix I used (maybe not graceful) is to pass the value for zone_code rather than zone_id in $string from the estimator to the zone shipping - you then need an if (customer is logged in) else $dest_state = $_POST['state']; Graeme I thought if you found it you fixed it. :lol: can you post your fix for everyone? You are one of the good ones, all closing-out your questions and all. This was specifically related to the zone shipping only? Edited March 3, 2007 by surfalot Quote Link to comment Share on other sites More sharing options...
surfalot Posted March 3, 2007 Share Posted March 3, 2007 then you will have it for later if you zap the file again :lol: Quote Link to comment Share on other sites More sharing options...
leveera Posted March 7, 2007 Share Posted March 7, 2007 Please advice! I got SQL query run error: #1062 - Duplicate entry '19' for key 1 but I don't understand how to find "next available configuration_group_id in table" I even can't spot 19 in the table. The configuration_group table has following: Field _____________________ Type________Collation_____Null configuration_group_id................int(11)...............................No configuration_group_title.............varchar(64)....latin1_swedish_ci...No configuration_group_description...varchar(255)..latin1_swedish_ci...No sort_order..................................int(5)..........................Yes visible........................................int(1)................Yes Thanks Sergei Quote Link to comment Share on other sites More sharing options...
surfalot Posted March 8, 2007 Share Posted March 8, 2007 Please advice! I got SQL query run error: #1062 - Duplicate entry '19' for key 1 but I don't understand how to find "next available configuration_group_id in table" I even can't spot 19 in the table. The configuration_group table has following: Field _____________________ Type________Collation_____Null configuration_group_id................int(11)...............................No configuration_group_title.............varchar(64)....latin1_swedish_ci...No configuration_group_description...varchar(255)..latin1_swedish_ci...No sort_order..................................int(5)..........................Yes visible........................................int(1)................Yes Thanks Sergei you configuration table already has group_id 19. you need to modify the SQL script so that this contrib's group number is something else. Quote Link to comment Share on other sites More sharing options...
leveera Posted March 8, 2007 Share Posted March 8, 2007 you configuration table already has group_id 19. you need to modify the SQL script so that this contrib's group number is something else. The question is that should be contrib's group number? Anybody know here how to find this number? I tried: 19, 20, 99, 256, 300, 360, 380, 580 - the result was always error: #1062 - Duplicate entry... Any help is appreciated Sergei Quote Link to comment Share on other sites More sharing options...
surfalot Posted March 8, 2007 Share Posted March 8, 2007 The question is that should be contrib's group number? Anybody know here how to find this number? I tried: 19, 20, 99, 256, 300, 360, 380, 580 - the result was always error: #1062 - Duplicate entry... Any help is appreciated Sergei you need to find the highest configuration_group_id in the configuration_group table. (lets say for example: 56) then you need to search and replace '19' with '56' in the SQL.txt. then run that in your SQL tool. Quote Link to comment Share on other sites More sharing options...
leveera Posted March 9, 2007 Share Posted March 9, 2007 'OK, I found it and for any beginners like me bellow is step-by-step tuition how to find configuration_group_ID 1. Login to address like http://mysql.yourdomain.com (provided by your host) 2. Look at a list of tables and find configuration_group, click it 3. Next find line configuration_group_id and mark its checkbox 4. On the top of the page click BROWSE tab 5. Now you see all used configuration_group_id-s Hope it helps Sergei Quote Link to comment Share on other sites More sharing options...
rkoechel2004 Posted April 13, 2007 Share Posted April 13, 2007 So I've read this whole thread and have tried different fixes but can't seem to find a solution to my problem. When a user is logged in this contribution works flawless. When not logged in a user can get shipping estimates but when you click on a shipping method to have it applied to the order total estimate the page reloads and the state and zipcode information that the customer enter is gone and they have to start over. Any help would be appreciated. Ryan Quote rkoechel2004 Link to comment Share on other sites More sharing options...
surfalot Posted April 15, 2007 Share Posted April 15, 2007 So I've read this whole thread and have tried different fixes but can't seem to find a solution to my problem. When a user is logged in this contribution works flawless. When not logged in a user can get shipping estimates but when you click on a shipping method to have it applied to the order total estimate the page reloads and the state and zipcode information that the customer enter is gone and they have to start over. Any help would be appreciated. Ryan It's worked on all the sites I've installed it on. I've been through the code, but don't see anything obvious. tell me, after selecting the country and entering the post code and getting the first estimate, does the country and post code appear again in the appropriate boxes (before selecting a specific shipping method)? Quote Link to comment Share on other sites More sharing options...
rkoechel2004 Posted April 15, 2007 Share Posted April 15, 2007 It's worked on all the sites I've installed it on. I've been through the code, but don't see anything obvious.tell me, after selecting the country and entering the post code and getting the first estimate, does the country and post code appear again in the appropriate boxes (before selecting a specific shipping method)? After getting the first estimate the post code box is empty and the state goes back to "Please Select" Quote rkoechel2004 Link to comment Share on other sites More sharing options...
surfalot Posted April 15, 2007 Share Posted April 15, 2007 After getting the first estimate the post code box is empty and the state goes back to "Please Select" whach u mean "state" goes back. the standard code is a country selector and zip code. are you working on a modified version? Quote Link to comment Share on other sites More sharing options...
rkoechel2004 Posted April 16, 2007 Share Posted April 16, 2007 whach u mean "state" goes back. the standard code is a country selector and zip code. are you working on a modified version? I was using a stock 2.0 install. I just updated to 2.2.1 to see if that fixed the problem and it didn't. But the stock 2.2.1 still gives me the option of selecting a state. -Ryan Quote rkoechel2004 Link to comment Share on other sites More sharing options...
GlebeCS Posted April 17, 2007 Share Posted April 17, 2007 Hello, I have a problem with strange characters produced in my shopping_cart.php that seem to be coming from this contrib (I have the latest version installed) I have detailed the problem (along with the code) , HERE Could anyone advise please? Thanks Andy Quote Link to comment Share on other sites More sharing options...
Tomason Posted April 21, 2007 Share Posted April 21, 2007 Hi! I saw an interesting contribution on the page http://www.riccos-camera.de, where a product must be added in the cart in order to see what this is about. They have a shipping estimator together with payment estimator. I must say two things: 1. I hope it isn't a very incorrect thing to present a site that I have no relations with. 2. As the shipping has a cost, for me the payment also has a cost, meaning that for pay on delivery, in many situations there is a cost for the payment, cost that depends on the value, distance, etc. Given all these, I made a combination between the "ship in cart" contribution ( http://www.oscommerce.com/community/contributions,1781 ) and partially from the content of the file "catalog/ceckout_shipping.php". Unfortunately I am not a php encoder but I managed to combine the two files presented above and the result of that is working. Unfortunately some errors occur at the moment the delivery zone is beeing changed, and maybe also in other situations. In the following post I am going to list the new shipping_estimator.php file that resulted. As it is now, the new ideea of shipping & payment estimator can not be used 100%, but I hope someone with better knowledge of php will correct it in order to can be used by everyone. On my test page several changes are made at shipping & payment, but I hope that has nothing to do with the shipping estimator file. Tomason :) :) Quote Link to comment Share on other sites More sharing options...
Tomason Posted April 21, 2007 Share Posted April 21, 2007 <?php /* $Id: shipping_estimator.php,v 2.20 2004/07/01 15:16:07 eml Exp $ v2.00 by Acheron + installed Fix for v2.0 and all other versions Acheron 7 Jul 2004 (see Install.txt for partial version history) Copyright © 2004 Released under the GNU General Public License + installed Fix for v2.0 and all other versions Acheron 7 Jul 2004 */ ?> <!-- shipping_estimator //--> <script language="JavaScript"> function shipincart_submit(sid){ if(sid){ document.estimator.sid.value=sid; } document.estimator.submit(); return false; } </script> <script language="JavaScript"> function payment_submit(sid){ if(sid){ document.estimator.sid.value=sid; } document.estimator.submit(); return false; } </script> <?php if (SHOW_SHADOWS == 'true') { // $use_shadow_alt = 'alt_2'; $extra_table='true'; require(DIR_WS_MODULES . 'shadow_controller/shadow_top.php'); } ?> <table border="0" cellspacing="0" cellpadding="0" align="center"> <tr valign="top"> <td> <?php require(DIR_WS_LANGUAGES . $language . '/modules/' . FILENAME_SHIPPING_ESTIMATOR); if (($cart->count_contents() > 0)) { // shipping cost require('includes/classes/http_client.php'); // shipping in basket //if($cart->get_content_type() !== 'virtual') { if (tep_session_is_registered('customer_id')) { // user is logged in if (isset($HTTP_POST_VARS['address_id'])){ // user changed address $sendto = $HTTP_POST_VARS['address_id']; }elseif (tep_session_is_registered('cart_address_id')){ // user once changed address $sendto = $cart_address_id; }else{ // first timer $sendto = $customer_default_address_id; } // set session now $cart_address_id = $sendto; tep_session_register('cart_address_id'); // set shipping to null ! multipickup changes address to store address... $shipping=''; // include the order class (uses the sendto !) require(DIR_WS_CLASSES . 'order.php'); $order = new order; }else{ // user not logged in ! if (isset($HTTP_POST_VARS['country_id'])){ // country is selected $country_info = tep_get_countries($HTTP_POST_VARS['country_id'],true); $order->delivery = array('postcode' => $HTTP_POST_VARS['zip_code'], 'country' => array('id' => $HTTP_POST_VARS['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' => $HTTP_POST_VARS['country_id'], //add state zone_id 'zone_id' => $HTTP_POST_VARS['state'], 'format_id' => tep_get_address_format_id($HTTP_POST_VARS['country_id'])); $cart_country_id = $HTTP_POST_VARS['country_id']; tep_session_register('cart_country_id'); //add state zone_id $cart_zone = $HTTP_POST_VARS['zone_id']; tep_session_register('cart_zone'); $cart_zip_code = $HTTP_POST_VARS['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(//'postcode' => '', '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($HTTP_POST_VARS['country_id'])); } // set the cost to be able to calculate free shipping $order->info = array('total' => $cart->show_total(), // TAX ???? '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']; $selected_address = $sendto; //} // eo shipping cost // check free shipping based on order total if ( defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING') && (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true')) { switch (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) { case 'national': if ($order->delivery['country_id'] == STORE_COUNTRY) $pass = true; break; case 'international': if ($order->delivery['country_id'] != STORE_COUNTRY) $pass = true; break; case 'both': $pass = true; break; default: $pass = false; break; } $free_shipping = false; if ( ($pass == true) && ($order->info['total'] >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)) { $free_shipping = true; include(DIR_WS_LANGUAGES . $language . '/modules/order_total/ot_shipping.php'); } } else { $free_shipping = false; } // begin shipping cost if(!$free_shipping && $cart->get_content_type() !== 'virtual'){ if (tep_not_null($HTTP_POST_VARS['sid'])){ list($module, $method) = explode('_', $HTTP_POST_VARS['sid']); $cart_sid = $HTTP_POST_VARS['sid']; tep_session_register('cart_sid'); }elseif (tep_session_is_registered('cart_sid')){ list($module, $method) = explode('_', $cart_sid); }else{ $module=""; $method=""; } if (tep_not_null($module)){ $selected_quote = $shipping_modules->quote($method, $module); if($selected_quote[0]['error'] || !tep_not_null($selected_quote[0]['methods'][0]['cost'])){ $selected_shipping = $shipping_modules->cheapest(); $order->info['shipping_method'] = $selected_shipping['title']; $order->info['shipping_cost'] = $selected_shipping['cost']; $order->info['total']+= $selected_shipping['cost']; }else{ $order->info['shipping_method'] = $selected_quote[0]['module'].' ('.$selected_quote[0]['methods'][0]['title'].')'; $order->info['shipping_cost'] = $selected_quote[0]['methods'][0]['cost']; $order->info['total']+= $selected_quote[0]['methods'][0]['cost']; $selected_shipping['title'] = $order->info['shipping_method']; $selected_shipping['cost'] = $order->info['shipping_cost']; $selected_shipping['id'] = $selected_quote[0]['id'].'_'.$selected_quote[0]['methods'][0]['id']; } }else{ $selected_shipping = $shipping_modules->cheapest(); $order->info['shipping_method'] = $selected_shipping['title']; $order->info['shipping_cost'] = $selected_shipping['cost']; $order->info['total']+= $selected_shipping['cost']; } } // virtual products use free shipping if($cart->get_content_type() == 'virtual') { $order->info['shipping_method'] = CART_SHIPPING_METHOD_FREE_TEXT . ' ' . CART_SHIPPING_METHOD_ALL_DOWNLOADS; $order->info['shipping_cost'] = 0; } if($free_shipping) { $order->info['shipping_method'] = MODULE_ORDER_TOTAL_SHIPPING_TITLE; $order->info['shipping_cost'] = 0; } $shipping=$selected_shipping; // end of shipping cost // end free shipping based on order total $info_box_contents = array(); $info_box_contents[] = array('text' => '<b>' . CART_SHIPPING_OPTIONS . '</b>'); // azer for 2.20 cosmetic change new infoBoxHeading($info_box_contents, false, false); $ShipTxt= tep_draw_form('estimator', tep_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'), 'post'); //'onSubmit="return check_form();"' $ShipTxt.=tep_draw_hidden_field('sid', $selected_shipping['id']); $ShipTxt.='<table border="0" width="100%">'; if(sizeof($quotes)) { if (tep_session_is_registered('customer_id')) { // logged in if (CARTSHIP_SHOWWT == 'true') { $showweight = ' (' . $total_weight . ' ' . CARTSHIP_WTUNIT . ')'; } else { $showweight = ''; } if(CARTSHIP_SHOWIC == 'true'){ //ishazer remover hard code for version 2.20 : $ShipTxt.='<tr><td class="main">' . ($total_count == 1 ? ' <b>Item:</b></td><td colspan="2" class="main">' : ' <b>' . CART_ITEM . '</b></td><td colspan="2" class="main">') . $total_count . $showweight . '</td></tr>'; $ShipTxt.='<tr><td class="main">' . ($total_count == 1 ? ' <b>' . CART_ITEM . '</b></td><td colspan="2" class="main">' : ' <b>' . CART_ITEM . '</b></td><td colspan="2" class="main">') . $total_count . $showweight . '</td></tr>'; } $addresses_query = tep_db_query("select address_book_id, entry_city as city, entry_postcode as postcode, entry_state as state, entry_zone_id as zone_id, entry_country_id as country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . $customer_id . "'"); // only display addresses if more than 1 if (tep_db_num_rows($addresses_query) > 1){ while ($addresses = tep_db_fetch_array($addresses_query)) { $addresses_array[] = array('id' => $addresses['address_book_id'], 'text' => tep_address_format(tep_get_address_format_id($addresses['country_id']), $addresses, 0, ' ', ' ')); } $ShipTxt.='<tr><td colspan="3" class="main" nowrap>' . CART_SHIPPING_METHOD_ADDRESS .' '. tep_draw_pull_down_menu('address_id', $addresses_array, $selected_address, 'onchange="return shipincart_submit(\'\');"').'</td></tr>'; } $ShipTxt.='<tr valign="top"><td class="main"><b>' . CART_SHIPPING_METHOD_TO .'</b> </td><td colspan="2" class="main">'. tep_address_format($order->delivery['format_id'], $order->delivery, 1, ' ', '<br>') . '</td></tr>'; } else { // not logged in $ShipTxt.='<tr><td colspan="2" nowrap><b>' . CART_SHIPPING_OPTIONS_LOGIN . '</b></td></tr>'; if(CARTSHIP_SHOWIC == 'true'){ //azer for 2.20: $ShipTxt.='<tr><td class="main">' . ($total_count == 1 ? ' <b>Item:</b></td><td colspan="2" class="main">' : ' <b>Items:</b></td><td colspan="2" class="main">') . $total_count . $showweight . '</td></tr>'; $ShipTxt.='<tr> <td colspan="2" class="main" nowrap>' . ($total_count == 1 ? ' <b>' . CART_ITEM . '</b> ': ' <b>' . CART_ITEM . '</b></td> <td colspan="2" class="main">') . $total_count . $showweight . '</td> </tr>'; } if($cart->get_content_type() != 'virtual'){ if(CARTSHIP_SHOWCDD == 'true'){ $ShipTxt.='<tr><td colspan="2" class="main" nowrap>' . ENTRY_COUNTRY .' '. tep_get_country_list('country_id', $selected_country,'style="width=200"').'<br />'; } //add state zone_id $state_array[] = array('id' => '', 'text' => 'Please Select'); $state_query = tep_db_query("select zone_name, zone_id from " . TABLE_ZONES . " where zone_country_id = '$selected_country' order by zone_country_id DESC, zone_name"); while ($state_values = tep_db_fetch_array($state_query)) { $state_array[] = array('id' => $state_values['zone_id'], 'text' => $state_values['zone_name']); } if(CARTSHIP_SHOWSDD == 'true'){ $ShipTxt.=ENTRY_STATE .' '. tep_draw_pull_down_menu('state',$state_array).'<br />'; } if(CARTSHIP_SHOWZDD == 'true'){ $ShipTxt.=ENTRY_POST_CODE .' '. tep_draw_input_field('zip_code', $selected_zip, 'size="5"'); } // $ShipTxt.=' <a href="_" onclick="return shipincart_submit(\'\');">'.CART_SHIPPING_METHOD_RECALCULATE.'</a></td></tr>'; if(CARTSHIP_SHOWUB == 'true'){ $ShipTxt.=' <td><a href="_" onclick="return shipincart_submit(\'\');">'. tep_image_button('button_update_cart.gif', IMAGE_BUTTON_UPDATE_CART) . ' </a></td></td></tr>'; } } } if($cart->get_content_type() == 'virtual'){ // virtual product-download //$ShipTxt.='<tr><td colspan="3" class="main">'.tep_draw_separator().'</td></tr>'; $ShipTxt.='<tr><td class="main" colspan="3"> </td></tr><tr><td class="main" colspan="3"><i>' . CART_SHIPPING_METHOD_FREE_TEXT . ' ' . CART_SHIPPING_METHOD_ALL_DOWNLOADS . '</i></td></tr>'; }elseif ($free_shipping==1) { // order $total is free //$ShipTxt.='<tr><td colspan="3" class="main">'.tep_draw_separator().'</td></tr>'; $ShipTxt.='<tr><td class="main" colspan="3"> </td></tr><tr><td class="main" colspan="3"><i>' . sprintf(FREE_SHIPPING_DESCRIPTION, $currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)) . '</i></td><td> </td></tr>'; }else{ // shipping display if ( empty($quotes[0]['error']) || (!empty($quotes[1])&∅($quotes[1]['error'])) ) { $ShipTxt.='<tr><td colspan="3" class="main"> </td></tr><tr><td class="main"><b>' . CART_SHIPPING_CARRIER_TEXT . '</b></td><td class="main" align="left"><b>' . CART_SHIPPING_METHOD_TEXT . '</b></td><td class="main" align="right"><b>' . CART_SHIPPING_METHOD_RATES . '</b></td></tr>'; $ShipTxt.='<tr><td colspan="3" class="main">'.tep_draw_separator().'</td></tr>'; // added to Display Message when No Shipping Options are Available $at_least_one_quote_printed = false; } else { $ShipTxt.='<tr><td colspan="3" class="main"> </td></tr>'; } for ($i=0, $n=sizeof($quotes); $i<$n; $i++) { if(sizeof($quotes[$i]['methods'])==1){ // simple shipping method $thisquoteid = $quotes[$i]['id'].'_'.$quotes[$i]['methods'][0]['id']; $ShipTxt.= '<tr class="'.$extra.'">'; $ShipTxt.='<td class="main">'.$quotes[$i]['icon'].' </td>'; if($quotes[$i]['error']){ $ShipTxt.='<td colspan="2" class="main">'.$quotes[$i]['module'].' '; $ShipTxt.= '('.$quotes[$i]['error'].')</td></tr>'; }else{ if($selected_shipping['id'] == $thisquoteid){ // commented for v2.10 : $ShipTxt.='<td class="main"><a title="Select this method" href="_" onclick="return shipincart_submit(\''.$thisquoteid.'\');"><b>'.$quotes[$i]['module'].' '; $ShipTxt.='<td class="main"><a title="' . CART_SELECT_THIS_METHOD .'" href="_" onclick="return shipincart_submit(\''.$thisquoteid.'\');"><b>'.$quotes[$i]['module'].' '; $ShipTxt.= '('.$quotes[$i]['methods'][0]['title'].')</b></a> </td><td align="right" class="main"><b>'.$currencies->format(tep_add_tax($quotes[$i]['methods'][0]['cost'], $quotes[$i]['tax'])).'</b></td><td class="main">'.tep_image(DIR_WS_ICONS . 'selected.gif', 'Selected').'</td></tr>'; }else{ // commented for v2.10 : $ShipTxt.='<td class="main"><a title="Select this method" href="_" onclick="return shipincart_submit(\''.$thisquoteid.'\');">'.$quotes[$i]['module'].' '; $ShipTxt.='<td class="main"><a title="' . CART_SELECT_THIS_METHOD .'" href="_" onclick="return shipincart_submit(\''.$thisquoteid.'\');">'.$quotes[$i]['module'].' '; $ShipTxt.= '('.$quotes[$i]['methods'][0]['title'].')</a> </td><td align="right" class="main">'.$currencies->format(tep_add_tax($quotes[$i]['methods'][0]['cost'], $quotes[$i]['tax'])).'</td></tr><tr><td colspan="3"></td></tr>'; } } // added to Display Message when No Shipping Options are Available $at_least_one_quote_printed = true; } elseif(sizeof($quotes[$i]['methods'])>1) { // shipping method with sub methods (multipickup) for ($j=0, $n2=sizeof($quotes[$i]['methods']); $j<$n2; $j++) { $thisquoteid = $quotes[$i]['id'].'_'.$quotes[$i]['methods'][$j]['id']; $ShipTxt.= '<tr class="'.$extra.'">'; $ShipTxt.='<td class="main">'.$quotes[$i]['icon'].' </td>'; if($quotes[$i]['error']){ $ShipTxt.='<td colspan="2" class="main">'.$quotes[$i]['module'].' '; $ShipTxt.= '('.$quotes[$i]['error'].')</td></tr>'; }else{ if($selected_shipping['id'] == $thisquoteid){ // commented for v2.10 : $ShipTxt.='<td class="main"><a title="Select this method" href="_" onclick="return shipincart_submit(\''.$thisquoteid.'\');"><b>'.$quotes[$i]['module'].' '; $ShipTxt.='<td class="main"><a title="' . CART_SELECT_THIS_METHOD .'" href="_" onclick="return shipincart_submit(\''.$thisquoteid.'\');"><b>'.$quotes[$i]['module'].' '; $ShipTxt.= '('.$quotes[$i]['methods'][$j]['title'].')</b></a> </td><td align="right" class="main"><b>'.$currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])).'</b></td><td class="main">'.tep_image(DIR_WS_ICONS . 'selected.gif', 'Selected').'</td></tr>'; }else{ // commented for v2.10 : $ShipTxt.='<td class="main"><a title="Select this method" href="_" onclick="return shipincart_submit(\''.$thisquoteid.'\');">'.$quotes[$i]['module'].' '; $ShipTxt.='<td class="main"><a title="' . CART_SELECT_THIS_METHOD .'" href="_" onclick="return shipincart_submit(\''.$thisquoteid.'\');">'.$quotes[$i]['module'].' '; $ShipTxt.= '('.$quotes[$i]['methods'][$j]['title'].')</a> </td><td align="right" class="main">'.$currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])).'</td><td class="main"> </td></tr>'; } } } // added to Display Message when No Shipping Options are Available $at_least_one_quote_printed = true; } } // added to Display Message when No Shipping Options are Available if (!$at_least_one_quote_printed) { $ShipTxt.= '<tr><td colspan="4" class="main" align="center">'.SHIPPING_ESTIMATOR_NO_OPTIONS_MESSAGE.'</td></tr>'; } } } $ShipTxt.= '</table></form>'; } $info_box_contents = array(); $info_box_contents[] = array('text' => $ShipTxt); new infoBox($info_box_contents); ?> <!-- --------------------------------------------------------------------------------------------------------------------- //--> <?php // if the customer is not logged on, redirect them to the login page // if (!tep_session_is_registered('customer_id')) { // $navigation->set_snapshot(); // tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); // } // if there is nothing in the customers cart, redirect them to the shopping cart page // if ($cart->count_contents() < 1) { // tep_redirect(tep_href_link(FILENAME_SHOPPING_CART)); // } // if no shipping method has been selected, redirect the customer to the shipping method selection page // if (!tep_session_is_registered('shipping')) { // tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); // } // avoid hack attempts during the checkout procedure by checking the internal cartID if (isset($cart->cartID) && tep_session_is_registered('cartID')) { if ($cart->cartID != $cartID) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); } } // Stock Check // if ( (STOCK_CHECK == 'true') && (STOCK_ALLOW_CHECKOUT != 'true') ) { // $products = $cart->get_products(); // for ($i=0, $n=sizeof($products); $i<$n; $i++) { // if (tep_check_stock($products[$i]['id'], $products[$i]['quantity'])) { // tep_redirect(tep_href_link(FILENAME_SHOPPING_CART)); // break; // } // } // } // if no billing destination address was selected, use the customers own address as default // if (!tep_session_is_registered('billto')) { // tep_session_register('billto'); // $billto = $customer_default_address_id; // } else { // verify the selected billing address // $check_address_query = tep_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$billto . "'"); // $check_address = tep_db_fetch_array($check_address_query); // if ($check_address['total'] != '1') { // $billto = $customer_default_address_id; if (tep_session_is_registered('payment')) tep_session_unregister('payment'); // } // } //-MS- Active Countries Added // if( !tep_validate_active_countries($billto, 1) ) { // $messageStack->add_session('checkout_address', 'Invalid Country for Billing'); // tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT_ADDRESS, '', 'SSL')); // } //-MS- Active Countries Added EOM // require(DIR_WS_CLASSES . 'order.php'); // $order = new order; if (!tep_session_is_registered('comments')) tep_session_register('comments'); $total_weight = $cart->show_weight(); $total_count = $cart->count_contents(); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PAYMENT); $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); ?> <?php require(DIR_WS_CLASSES . 'order_total.php'); $order_total_modules = new order_total; //echo '</td><td align="right">'; // order total code $order_total_modules->process(); require(DIR_WS_CLASSES . 'payment.php'); $payment_modules = new payment; $info_box_contents = array(); $info_box_contents[] = array('text' => '<b>' . CART_Payment_OPTIONS . '</b>'); // azer for 2.20 cosmetic change new infoBoxHeading($info_box_contents, false, false); ?> <script language="javascript"><!-- var selected; function selectRowEffect(object, buttonSelect) { if (!selected) { if (document.getElementById) { selected = document.getElementById('defaultSelected'); } else { selected = document.all['defaultSelected']; } } if (selected) selected.className = 'moduleRow'; object.className = 'moduleRowSelected'; selected = object; // one button is not an array if (document.checkout_payment.payment[0]) { document.checkout_payment.payment[buttonSelect].checked=true; } else { document.checkout_payment.payment.checked=true; } } function rowOverEffect(object) { if (object.className == 'moduleRow') object.className = 'moduleRowOver'; } function rowOutEffect(object) { if (object.className == 'moduleRowOver') object.className = 'moduleRow'; } //--></script> <?php echo $payment_modules->javascript_validation(); ?> <tr> <td width="100%" valign="top"> <!-- <?php echo tep_draw_form('checkout_payment', tep_href_link(FILENAME_CHECKOUT_CONFIRMATION /*FILENAME_SHOPPING_CART */, '', 'NONSSL'), 'post' /*, 'onsubmit="return check_form();"' */ ); ?> //--> <?php echo tep_draw_form('checkout_payment', tep_href_link(FILENAME_SHOPPING_CART, '', 'SSL'), 'post', 'onsubmit="return check_form();"'); ?> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php if (isset($HTTP_GET_VARS['payment_error']) && is_object(${$HTTP_GET_VARS['payment_error']}) && ($error = ${$HTTP_GET_VARS['payment_error']}->get_error())) { ?> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="main"><b><?php echo tep_output_string_protected($error['title']); ?></b></td> </tr> </table></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="0" class="infoBoxNotice"> <tr class="infoBoxNoticeContents"> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main" width="100%" valign="top"><?php echo tep_output_string_protected($error['error']); ?></td> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php } ?> <!-- <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="main"><b><?php echo TABLE_HEADING_PAYMENT_METHOD; ?></b></td> <td class="main" align="right"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td> </tr> </table></td> </tr> //--> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0" class="infoBox"> <tr class="infoBoxContents"> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <?php $selection = $payment_modules->selection(); if (sizeof($selection) > 1) { ?> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main" width="50%" valign="top"><nobr><?php echo TEXT_SELECT_PAYMENT_METHOD; ?></nobr> </td> <td class="main" width="50%" valign="top" align="right"><b><?php echo TITLE_PLEASE_SELECT; ?></b><br><?php echo tep_image(DIR_WS_IMAGES . 'arrow_east_south.gif'); ?></td> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> <?php } else { ?> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main" width="100%" colspan="1"><?php echo TEXT_ENTER_PAYMENT_INFORMATION; ?></td> <!-- <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> //--> </tr> <?php } $radio_buttons = 0; for ($i=0, $n=sizeof($selection); $i<$n; $i++) { ?> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td colspan="2"> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <?php if ( ($selection[$i]['id'] == $payment) || ($n == 1) ) { echo ' <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n"; } else { echo ' <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n"; } ?> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main" colspan="3"><b><?php echo $selection[$i]['module']; if ($selection[$i]['cost']){ echo ' ('.$currencies->format($selection[$i]['cost']).')'; } ?></b> </td> <td width="20" class="main" align="right"> <?php if (sizeof($selection) > 1) { echo tep_draw_radio_field('payment', $selection[$i]['id']); } else { echo tep_draw_hidden_field('payment', $selection[$i]['id']); } ?> </td> <?php if ($selection[$i]['id'] == $payment) { ?> <td width="70" align="right"><?php echo tep_image_submit('pixel_trans.gif', ' update'), tep_draw_separator('pixel_trans.gif', '10', '1'), tep_image(DIR_WS_ICONS . 'selected.gif', 'Selected'); ?></td> <?php } else { ?> <td width="70"><?php echo tep_image_submit('pixel_trans.gif', 'selecteaza'); ?></td> <?php } ?> </tr> <?php /* // 'onsubmit="return check_form();"' // onclick="return shipincart_submit(\'\');" if($selected_shipping['id'] == $thisquoteid){ // commented for v2.10 : $ShipTxt.='<td class="main"><a title="Select this method" href="_" onclick="return shipincart_submit(\''.$thisquoteid.'\');"><b>'.$quotes[$i]['module'].' '; $ShipTxt.='<td class="main"><a title="' . CART_SELECT_THIS_METHOD .'" href="_" onclick="return shipincart_submit(\''.$thisquoteid.'\');"><b>'.$quotes[$i]['module'].' '; $ShipTxt.= '('.$quotes[$i]['methods'][0]['title'].')</b></a> </td><td align="right" class="main"><b>'.$currencies->format(tep_add_tax($quotes[$i]['methods'][0]['cost'], $quotes[$i]['tax'])).'</b></td><td class="main">'.tep_image(DIR_WS_ICONS . 'selected.gif', 'Selected').'</td></tr>'; }else{ // commented for v2.10 : $ShipTxt.='<td class="main"><a title="Select this method" href="_" onclick="return shipincart_submit(\''.$thisquoteid.'\');">'.$quotes[$i]['module'].' '; $ShipTxt.='<td class="main"><a title="' . CART_SELECT_THIS_METHOD .'" href="_" onclick="return shipincart_submit(\''.$thisquoteid.'\');">'.$quotes[$i]['module'].' '; $ShipTxt.= '('.$quotes[$i]['methods'][0]['title'].')</a> </td><td align="right" class="main">'.$currencies->format(tep_add_tax($quotes[$i]['methods'][0]['cost'], $quotes[$i]['tax'])).'</td></tr><tr><td colspan="3"></td></tr>'; } */ ?> <?php if (isset($selection[$i]['error'])) { ?> <tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main" colspan="4"><?php echo $selection[$i]['error']; ?></td> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> <?php } elseif (isset($selection[$i]['fields']) && is_array($selection[$i]['fields'])) { ?> <tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td colspan="4"><table border="0" cellspacing="0" cellpadding="2"> <?php for ($j=0, $n2=sizeof($selection[$i]['fields']); $j<$n2; $j++) { ?> <tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main"><?php echo $selection[$i]['fields'][$j]['title']; ?></td> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main"><?php echo $selection[$i]['fields'][$j]['field']; ?></td> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> <?php } ?> </table></td> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> <?php } ?> </table></td> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> <?php $radio_buttons++; } ?> </table></td> </tr> </table></td> </tr> <!-- <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> <tr class="infoBoxContents"> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main"><b><?php echo TITLE_CONTINUE_CHECKOUT_PROCEDURE . '</b><br>' . TEXT_CONTINUE_CHECKOUT_PROCEDURE; ?></td> <td class="main" align="right"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> </table></td> </tr> </table></td> </tr> //--> <!-- --------------------------------------------------------------------------------------------------------------------- //--> <?php // load all enabled payment modules if (CARTSHIP_SHOWOT == 'true'){ // BOF get taxes if not logged in if (!tep_session_is_registered('customer_id')){ $products = $cart->get_products(); for ($i=0, $n=sizeof($products); $i<$n; $i++) { $products_tax = tep_get_tax_rate($products[$i]['tax_class_id'], $order->delivery['country_id'],$order->delivery['zone_id']); $products_tax_description = tep_get_tax_description($products[$i]['tax_class_id'], $order->delivery['country_id'], $order->delivery['zone_id']); global $vat_disp; if ($vat_disp == '1') { // if (DISPLAY_PRICE_WITH_TAX == 'true') { //Modified by Strider 42 to correct the tax calculation when a customer is not logged in // $tax_val = ($products[$i]['final_price']-(($products[$i]['final_price']*100)/(100+$products_tax)))*$products[$i]['quantity']; $tax_val = (($products[$i]['final_price']/100)*$products_tax)*$products[$i]['quantity']; } else { $tax_val = (($products[$i]['final_price']*$products_tax)/100)*$products[$i]['quantity']; // $tax_val = (($products[$i]['final_price']*$products_tax)/100)*$products[$i]['quantity']; } $order->info['tax'] += $tax_val; $order->info['tax_groups']["$products_tax_description"] += $tax_val; // Modified by Strider 42 to correct the order total figure when shop displays prices with tax global $vat_disp; if ($vat_disp == '1') { // if (DISPLAY_PRICE_WITH_TAX == 'true') { $order->info['total']; } else { $order->info['total']+=$tax_val; } } } // EOF get taxes if not logged in (seems like less code than in order class) ?> <?php $info_box_contents = array(); $info_box_contents[] = array('text' => '<b>' . CART_OT . '</b>'); //azer version 2.20 new infoBoxHeading($info_box_contents, false, false); $otTxt='<table align="right" border="0" cellspacing="0" cellpadding="0">'; $otTxt.=$order_total_modules->output().'</table>'; $info_box_contents = array(); $info_box_contents[] = array('text' => $otTxt); new infoBox($info_box_contents); if (SHOW_SHADOWS == 'true') { require(DIR_WS_MODULES . 'shadow_controller/shadow_bottom.php'); $extra_table=''; $use_shadow_alt = 'none'; } } // } // Use only when cart_contents > 0 ?> </table></form></td> </tr> <!-- </td></tr></table> //--> Quote Link to comment Share on other sites More sharing options...
daz_75 Posted April 23, 2007 Share Posted April 23, 2007 Hi Sufalot, I think i've asked you this question before and i don't think you found a fix for it at the time. I've had this contrib installed for a while with no problems, i've just been shipping to the UK. I now want to ship abroad but when i log in as a dummy user from, let say Germany, i get the following error. Warning: htmlspecialchars() expects parameter 1 to be string, array given in /home/chapel00/public_html/shop/includes/functions/general.php on line 42 Warning: htmlspecialchars() expects parameter 1 to be string, array given in /home/chapel00/public_html/shop/includes/functions/general.php on line 42 Any ideas, sorry if it's been fixed somewhere in this thread already Daz Quote Link to comment Share on other sites More sharing options...
werkzeugladen.de Posted April 26, 2007 Share Posted April 26, 2007 There is a Solution for Ship & Payment in Cart in the german forum http://forums.oscommerce.de/index.php?show...c=52054&hl= I'm using it by myself and it works very well. <!-- shipping_estimator //--> <table align="center"><tr valign="top"><td> <?php /* $Id: shipping_estimator.php,v Alpha 1.0 2004/12/30 13:06:45 eml Exp $ Alpha 1.0 by Nightwalker/mountain (see Install.txt for partial version history) Copyright (c) 2004 Released under the GNU General Public License */ require(DIR_WS_LANGUAGES . $language . '/modules/' . FILENAME_SHIPPING_ESTIMATOR); // Only do when something is in the cart if ($cart->count_contents() > 0) { // shipping cost require('includes/classes/http_client.php'); // shipping in basket if (isset($HTTP_GET_VARS['sid'])) { $cart_sid = $HTTP_GET_VARS['sid']; } else { $cart_sid = ''; tep_session_register('cart_sid'); } if (isset($HTTP_GET_VARS['pid'])) { $cart_pid = $HTTP_GET_VARS['pid']; } if (tep_session_is_registered('customer_id')) { // user is logged in if (isset($HTTP_POST_VARS['address_id'])) { // user changed address $sendto = $HTTP_POST_VARS['address_id']; $billto = $HTTP_POST_VARS['address_id']; } elseif (tep_session_is_registered('cart_address_id')) { // user once changed address $sendto = $cart_address_id; $billto = $cart_address_id; } else { // first timer $sendto = $customer_default_address_id; $billto = $customer_default_address_id; } // set session now $cart_address_id = $sendto; tep_session_register('cart_address_id'); // set shipping to null ! multipickup changes address to store address... $shipping=''; // include the order class (uses the sendto !) require(DIR_WS_CLASSES . 'order.php'); $order = new order; } else { // user not logged in ! if (isset($HTTP_POST_VARS['country_id'])) { // country is selected $country_info = tep_get_countries($HTTP_POST_VARS['country_id'],true); $order->delivery = array('postcode' => $HTTP_POST_VARS['zip_code'], 'country' => array('id' => $HTTP_POST_VARS['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' => $HTTP_POST_VARS['country_id'], 'zone_id' => $HTTP_POST_VARS['state'], 'format_id' => tep_get_address_format_id($HTTP_POST_VARS['country_id'])); $cart_country_id = $HTTP_POST_VARS['country_id']; tep_session_register('cart_country_id'); $cart_zone = $HTTP_POST_VARS['zone_id']; tep_session_register('cart_zone'); $cart_zip_code = $HTTP_POST_VARS['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)); $order->billing = 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); $cart_zip_code = STORE_ZIP_CODE; tep_session_register('cart_zip_code'); $order->delivery = array('postcode' => $cart_zip_code, '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($HTTP_POST_VARS['country_id'])); $order->billing = array('postcode' => $cart_zip_code, '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($HTTP_POST_VARS['country_id'])); } // set the cost to be able to calculate free shipping $order->info = array('total' => $cart->show_total(), // TAX ???? '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']; $selected_address = $sendto; // check free shipping based on order total if ( defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING') && (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true')) { switch (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) { case 'national': if ($order->delivery['country_id'] == STORE_COUNTRY) $pass = true; break; case 'international': if ($order->delivery['country_id'] != STORE_COUNTRY) $pass = true; break; case 'both': $pass = true; break; default: $pass = false; break; } $free_shipping = false; if ( ($pass == true) && ($order->info['total'] >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)) { $free_shipping = true; include(DIR_WS_LANGUAGES . $language . '/modules/order_total/ot_shipping.php'); } } else { $free_shipping = false; } // begin shipping cost if (!$free_shipping && $cart->get_content_type() !== 'virtual') { if (tep_not_null($HTTP_POST_VARS['sid'])) { list($module, $method) = explode('_', $HTTP_POST_VARS['sid']); $cart_sid = $HTTP_POST_VARS['sid']; tep_session_register('cart_sid'); } elseif (tep_session_is_registered('cart_sid')) { list($module, $method) = explode('_', $cart_sid); } else { $module=""; $method=""; } if (tep_not_null($module)) { $selected_quote = $shipping_modules->quote($method, $module); if (($selected_quote[0]['error'] || !tep_not_null($selected_quote[0]['methods'][0]['cost'])) && (empty($cart_sid) == 'true')) { $selected_shipping = $shipping_modules->cheapest(); $order->info['shipping_method'] = $selected_shipping['title']; $order->info['shipping_cost'] = $selected_shipping['cost']; $order->info['total']+= $selected_shipping['cost']; } else { $order->info['shipping_method'] = $selected_quote[0]['module'].' ('.$selected_quote[0]['methods'][0]['title'].')'; $order->info['shipping_cost'] = $selected_quote[0]['methods'][0]['cost']; $order->info['total']+= $selected_quote[0]['methods'][0]['cost']; $selected_shipping['title'] = $order->info['shipping_method']; $selected_shipping['cost'] = $order->info['shipping_cost']; $selected_shipping['id'] = $selected_quote[0]['id'].'_'.$selected_quote[0]['methods'][0]['id']; } } else { $selected_shipping = $shipping_modules->cheapest(); $order->info['shipping_method'] = $selected_shipping['title']; $order->info['shipping_cost'] = $selected_shipping['cost']; $order->info['total']+= $selected_shipping['cost']; } } // virtual products use free shipping if($cart->get_content_type() == 'virtual') { $order->info['shipping_method'] = CART_SHIPPING_METHOD_FREE_TEXT . ' ' . CART_SHIPPING_METHOD_ALL_DOWNLOADS; $order->info['shipping_cost'] = 0; } if($free_shipping) { $order->info['shipping_method'] = MODULE_ORDER_TOTAL_SHIPPING_TITLE; $order->info['shipping_cost'] = 0; } $shipping = $selected_shipping; // end free shipping based on order total $info_box_contents = array(); $info_box_contents[] = array('text' => CART_SHIPPING_OPTIONS); new infoBoxHeading($info_box_contents, false, false); $ShipTxt = tep_draw_form('estimator', tep_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'), 'post'); $ShipTxt .= tep_draw_hidden_field('sid', $selected_shipping['id']); $ShipTxt .= '<table>'; if (sizeof($quotes)) { if (tep_session_is_registered('customer_id')) { // logged in if (CARTSHIP_SHOWIC == 'true') { $ShipTxt .= '<tr><td class="main"><b>' . CART_SHIPPING_ITEM . '</b></td><td colspan="2" class="main">' . $total_count . '</td></tr>'; } if (CARTSHIP_SHOWWT == 'true') { $ShipTxt .= '<tr><td class="main"><b>' . CART_SHIPPING_WEIGHT . '</b></td><td colspan="2" class="main">' . $total_weight . ' ' . CARTSHIP_WTUNIT . '</td></tr>'; } $addresses_query = tep_db_query("select address_book_id, entry_city as city, entry_postcode as postcode, entry_state as state, entry_zone_id as zone_id, entry_country_id as country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . $customer_id . "'"); // only display addresses if more than 1 if (tep_db_num_rows($addresses_query) > 1) { while ($addresses = tep_db_fetch_array($addresses_query)) { $addresses_array[] = array('id' => $addresses['address_book_id'], 'text' => tep_address_format(tep_get_address_format_id($addresses['country_id']), $addresses, 0, ' ', ' ')); } $ShipTxt .= '<tr><td colspan="3" class="main" nowrap>' . CART_SHIPPING_METHOD_ADDRESS .' '. tep_draw_pull_down_menu('address_id', $addresses_array, $selected_address, 'onchange="java script:return shipincart_submit(\'\');"').'</td></tr>'; } $ShipTxt .= '<tr valign="top"><td class="main"><b>' . CART_SHIPPING_METHOD_TO .'</b> </td><td colspan="2" class="main">'. tep_address_format($order->delivery['format_id'], $order->delivery, 1, ' ', '<br>') . '</td></tr>'; } else { // not logged in $ShipTxt .= '<hr><center><b>' . CART_SHIPPING_OPTIONS_LOGIN . '</b></center><hr>'; if (CARTSHIP_SHOWIC == 'true') { $ShipTxt .= '<tr><td class="main"><b>' . CART_SHIPPING_ITEM . '</b></td><td colspan="2" class="main">' . $total_count . '</td></tr>'; } if (CARTSHIP_SHOWWT == 'true') { $ShipTxt .= '<tr><td class="main"><b>' . CART_SHIPPING_WEIGHT . '</b></td><td colspan="2" class="main">' . $total_weight . ' ' . CARTSHIP_WTUNIT . '</td></tr>'; } if ($cart->get_content_type() != 'virtual') { if (CARTSHIP_SHOWCDD == 'true') { $ShipTxt .= '<tr><td class="main" nowrap><b>' . ENTRY_COUNTRY . '</b></td>' . '<td class="main" colspan="2">' . tep_get_country_list('country_id', $selected_country,'style="width=150"'); } //add state zone_id $state_array[] = array('id' => '', 'text' => CART_SHIPPING_SELECT); $state_query = tep_db_query("select zone_name, zone_id from " . TABLE_ZONES . " where zone_country_id = '$selected_country' order by zone_country_id DESC, zone_name"); while ($state_values = tep_db_fetch_array($state_query)) { $state_array[] = array('id' => $state_values['zone_id'], 'text' => $state_values['zone_name']); } if (CARTSHIP_SHOWSDD == 'true') { $ShipTxt .= ' ' .ENTRY_STATE .' '. tep_draw_pull_down_menu('state',$state_array); } if (CARTSHIP_SHOWZDD == 'true') { $ShipTxt .= ' '.ENTRY_POST_CODE .' '. tep_draw_input_field('zip_code', $cart_zip_code, 'size="5"'); } if (CARTSHIP_SHOWUB == 'true') { $ShipTxt .= ' '. tep_image_submit('button_update_cart.gif', CART_SHIPPING_UPDATE, ''); } $ShipTxt .= '</td></tr>'; } } if ($cart->get_content_type() == 'virtual') { // virtual product-download $ShipTxt .= '<tr><td class="main" colspan="3"> </td></tr><tr><td class="main" colspan="3"><i>' . CART_SHIPPING_METHOD_FREE_TEXT . ' ' . CART_SHIPPING_METHOD_ALL_DOWNLOADS . '</i></td></tr>'; } elseif ($free_shipping == 1) { // order $total is free $ShipTxt .= '<tr><td class="main" colspan="3"> </td></tr><tr><td class="main" colspan="3"><i>' . sprintf(FREE_SHIPPING_DESCRIPTION, $currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)) . '</i></td><td> </td></tr>'; } else { // shipping display $ShipTxt .= '<tr><td colspan="4" class="main"> </td></tr><tr><td class="main"><b>' . CART_SHIPPING_CARRIER_TEXT . '</b></td><td class="main" align="left"><b>' . CART_SHIPPING_METHOD_TEXT . '</b></td><td class="main" align="right"><b>' . CART_SHIPPING_METHOD_RATES . '</b></td></tr>'; $ShipTxt .= '<tr><td colspan="4" class="main">'.tep_draw_separator().'</td></tr>'; for ($i=0, $n=sizeof($quotes); $i<$n; $i++) { if (sizeof($quotes[$i]['methods'])==1) { // simple shipping method $thisquoteid = $quotes[$i]['id'] . '_' .$quotes[$i]['methods'][0]['id']; $ShipTxt .= '<tr><td class="main">'. $quotes[$i]['icon'].' </td>'; if ($quotes[$i]['error']) { $ShipTxt .= '<td colspan="2" class="main">' . $quotes[$i]['module'].' '; $ShipTxt .= '(' . $quotes[$i]['error'] . ')</td></tr>'; } else { if ($selected_shipping['id'] == $thisquoteid) { $ShipTxt .= '<td class="main"><b>' . $quotes[$i]['module'] . ' '; $ShipTxt .= '(' . $quotes[$i]['methods'][0]['title'] . ')</b> </td>'; $ShipTxt .= '<td align="right" class="main"><b>'.$currencies->format(tep_add_tax($quotes[$i]['methods'][0]['cost'], $quotes[$i]['tax'])).'</b></td>'; $ShipTxt .= '<td class="main"><a href="' . tep_href_link(FILENAME_SHOPPING_CART, 'sid=' . $thisquoteid . '&pid=' . $cart_pid, 'NONSSL') . '">' . tep_image(DIR_WS_ICONS . 'selected.gif', CART_SHIPPING_SELECT) . '</a></td>'; } else { $ShipTxt .= '<td class="main">' . $quotes[$i]['module'] . ' '; $ShipTxt .= '(' . $quotes[$i]['methods'][0]['title'] . ') </td>'; $ShipTxt .= '<td align="right" class="main">'.$currencies->format(tep_add_tax($quotes[$i]['methods'][0]['cost'], $quotes[$i]['tax'])).'</td>'; $ShipTxt .= '<td class="main"><a href="' . tep_href_link(FILENAME_SHOPPING_CART, 'sid=' . $thisquoteid . '&pid=' . $cart_pid, 'NONSSL') . '">' . tep_image(DIR_WS_ICONS . 'unselected.gif', CART_SHIPPING_SELECT) . '</a></td>'; } } } else { // shipping method with sub methods (multipickup) for ($j=0, $n2=sizeof($quotes[$i]['methods']); $j<$n2; $j++) { $thisquoteid = $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id']; $ShipTxt .= '<tr><td class="main">' . $quotes[$i]['icon'] . ' </td>'; if ($quotes[$i]['error']) { $ShipTxt .= '<td colspan="2" class="main">' . $quotes[$i]['module'] . ' '; $ShipTxt .= '(' . $quotes[$i]['error'] . ')</td></tr>'; } else { if ($selected_shipping['id'] == $thisquoteid) { $ShipTxt .= '<td class="main"><b>' . $quotes[$i]['module'] . ' '; $ShipTxt .= '(' . $quotes[$i]['methods'][$j]['title'] . ')</b> </td>'; $ShipTxt .= '<td align="right" class="main"><b>'.$currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])).'</b></td>'; $ShipTxt .= '<td class="main"><a href="' . tep_href_link(FILENAME_SHOPPING_CART, 'sid=' . $thisquoteid . '&pid=' . $cart_pid, 'NONSSL') . '">' . tep_image(DIR_WS_ICONS . 'selected.gif', CART_SHIPPING_SELECT) . '</a></td>'; } else { $ShipTxt .= '<td class="main">' . $quotes[$i]['module'] . ' '; $ShipTxt .= '(' . $quotes[$i]['methods'][$j]['title'] . ') </td>'; $ShipTxt .= '<td align="right" class="main">'.$currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])).'</td>'; $ShipTxt .= '<td class="main"><a href="' . tep_href_link(FILENAME_SHOPPING_CART, 'sid=' . $thisquoteid . '&pid=' . $cart_pid, 'NONSSL') . '">' . tep_image(DIR_WS_ICONS . 'unselected.gif', CART_SHIPPING_SELECT) . '</a></td>'; } } } } } } require(DIR_WS_CLASSES . 'payment.php'); $payment_modules = new payment; $ShipTxt .= '<tr><td colspan="4" class="main">'.tep_draw_separator().'</td></tr>'; $selection = $payment_modules->selection(); for ($i=0, $n=sizeof($selection); $i<$n; $i++) { if (empty($cart_pid)) { $cart_pid = $selection[0]['id']; tep_session_register('cart_pid'); } if ( ($selection[$i]['id'] == $payment) || ($n == 1) ) { $ShipTxt .= '<tr><td colspan="4" class="main">' . $selection[$i]['module'] . '</td></tr>'; } else { $ShipTxt .= '<tr><td colspan="3" class="main">' . $selection[$i]['module'] . '</td>'; if ($selection[$i]['id'] == $cart_pid) { $ShipTxt .= '<td class="main"><a href="' . tep_href_link(FILENAME_SHOPPING_CART, 'sid=' . $cart_sid . '&pid=' . $cart_pid, 'NONSSL') . '">' . tep_image(DIR_WS_ICONS . 'selected.gif', CART_SHIPPING_SELECT) . '</a></td></tr>'; } else { $ShipTxt .= '<td class="main"><a href="' . tep_href_link(FILENAME_SHOPPING_CART, 'sid=' . $cart_sid . '&pid=' . $selection[$i]['id'], 'NONSSL') . '">' . tep_image(DIR_WS_ICONS . 'unselected.gif', CART_SHIPPING_SELECT) . '</a></td></tr>'; } } } } $ShipTxt .= '</table></form>'; if (tep_session_is_registered('payment')) tep_session_unregister('payment'); $payment = $cart_pid; $info_box_contents = array(); $info_box_contents[] = array('text' => $ShipTxt); new infoBox($info_box_contents); if (CARTSHIP_SHOWOT == 'true') { if (!tep_session_is_registered('customer_id')) { $products = $cart->get_products(); for ($i=0, $n=sizeof($products); $i<$n; $i++) { $products_tax = tep_get_tax_rate($products[$i]['tax_class_id'], $order->delivery['country_id'],$order->delivery['zone_id']); $products_tax_description = tep_get_tax_description($products[$i]['tax_class_id'], $order->delivery['country_id'], $order->delivery['zone_id']); if (DISPLAY_PRICE_WITH_TAX == 'true') { $tax_val = (($products[$i]['final_price']/100)*$products_tax)*$products[$i]['quantity']; } else { $tax_val = (($products[$i]['final_price']*$products_tax)/100)*$products[$i]['quantity']; } $order->info['tax'] += $tax_val; $order->info['tax_groups']["$products_tax_description"] += $tax_val; if (DISPLAY_PRICE_WITH_TAX == 'true') { $order->info['total']; } else { $order->info['total']+=$tax_val; } } } require(DIR_WS_CLASSES . 'order_total.php'); $order_total_modules = new order_total; $order_total_modules->process(); $info_box_contents = array(); $info_box_contents[] = array('text' => CART_SHIPPING_OT); new infoBoxHeading($info_box_contents, false, false); $otTxt = '<table align="right">'; $otTxt .= $order_total_modules->output().'</table>'; $info_box_contents = array(); $info_box_contents[] = array('text' => $otTxt); new infoBox($info_box_contents); } } else { echo '<table align="center"><tr><td class="main">' . CART_SHIPPING_CART_EMPTY . '</td></tr></table>'; } ?> </td></tr></table> Quote Link to comment Share on other sites More sharing options...
surfalot Posted April 27, 2007 Share Posted April 27, 2007 Hi Sufalot, I think i've asked you this question before and i don't think you found a fix for it at the time. I've had this contrib installed for a while with no problems, i've just been shipping to the UK. I now want to ship abroad but when i log in as a dummy user from, let say Germany, i get the following error. Any ideas, sorry if it's been fixed somewhere in this thread already Daz does the same thing happen when you get a shipping quote anonymously? Quote Link to comment Share on other sites More sharing options...
Tomason Posted May 1, 2007 Share Posted May 1, 2007 Thank you, the solution you presented (took from the german forum) is better. There wold be another problem. Maybe you know the solution for the following problem. If not, please put it on the german forum, maybe someone knows. I would do it myself, but I don't speak German. After installing shipping estimator with the completion presented above by you and after also installing Payment Type Charge v1.7 from http://www.oscommerce.com/community/contributions,251, I managed to obtain a much more complete shipping+payment. The problem is on the column "Rates", where in shipping are the values for each type of delivery, in payment there is no value. Do you think you can help me with it? Thank you. Quote Link to comment Share on other sites More sharing options...
birchy82 Posted June 1, 2007 Share Posted June 1, 2007 Im running into a problem with this whenever you hit update or click the type of shipping i get this : http://lsestore.com/_ 404 Not Found The requested URL /_ was not found on this server. any ideas? Quote Link to comment Share on other sites More sharing options...
hejhog Posted June 22, 2007 Share Posted June 22, 2007 Hello, Has anyone managed to find a solution to the Tax calculation and Total for users from countries outside of your tax zone. I am UK based and charge VAT. Customers outside the EU pay no VAT. When NOT logged in The Estimater shows VAT as 0 when a country outside the EU is selected but the subtotal and total still include tax. ie. Subtotal = £20 incorrect should be £17.02 shipping = £10 correct Tax = £0 correct Total = £30 incorrect should be £27.02 When LOGGED in The Total is now correct but the subtotal still shows the amount including tax. ie SubTotal = £20 incorrect should be £17.02 shipping = £10 correct Tax = 0 correct Total = £27.02 correct Any solutions?? Many Thanks, Shaun Quote Link to comment Share on other sites More sharing options...
Irin Posted June 23, 2007 Share Posted June 23, 2007 Hello all, Great contrib. Is there any way to have shipping_estimator.php as a separate page and in shopping cart just a link to that page? My shopping_cart.php is different from the original osC version as I have CCGV module installed. Thanks. Quote Link to comment Share on other sites More sharing options...
Irin Posted June 26, 2007 Share Posted June 26, 2007 I've got the same problem as Ryan in Post #528 that everytime I hit Update button to calculate the shipping rates I'm presented with "404 Not Found". The link looks like: http://mystore.com/_. Does anybody have a solution to this problem? Thanks. Quote Link to comment Share on other sites More sharing options...
Irin Posted June 30, 2007 Share Posted June 30, 2007 I finally fixed the problem with the Shipping Calculator. Optional updates caused a problem with the module. However, I've got another problem now. I have 4 shipping modules installed: FedEx, UPS, USPS, and Pickup. Estimate Shipping shows correct shipping rates but when any of UPS or FedEx methods are selected, the Order Total Estimate shows UPS or FedEx rates x2. For example: Estimate Shipping Federal Express (Ground Service (1 days)) $4.01 Federal Express (Express Saver (3 Day)) $9.65 United Parcel Service (UPS Ground) $8.04 United Parcel Service (UPS 3 Day Select) $11.58 United Parcel Service (UPS 2nd Day Air) $16.00 United States Postal Service (EXPRESS (1 - 2 Days)) $19.50 United States Postal Service (Priority (2 - 3 Days)) $4.60 Pickup (No shipping charge added) $0.00 Order Total Estimate Sub-Total: $45.80 Handling Fee: $5.00 United Parcel Service (UPS 3 Day Select): $23.16 Total: $73.96 There is also a problem with FedEx shipping rates. Doesn't matter what FedEx method I select it always shows FedEx Ground Service selected and Order Total Estimate also shows only FedEx Ground rate. Is there any solution to the problem? Thanks in advance. jdog2004 1 Quote Link to comment Share on other sites More sharing options...
tigergirl Posted July 19, 2007 Share Posted July 19, 2007 Hi folks, I'm really interested in this contribution and was about to install. BUT, I noticed JAVASCRIPT being mentioned in the code which worries me slighlty. I have problems with java stuff in my browser and I know it can be disabled in browsers too. Does this mean that this mod won't work in a browser where java is disabled or broken? Also, does anyone use this with Active Countries Contribution and UK Royal Mail & Overseea Shipping Methods Contribution? Are they fully compatible? Thanks Tiger Quote I'm feeling lucky today......maybe someone will answer my post! I do try and answer a simple post when I can just to give something back. ------------------------------------------------ PM me? - I'm not for hire Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.