Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Ship In Cart


Guest

Recommended Posts

The error message came back!!! When I created a new customer and from checkout page went back to the shopping cart, the error came back.

 

Tried your solution, Mike:

 

Added to logoff.php:

 

// added to fix ship in cart oscsid problem...

tep_session_unregister('cart_address_id');

 

However this did not fix it.

 

Searced som more and then I did the same as first time in includes/functions/general.php, but in another line:

 

} elseif (isset($address['country']) && tep_not_null($address['country'])) {

$country = tep_output_string_protected($address['country']['title']);

 

There was two lines of codes involving country and both had to be fixed. Now the error has disappeared and did not came back even if creating a new customer.

 

Still have no solution to the problem with the address not showing for logged on customer. Need some help here:-)))

 

Thanks,

Kjolebutikken

Edited by kjolebutikken

Best regards

Kjolebutikken

Link to comment
Share on other sites

The error message came back!!! When I created a new customer and from checkout page went back to the shopping cart, the error came back.

 

Tried your solution, Mike:

 

Added to logoff.php:

 

// added to fix ship in cart oscsid problem...

tep_session_unregister('cart_address_id');

 

However this did not fix it.

 

Searced som more and then I did the same as first time in includes/functions/general.php, but in another line:

 

} elseif (isset($address['country']) && tep_not_null($address['country'])) {

$country = tep_output_string_protected($address['country']['title']);

 

There was two lines of codes involving country and both had to be fixed. Now the error has disappeared and did not came back even if creating a new customer.

 

Still have no solution to the problem with the address not showing for logged on customer. Need some help here:-)))

 

Thanks,

Kjolebutikken

 

The unregister tip totally worked for me, it is confusing why you had to go through so many additional steps to correct it. Well if it's fixed then that is the mian thing.

 

Regarding the non registered guest. I had already added this line:

if ($cart->count_contents() > 0) {

 

It did cause the ship in cart box to appear beneath my cart where previously it would only appear for logged in customers, BUT that box for non logged in guests only displays the cost of the items in their cart, not the calculated shipping costs or total with shipping. Note that the contribution works perfect for logged in guests, but this is who I need it least for.

 

If anyone can help me to get this contribution working I would be greatly appreciative. I have visited many sites that have it working exactly as I need so I know it is possible.

 

Thank you,

Mike

Link to comment
Share on other sites

The unregister tip totally worked for me, it is confusing why you had to go through so many additional steps to correct it. Well if it's fixed then that is the mian thing.

 

Regarding the non registered guest. I had already added this line:

if ($cart->count_contents() > 0) {

 

It did cause the ship in cart box to appear beneath my cart where previously it would only appear for logged in customers, BUT that box for non logged in guests only displays the cost of the items in their cart, not the calculated shipping costs or total with shipping. Note that the contribution works perfect for logged in guests, but this is who I need it least for.

 

If anyone can help me to get this contribution working I would be greatly appreciative. I have visited many sites that have it working exactly as I need so I know it is possible.

 

Thank you,

Mike

 

Hi Mike, seems like we have opposite problems. Not logged in works perfectly for me, showing, price of products, shipping cost and the total incl. shipping. Logged in customer; address is missing, all others are fine.

 

Hope someone else is reading this and can help us both!

 

Kjolebutikken:-)

Best regards

Kjolebutikken

Link to comment
Share on other sites

Hi Mike, seems like we have opposite problems. Not logged in works perfectly for me, showing, price of products, shipping cost and the total incl. shipping. Logged in customer; address is missing, all others are fine.

 

Hope someone else is reading this and can help us both!

 

Kjolebutikken:-)

I wish I had your problem, not logged in is what I find this contribution most useful to. I feel that customers want to know the cost of shipping and the total cost overall before registering an account. Originally I had the purchase without account contirbution installed but really the only thing this does is remove the necessity to choose an account name and password. It still did not show shipping info until after the customer had already committed all of their personal information. Ship in cart completely solves this, but alas I cannot get it working!

 

Do you have any idea in which file the information to populate the ship in cart box comes from? What I am saying is in which OS Commerce file does the ship in cart mod grab that info from? Even more importantly in which file does it request this information?

 

Thanks to anyone who can help, this is driving me batty!

Mike

Link to comment
Share on other sites

I wish I had your problem, not logged in is what I find this contribution most useful to. I feel that customers want to know the cost of shipping and the total cost overall before registering an account. Originally I had the purchase without account contirbution installed but really the only thing this does is remove the necessity to choose an account name and password. It still did not show shipping info until after the customer had already committed all of their personal information. Ship in cart completely solves this, but alas I cannot get it working!

 

Do you have any idea in which file the information to populate the ship in cart box comes from? What I am saying is in which OS Commerce file does the ship in cart mod grab that info from? Even more importantly in which file does it request this information?

 

Thanks to anyone who can help, this is driving me batty!

Mike

Well I have it solved! It seems that unless I choose to display the country drop down box then it does not work. Once I turn this on in admin the contribution comes to life!

 

The only issue I still have and this may just be the way the contribution is designed to work is that if I choose a country such as Italy, I can then click update and get the shipping to Italy to display, it will add up the products and the chosen shipping method at the bottom. But if I switch countries it no longer adds the shipping plus products, it displays the new shipping to the country I pick and it displays the total of the products it just doesn't combine the shipping and products. If I go back and select the original country it adds everything up normally again. I suppose this is no big deal since a person lives only in 1 country and it is very unlikely they will switch once they pick their home country. Never the less it would be nice to see everything update properly even if the country is changed. The only way around this is to return to the original country or if country must be switched to delete the cookie and start over.

 

Mike

Link to comment
Share on other sites

Well I have it solved! It seems that unless I choose to display the country drop down box then it does not work. Once I turn this on in admin the contribution comes to life!

 

The only issue I still have and this may just be the way the contribution is designed to work is that if I choose a country such as Italy, I can then click update and get the shipping to Italy to display, it will add up the products and the chosen shipping method at the bottom. But if I switch countries it no longer adds the shipping plus products, it displays the new shipping to the country I pick and it displays the total of the products it just doesn't combine the shipping and products. If I go back and select the original country it adds everything up normally again. I suppose this is no big deal since a person lives only in 1 country and it is very unlikely they will switch once they pick their home country. Never the less it would be nice to see everything update properly even if the country is changed. The only way around this is to return to the original country or if country must be switched to delete the cookie and start over.

 

Mike

 

Hi Mike, I did the same as you and enabled the country dropdown list again, and now it works fine here too. The address is showing when customer is logged in. I do not have your problem with switching between countries. Maybe it has something to do with that I have not assigned the shippingmethod to different zones. have you done that? Might be the problem. I did not do that because I'm only shipping to one country, so I have zones set to "no zone" or "choose zone" in admin-modules-shipping -"each module". You could try that and just see if the problem is still there. If you are indeed shipping to several countries and have to use different shippingmethods for each country, this will however not be the solution. Sorry I can't help you there:-) I will have to try to come up with a way to "disquise" the country dropdown list without setting it to false in admin again, cause I do not want it to show. I will let you know if I find a solution:-)

 

Kjolebutikken

Best regards

Kjolebutikken

Link to comment
Share on other sites

Hi Mike, I did the same as you and enabled the country dropdown list again, and now it works fine here too. The address is showing when customer is logged in. I do not have your problem with switching between countries. Maybe it has something to do with that I have not assigned the shippingmethod to different zones. have you done that? Might be the problem. I did not do that because I'm only shipping to one country, so I have zones set to "no zone" or "choose zone" in admin-modules-shipping -"each module". You could try that and just see if the problem is still there. If you are indeed shipping to several countries and have to use different shippingmethods for each country, this will however not be the solution. Sorry I can't help you there:-) I will have to try to come up with a way to "disquise" the country dropdown list without setting it to false in admin again, cause I do not want it to show. I will let you know if I find a solution:-)

 

Kjolebutikken

Well it seems my only remaining problem is not really a problem at all. It was just that my international customers have 2 shipping methods available to them. Until they select one of the available options it does not get added into the total at the bottom. So this is a feature that I was just overlooking. For united States customers I only offer 1 shipping method but when switching back to the United States even though there is only 1 shipping method it does not auto select the shipping method, therefore it appears that it is not added in. Once the user clicks on the shipping method it all totals up. I wish I knew a way to always have the shipping method selected. The mod does auto select the cheapest shipping method for a new browser but once the cookie is set any changes from one country to another or even one US zip to another reuslts in teh shipping not being autoselected. This results in the total not being tallied at the bottom.

 

Is there a fix for this?

 

Thanks all!

Mike

Link to comment
Share on other sites

Well it seems my only remaining problem is not really a problem at all. It was just that my international customers have 2 shipping methods available to them. Until they select one of the available options it does not get added into the total at the bottom. So this is a feature that I was just overlooking. For united States customers I only offer 1 shipping method but when switching back to the United States even though there is only 1 shipping method it does not auto select the shipping method, therefore it appears that it is not added in. Once the user clicks on the shipping method it all totals up. I wish I knew a way to always have the shipping method selected. The mod does auto select the cheapest shipping method for a new browser but once the cookie is set any changes from one country to another or even one US zip to another reuslts in teh shipping not being autoselected. This results in the total not being tallied at the bottom.

 

Is there a fix for this?

 

Thanks all!

Mike

Update:

 

It seems that if I clear the cookie and then add something to my cart, the shipping calculator will always highlight the cheapest option only for the type of country that I first tried. For example if I check shipping to the US zip code 60148 then it highlights the Priority Mail method which is the only one I offer, therefore the total at the bottom is accurate. it will continue to highlight the cheapest method to any zip code as long as I do not switch from the United States. BUT if I switch to any other country it shows the new international options which I offer but the cheapest is not selected. Therefore the total at the bottom does not include shipping. If I clear the cookie and the first place I check is any country other than the US then the cart will continue to highlight the cheapest shipping method to any country BUT the US. Once I select US the shipping cost comes up but is not selected, which I don't like because it's the only US method I use.

 

Finally on some other sites I have seen using this contribution, the ship in cart box comes up with all the shipping options that they offer displayed with $0.00 as the cost. Once I put in a country the $0.00 updates to the correct amount. How are people doing this?

 

Thanks all!

Mike

Edited by docprego
Link to comment
Share on other sites

I've run into a bit of a problem with this contribution hoping someone may be able to point me to where I've gone wrong. The contrib works great be it as a non-logged in guest or a logged in member of my store.

However I have two problems.

 

#1)I can not get the shipping amount to show up in the subtotal section near the bottom.

#2)I can not for the life of me get the word "item/items" and the item count to line up together.

 

Please see screen shots below for display..

 

Not Logged In

Snap2.jpg

 

Logged In

Snap1.jpg

 

Now I'm also using the Zero Weight Free Shipping mod in combination with SIC. Merged the changes with no problem it was only a matter of changing a few words.

 

My shipping_estimator.php

<?php
/*
 $Id: shipping_estimator.php,v 2.10 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 (c) 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>
		  <table align="center" width="100%"><tr valign="top"><td>

<?php
// Only do when something is in the cart and customer is logged in (Fix for v2.0 and all other versions Acheron 7 Jul 2004 )
// azer for 2.10 origianl : if ($cart->count_contents() > 0) {
if ($cart->count_contents() > 0) {



 require(DIR_WS_LANGUAGES . $language . '/modules/' . FILENAME_SHIPPING_ESTIMATOR);

 // 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' => CART_SHIPPING_OPTIONS);
 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>';
 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'){
  $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>';
   }
  $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.=tep_output_warning(CART_SHIPPING_OPTIONS_LOGIN);

	if(CARTSHIP_SHOWIC == 'true'){
  $ShipTxt.='<tr><td class="main">' . ($total_count == 1 ? ' <b><br>Item:</b></td><td colspan="2" class="main">' : ' <b><br>Items:</b></td><td colspan="2" class="main"><br>') . $total_count . $showweight . '</td></tr>';
   }

  if($cart->get_content_type() != 'virtual'){

	if(CARTSHIP_SHOWCDD == 'true'){
	$ShipTxt.='<tr><td colspan="3" class="main" nowrap>' .
			  ENTRY_COUNTRY .'?'. tep_get_country_list('country_id', $selected_country,'style="width=200"');
	}

//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.='? <br>' .ENTRY_STATE .'?'. tep_draw_pull_down_menu('state',$state_array);
	}

	if(CARTSHIP_SHOWZDD == 'true'){
	  $ShipTxt.='? <br><br>'.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(\'\');"><br>'. 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
  $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>';
  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></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>';
		}
	  }
	} 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 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>';
		  }
		}
	  }
	}
  }
}
 }
 $ShipTxt.= '</table></form>';

 $info_box_contents = array();
 $info_box_contents[] = array('text' => $ShipTxt);
 new infoBox($info_box_contents);

 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']);
	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'];
	}
	$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
	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)
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();

$info_box_contents = array();
$info_box_contents[] = array('text' => CART_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);
 }
} // Use only when cart_contents > 0
?>
		 </td></tr></table>

 

I understand this is a ton of stuff to look over but if some one else can spot the where I've gone wrong I would be so greatful!! I can live without the shipping showing in the subtotal section since they can clearly see it on the page anyhow. But would really luv to get the Item/Items text and the item count closer together.

 

TIA -- Mindy

 

I should note here just to note I'm not a complete moron I do understand that on the screen shots above my item has no shipping cost so it will show $0.00 in the subtotal field. But it remains $0.00 in the subtotal field even when the estimator displays the correct shipping cost for item that do not have free shipping. It just never changes in the subtotal field for shipping cost.

Edited by InnocentlyWiked
Link to comment
Share on other sites

Does anyone have a live site that I could see how this contribution works. Considering upgrading to it. I am using the shipping estimator right now, but this may be a better module.

Link to comment
Share on other sites

Does anyone have a live site that I could see how this contribution works. Considering upgrading to it. I am using the shipping estimator right now, but this may be a better module.

 

My site is not live yet, but you can see here if you want. It's in norwegian though and I have removed the dropdown tables for country, state and zipcode. The only product that functions yet is the blue dress you see at the top.

 

http://www.kjolebutikken.com/oscdemo1/index.php

 

I have two shippingmodules installed, the individual product shipping and store pick-up, which I use with this ship in cart estimator.

 

The only problem I have with my shipping modules at the time, is that if the product is registerd with an individual shippingcost (and all my products will be), then this shippingmethod "dominates" the other and is the only alternative to be seen for the customer. I am not sure why or if this is caused by the ship in cart module. If someone reading this should know, please inform me:-) Thanks!

 

Best regards

Kjolebutikken

Best regards

Kjolebutikken

Link to comment
Share on other sites

  • 2 weeks later...
Does anyone have a live site that I could see how this contribution works. Considering upgrading to it. I am using the shipping estimator right now, but this may be a better module.

 

Hello,

 

Here is a link to a working version: http://distinctivediscounts.com/distinct1/main_content/

 

This WebSite is a Template. All functions work. Feel free to explore it.

 

I have not been able to get the estimator to show a tax rate if viewer is not logged in, so I have placed a tax notice in the header, which is only seen when not logged in. When logged in the correct tax is seen.

 

Perhaps seeing it work, will be of some use.

 

Regards,

 

Carlos

Link to comment
Share on other sites

I had the problem where non-logged in users were getting the estimator box but no info in the top half where address, package and shipping options. I have multiple shipping/tax zones for Domestic and International shipping. Everything worked fine for logged in users.

 

This is what I did to fix it. It isn't 100% QA'd but it seems ok for now.

 

I found this code in shipping_estimator.php:

 

// 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));

 

 

 

And I changed it to this:

	  // 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,
							 'zone_id'	=> '12',
							 'format_id' => tep_get_address_format_id($cart_country_id));

 

Essentially adding a default zone id (12 is california which is my stores home zone). I also did the same with the "first timer" section of code just below this one.

 

Hopefully this will help some other folks who have had zone issues with this distribution.

 

Karim

Link to comment
Share on other sites

Hi Mike, seems like we have opposite problems. Not logged in works perfectly for me, showing, price of products, shipping cost and the total incl. shipping. Logged in customer; address is missing, all others are fine.

 

Hope someone else is reading this and can help us both!

 

Kjolebutikken:-)

 

Hi Kjolebutikken,

 

i dont know if im wrong but I had the same problem as You, no address(es) showing for the logged in customer on my side it happened because my DB table address_format was empty.. after having filled it properly everything workes fine. Sometimes its so simple..to overlook.

 

HTH

kind regards

Christoph

Edited by beerbee
Link to comment
Share on other sites

  • 2 weeks later...

Hi there,

 

I just installed the latest Ship in Cart on my site, but I cant see any options to turn it on or off in admin. And it doesnt seem to have changed my site at all.

 

It came up with an error when doing the sql insert, ...

 

SQL query:

 

INSERT INTO configuration_group( configuration_group_id, configuration_group_title, configuration_group_description, sort_order, visible )

VALUES ( 19, 'Shopping Cart', 'Shopping Cart options', 19, 1 )

MySQL said:

 

#1062 - Duplicate entry '19' for key 1

 

Is this where it is going wrong?

 

Cheers,

 

Jon.

Link to comment
Share on other sites

  • 1 month later...

Hi,

I just installed Ship In Cart v2.20 by azer in my local test shop and I must confess I thought it was going to put the shipping cost in the shopping cart infobox, not on the shopping cart page. Did I do something wrong?

If not, is this possible?

 

Finally, what is the way it is intended to be used ? I have this problem:

Having this information on the shopping cart page as my shop is currently set up is redundant

When the customer continues to the next page, they are asked to specify the shipping method again !

Is this page supposed to be skipped now by an admin setting?

 

Then is ship in cart a contribution whose goal is to combine the two pages, shopping_cart and check-out shipping into a single page?

Is that the goal?

 

Thanks in advance,

India

(posted to the other ship in cart thread but I guess this is the right one? http://www.oscommerce.com/forums/index.php?sho...=0entry819484

)

*** Je suis plus souvent sur le forum français ***

ms2fr, Header Tags 2.5.5b, Order logging before payment, Better PayPal Description perso, Free shipping per product, Must agree to terms, Country State Selector, World Zones, Visible countries, Store Pick Up, several shipping modules, Personal Invoice Number, 'On the Fly' Auto Thumbnailer using GD Library, More_Pics_6 for 2.2 ms2, Ultimate SEO URLs 2-2.1d/e,Virement Bancaire, Estimated Shipping 1.5, xml_guide, SP+,Step By Step 1.8, Order Editor 2.6.3, Google Analytics, Dynamic Sitemap 2.0, OSC-Expeditor, Recover Cart Sales, Links Manager 1.15

local : linux 2.6 Fedora Core 3, server : APACHE 2.0.54, MySQL 4.1.18, php : 4.4.0 (on strike refuse to update)

remote : IcoOpenBSD 4.x, server : IcodiaSecureHttpd, MySQL 4.1.24, php : 4.4.9

 

You never get a second chance to make a first impression.

Link to comment
Share on other sites

OK folks here is how I got it to work when a customer is not logged in I installed the latest package 2.2 and used the includes/modules/shipping_estimator.php file from 2.0

 

The unregister tip totally worked for me, it is confusing why you had to go through so many additional steps to correct it. Well if it's fixed then that is the mian thing.

 

Regarding the non registered guest. I had already added this line:

if ($cart->count_contents() > 0) {

 

It did cause the ship in cart box to appear beneath my cart where previously it would only appear for logged in customers, BUT that box for non logged in guests only displays the cost of the items in their cart, not the calculated shipping costs or total with shipping. Note that the contribution works perfect for logged in guests, but this is who I need it least for.

 

If anyone can help me to get this contribution working I would be greatly appreciative. I have visited many sites that have it working exactly as I need so I know it is possible.

 

Thank you,

Mike

Link to comment
Share on other sites

OK, I am confused. I have added this and it works fine IF YOU ARE ALREADY LOGGED IN. I have made the cahnge so that it shows a sub total if you are not logged in, but the shipping estimates do not appear. I read above where somone else had the same problem and he fixed it by turning on a county drop down from within admin. There is no shipping estimator module listed in my shipping modules, or anywhere else that I can see. Where do I find this, did I do something wrong on the install?

Link to comment
Share on other sites

OK, I am confused. I have added this and it works fine IF YOU ARE ALREADY LOGGED IN. I have made the cahnge so that it shows a sub total if you are not logged in, but the shipping estimates do not appear. I read above where somone else had the same problem and he fixed it by turning on a county drop down from within admin. There is no shipping estimator module listed in my shipping modules, or anywhere else that I can see. Where do I find this, did I do something wrong on the install?

 

 

OK, I found it. :blush:

Link to comment
Share on other sites

Hi there,

 

I just installed the latest Ship in Cart on my site, but I cant see any options to turn it on or off in admin. And it doesnt seem to have changed my site at all.

 

It came up with an error when doing the sql insert, ...

 

SQL query:

 

INSERT INTO configuration_group( configuration_group_id, configuration_group_title, configuration_group_description, sort_order, visible )

VALUES ( 19, 'Shopping Cart', 'Shopping Cart options', 19, 1 )

MySQL said:

 

#1062 - Duplicate entry '19' for key 1

 

Is this where it is going wrong?

 

Cheers,

 

Jon.

 

I'm also getting a similar error as Jon when I run the SQL. This is the first time I've attempted to install this contrib - does anyone know how to fix this?

 

MySQL said:

#1062 - Duplicate entry '219' for key 1

 

Thanks for any help

 

~Barbara~

Edited by bobsi18
Link to comment
Share on other sites

I'm also getting a similar error as Jon when I run the SQL. This is the first time I've attempted to install this contrib - does anyone know how to fix this?

 

MySQL said:

#1062 - Duplicate entry '219' for key 1

 

Thanks for any help

 

~Barbara~

 

Well, I fixed that... I think... I just changed the numbers in the SQL file, to start from 360 and up, seemed to solve the error, is that right?

 

I was also having the problem with the estimate not showing when a customer isn't logged in, so I followed dootch's advice (from earlier in the forum) and used the includes/modules/shipping_estimator.php file from 2.0. Seems to be working fine. Two small issues I'm still having tho... I've set it up so that it shows the country drop down and the postcode option.

 

1)---- Can I somehow set 'Australia' as the default country (my orders are almost entirely from Aus, would make it easier on the customer)?

 

2)---- Can I limit the size of the drop down list - It takes up a lot of the page and throws everything off whack. I understand that some of the countries have long names (e.g. Macedonia, The Former Yugoslav Republic of), but it's really stuffing up the overall look of the page...

 

Thanks, great contrib!

 

~Barbara~

Link to comment
Share on other sites

  • 7 months later...
  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...