Jump to content
ednique

[Contribution] Ship In Cart

Recommended Posts

It needs to pull from the modules/vender shipping directory rather than the modules/shipping....

 

How would I do that?

search the contributions section. I think I have seen this contribution modified for the MVS system. (I could be wrong)

Share this post


Link to post
Share on other sites
I followed the five steps on setup and I can not see the ship in cart without be logged.

 

Have anyone installed this script and worked ?

I have, but I wouldn't know where to start looking if one of the 20 shipping modules are causing problems. If it is installed correctly, it should show to guests.

Share this post


Link to post
Share on other sites

Excellent contrib, thanks.

 

Is there anyway to get it to automatically pick the best price, as the shipping cart does, rather than just picking the last one you had selected?

 

Also, when one of the shipping option is selected that can't be selected (if you get what i mean) it displays a shipping price of -50p anyway to stop that happening?

 

Thanks

 

Daz

Edited by daz_75

Share this post


Link to post
Share on other sites

It seems to only remember the last item selected on the current visit. Which I would consider a "feature". If someone has decided the wish to have express shipping, but then goes back to the store and shops some more, the last shipping they selected is still selected.

 

To any new visit, it is reset and selects the cheapest. (this wasn't my design, I just did a little fixing in what I uploaded)

 

when one of the shipping option is selected that can't be selected

 

No, I don't know what you mean. If it's displayed, it should be selectable.

Share this post


Link to post
Share on other sites

ok mate no worries, wish i'd get updates to threads i subscribe to :'(

 

Here is what i mean

 

estimatebu5.jpg

 

Not exactly a big problem as the user should be smart enough to pick on of the correct postage option, i just think it looks a bit crap

Share this post


Link to post
Share on other sites

just noticed this doesn't work with international customers, works fine for uk though. Any ideas what this error below is?

 

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

 

The code on line 42 is in bold below

 

// Parse the data used in the html tags to ensure the tags will not break
 function tep_parse_input_field_data($data, $parse) {
return strtr(trim($data), $parse);
 }

 function tep_output_string($string, $translate = false, $protected = false) {
if ($protected == true) {
[b]  return htmlspecialchars($string);[/b]
} else {
  if ($translate == false) {
	return tep_parse_input_field_data($string, array('"' => '"'));
  } else {
	return tep_parse_input_field_data($string, $translate);
  }
}
 }

Share this post


Link to post
Share on other sites

That is not quite what I have in my general.php for the output string section. You could test this code. My whole section look like:

 

function tep_output_string($string, $translate = false, $protected = false) {

if ($protected == true) {

return htmlspecialchars($string);

} else {

if ($translate == false) {

return tep_parse_input_field_data($string, array('"' => '"'));

} else {

return tep_parse_input_field_data($string, $translate);

}

}

}

 

function tep_output_string_protected($string) {

return tep_output_string($string, false, true);

}

 

function tep_sanitize_string($string) {

$string = ereg_replace(' +', ' ', trim($string));

 

return preg_replace("/[<>]/", '_', $string);

}

 

As you can see its using &quot .. instead of the actual character. Don't ask me why LOL

Share this post


Link to post
Share on other sites
As you can see its using &quot .. instead of the actual character. Don't ask me why LOL

it's converting " into " because this function output strings to be a part of the input HTML tag as the

<input value="<?php echo tep_output_string(etc.); ?>">

it has to be converted or it breaks the HTML tag.

Share this post


Link to post
Share on other sites
just noticed this doesn't work with international customers, works fine for uk though. Any ideas what this error below is?

The code on line 42 is in bold below

restore that function tep_output_string() from a fresh copy of osCommerce just to make sure. I tried a few international shipping options form a US store and it seems to work fine for me.

Share this post


Link to post
Share on other sites

checked it against the default one and that part of the code is identical. There are some things that aren't in my current file compared to a new one, but i guess they are for something else

Share this post


Link to post
Share on other sites
checked it against the default one and that part of the code is identical. There are some things that aren't in my current file compared to a new one, but i guess they are for something else

I don't think the error you are having is directly realated to this contrib. I can't find the use of the tep_output_string function anywhere in the default shopping_cart.php or in this contrib.

Share this post


Link to post
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

 

 

I just tried it.. it shows the info when i just click on the cart content button,

 

after I put in the zip code and click update button, it goes back to the previous stage, no info in the top box. you have this problem?

Share this post


Link to post
Share on other sites

Hi all,

 

Great contrib.

 

How do i get rid of the select country and postcode bit, i dont want that on my shop :-

 

sample.jpg

 

Thanks

Tom

Share this post


Link to post
Share on other sites
How do i get rid of the select country and postcode bit, i dont want that on my shop :-

if you have run the SQL on your database, there should be some configuration items in your admin. I think the group is called: Shopping Cart

Share this post


Link to post
Share on other sites

Just downloaded this contribution v2.2.1 for my 2.2m2

But the Instructions in Instal.txt is not clear for me:

1. Run included SQL... How to run? The included SQL.txt runs by Notepad. Seems it is a wrong way.

Please advice.

 

Thanks

Sergei

Share this post


Link to post
Share on other sites
Just downloaded this contribution v2.2.1 for my 2.2m2

But the Instructions in Instal.txt is not clear for me:

1. Run included SQL... How to run? The included SQL.txt runs by Notepad. Seems it is a wrong way.

Please advice.

 

Thanks

Sergei

run this script in your phpMyAdmin or similar database

management tool supplied by your host.

Share this post


Link to post
Share on other sites

HI

 

Just installed the Ship In Cartand we are getting the following error

 

Fatal error: Cannot redeclare class in

httpclient in /includes/classes/http_client.php on line 37

 

 

Uhave searched everywhere an con not find an answer. can anyone point us in the correct direction

 

 

Thanks

 

joe


----------------------------

Long Island, New York

Share this post


Link to post
Share on other sites
HI

 

Just installed the Ship In Cartand we are getting the following error

 

Fatal error: Cannot redeclare class in

httpclient in /includes/classes/http_client.php on line 37

Uhave searched everywhere an con not find an answer. can anyone point us in the correct direction

Thanks

 

joe

sure that wasn't Estimated Shipping Costs that caused that ? please don't cross post. I would back-track the last contribution or changes you made until you've located the problem. the error means that class has been included twice in the code.

Share this post


Link to post
Share on other sites

Hi

I'm having trouble with Ship In Cart passing a value onto a Zone based shipping module for customers not logged in. (US shipping only)

 

The zone based shipping modules all use the following code (or a simialr version)

// if delivery is to other country, skip module in cart
     if ($order->delivery['country']['iso_code_2'] != 'US') return;

     $dest_state = $order->delivery['state']; 
     $dest_zone = 0;
     $error = false;

     for ($i=1; $i<=$this->num_zones; $i++) {
       $state_table = constant('INTERSTATE_STATES_' . $i);
       $state_zones = split("[ ,]", $state_table);
       if (in_array($dest_state, $state_zones)) {
         $dest_zone = $i;
         break;

 

The country value seems to work just fine as the module will stop if a non US country is selected. The next line: $dest_state = $order->delivery['state']; is not returning any value at all (I'm peeved as I did have it working but then zapped the files and, for the life of me, I cannot get it going again)

 

I can hard code a state into the line $dest_state = $order->delivery['UT']; and it works fine.

(The zone based modules also rely on zone_code rather than zone_id but whichever I pull out in the dropdown menu in Ship in cart is not getting picked up by this module)

 

Any pointers/ideas

 

Bob

Share this post


Link to post
Share on other sites
The country value seems to work just fine as the module will stop if a non US country is selected. The next line: $dest_state = $order->delivery['state']; is not returning any value at all (I'm peeved as I did have it working but then zapped the files and, for the life of me, I cannot get it going again)

 

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×