Jump to content
ednique

[Contribution] Ship In Cart

Recommended Posts

In the install instructions it says this:

" go to /catalog/shopping_cart.php

find:

<?php

} else {

?>

<tr>

<td align="center" class="main"><?php echo TEXT_CART_EMPTY; ?></td>

</tr>

add just above these lines put:

<tr>

<td><br><?php require(DIR_WS_MODULES . 'shipping_estimator.php'); ?></td>

</tr>"

 

Change it to this:

 

" go to /catalog/shopping_cart.php

find:

<?php

} else {

?>

<tr>

<td align="center" class="main"><?php echo TEXT_CART_EMPTY; ?></td>

</tr>

add just above these lines put:

</form><tr>

<td><br><?php require(DIR_WS_MODULES . 'shipping_estimator.php'); ?></td>

</tr>"

 

I forgot about the little part of not being able to add it inside of the <form> tags. Sorry about that!

Share this post


Link to post
Share on other sites

Yup ... v1.81 works great on MS2... thanks very much, excellent contribution. :rolleyes:

 

Only one (very, very small) thing ... the 'Update Country' button doesn't line up with the 'Countries' drop-down box (it's slightly higher) - although the previous 'Recalculate' text lined up fine - ... can't see how to move the button down a bit (tried 'valign="middle" but it doesn't do anything).

 

Anyone had this problem and found a way?

 

TIA

 

:rolleyes:

Share this post


Link to post
Share on other sites

I'm getting errors when I use this mod. I'm using a snapshot from 2 weeks ago. If the customer is not logged in I get this error:

 

Fatal error: Call to a member function on a non-object in /home/wvdrops/public_html/includes/modules/shipping_estimator.php on line 278

 

 

Line 278 is this

$ShipTxt.= '('.$quotes[$i]['methods'][$j]['title'].')</td><td align="right" class="main">'.$currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])).'</td><td class="main">[<a href="_" onclick="return shipincart_submit(\''.$thisquoteid.'\');">'.CART_SELECT.'</a>]</td></tr>';

 

If the customer is logged in I get this

 

Warning: htmlspecialchars() expects parameter 1 to be string, array given in /home/wvdrops/public_html/includes/functions/general.php on line 45

 

Warning: htmlspecialchars() expects parameter 1 to be string, array given in /home/wvdrops/public_html/includes/functions/general.php on line 45

 

 

Fatal error: Call to undefined function: tep_get_tax_rate() in /home/wvdrops/public_html/includes/modules/shipping_estimator.php on line 297

 

Line 45 is this

 return htmlspecialchars($string);


Keith

 

 

What the hell was I thinkin'?

Share this post


Link to post
Share on other sites
I'm getting errors when I use this mod. I'm using a snapshot from 2 weeks ago.

I think you answered your own question there as this is for MS2 aka July snapshots. As CVS moves closer to MS3 most of the current contributions will no longer work- see Here/ There is no reason to try to update contributions until MS3 is actually released as it would be like chasing your own tail. If I had to guess what part is causing the problems it would be the tep_add_tax part. Needless to say you will need to re-write portions of the contribution to get it to work with CVS due to recent code changes.

Share this post


Link to post
Share on other sites

Thats exactly what I thought. Everytime I installed a new mod I had to run down problems. I would fix one error and cause 3 more in it's place. I think I'll just chuck the whole thing and start from scratch using the MS2 version.


Keith

 

 

What the hell was I thinkin'?

Share this post


Link to post
Share on other sites

After I upgraded to MS2 it was a 2 min install to get this working.


Keith

 

 

What the hell was I thinkin'?

Share this post


Link to post
Share on other sites

Uh-oh ... thought this was working fine in MS2 but just came across 2 problems...

 

 

1. I'm starting to get this error (posted on the previous page of this thread) when I'm logged in and view the contents of the cart. It's not happening everytime, but occasionally, and never when not logged in. And I've not modified general.php...

 

Warning: htmlspecialchars() expects parameter 1 to be string, array given in /home/wvdrops/public_html/includes/functions/general.php on line 45

Warning: htmlspecialchars() expects parameter 1 to be string, array given in /home/wvdrops/public_html/includes/functions/general.php on line 45

 

 

2. Something very funny happens when you log in and add a new address for yourself in address book, then continue shopping, add another item to the cart, and view the cart. Instead of seeing the 'Deliver to:' followed by the name and address of the person logged in, you get the drop-down menu (the one that 'Country' uses when not logged in) but the drop-down menu is filled with the text you typed in for the new address...

 

Weird ...

 

Anyone else have this?

 

:blink:

Share this post


Link to post
Share on other sites

(... continued...) And if you then go to address book and delete the first address (the one you originally created the account with, rather than the second address you added) you get the same error in the space where the shipincart module should display the name and address of the customer ...

 

Warning: htmlspecialchars() expects parameter 1 to be string, array given in/Library/Apache2/htdocs/Catalog/includes/functions/general.php on line 42

Warning: htmlspecialchars() expects parameter 1 to be string, array given in/Library/Apache2/htdocs/Catalog/includes/functions/general.php on line 42

 

... odd.

 

I suppose it would be possible to remove the address book entirely, but then the customer can never correct their address if they enter it wrongly when creating their account/or if they move house.

 

Must be something fairly simple... anyone else getting this? ....anyone any ideas?

 

:rolleyes:

Share this post


Link to post
Share on other sites

Ooops! .. delete those last two posts - my fault. Nothing wrong with this contribution at all. :)

 

1. The address text in the drop-down menu is supposed to be there (ie. it's a feature, not a bug) - it allows the customer to change the shipping address to see the differences in shipping costs ... nice touch. I didn't realise it was working as it should because I'd put a load of 'jhfkjhfkhfksdhfks' text in to create a dummy 2nd address in address book to test the shipping rates, also it showed up just as ...

 

2. The htmlspecialchars error appeared. This was also coincidental: I'd moved the 'postcode' down below 'state' in address_book_details.php a few weeks ago and got it in the wrong place, but the error only became obvious when I created a second address to test the shipping rates.

 

So my fault ... <...searches for embarrassed smiley icon but can't find it ..>

 

:rolleyes:

Share this post


Link to post
Share on other sites

I am trying to figure out how to remove all the shipping options, and only display the lowest priced option, which is ground shipping. (no one is ever going to select overnight to get a drill).

 

Anyone have an idea on what to comment out, so all the options don't show?

 

Thanks!

Share this post


Link to post
Share on other sites

hallo,

it is possible to change the country for the whole shop when you are not logged in and change the country in the shipping_cart estimator?

 

thx :)

Share this post


Link to post
Share on other sites

I am trying to get this installed on MS2 and I'm confused.

The original contrib is a readme.txt file with code to be added to shopping_cart.php. The latest version is a bunch of files, but in particular shipping_estimator.php. I've unpacked those files into the main catalog tree, and reading that file suggests that the code is still added to shopping_cart.php but I can't seem to make it work.

 

I've also trying including the file:

require("includes/shipping_estimator.php");

 

But I get:

Fatal error: Call to undefined function: tep_output_warning() in /home/httpd/catalog/includes/shipping_estimator.php on line 221

 

What am I doing wrong? And perhaps the answer could be added back to the contrib as a readme for future generations? :)

Edited by danix

Share this post


Link to post
Share on other sites

As usual, I'll answer my own post :)

The contrib is now a standalone module which gets installed in includes/modules and called from shopping_cart.php. I wasn't far off the mark with what I was trying to go, and the readme.txt in fact exists up to revision 1.7 but was left out in 1.7.1 and 1.7.2.

 

Now for a real question - I am still getting an undefined function:

 

Fatal error: Call to undefined function: tep_output_warning() in /home/httpd/catalog/includes/modules/shipping_estimator.php on line 221

 

Line 221 reads:

$ShipTxt.=tep_output_warning(CART_SHIPPING_OPTIONS_LOGIN);

 

CART_SHIPPING_OPTIONS_LOGIN is defined at the top of the file, but I can't find any references to tep_output_warning in any of the files.

 

Thanks for any suggestions.

Share this post


Link to post
Share on other sites

And once again, an answer via search and a post back in August. The below fixes my output error and displays some shipping info (yay) but I still have some issues.

1) The update cart button has lost its hyperlink.

2) In the entry box for post code, the text "STORE_ORIGIN_ZIP" is displayed.

 

I'm fried for tonight so if anyone has the answers to the above, let me know.

Reading back through this thread, these are all common issues, and the lack of documentation has been echoed time and again. I very strongly (but nicely) suggest that these issues be corrected and/or documented in the contrib. I'd do it but I'm not quite sure how yet. Hey, I know it's all a gift of someone's labor, but I would never personally release something without full documentation.

 

I received the same error.

 

In MS2, they have changed the way that error message are output. Instead of a function in general.php, a new class file, message_stack.php was created to handle all of the error messages.

 

To fix the error...

 

Locate the following line of code...

CODE 

 

 

  $ShipTxt.=tep_output_warning(CART_SHIPPING_OPTIONS_LOGIN);

 

 

 

and replace it with this...

CODE 

 

 

  $ShipTxt.=$messageStack->add('header', CART_SHIPPING_OPTIONS_LOGIN, 'warning');

 

 

 

 

That should remove your error.

 

Hope this helps.

 

-R

Share this post


Link to post
Share on other sites
I am trying to get this installed on MS2 and I'm confused.

 

LOL, yes you are quite confused as you are not even trying to install the right contribution for MS2. Try this one (the one that says it is for MS2): v1.81

 

http://www.oscommerce.com/community/contri...ns,1781/page,21

 

You have to add a few lines to one file and upload a file into your catalog/includes/modules directory. It really does not get much more simple than this one....

Share this post


Link to post
Share on other sites

Aha, thanks! Actually the two contribs have different names (the original MS1 is shipincart, this is Ship In Cart), which is why I didn't find the latter.

 

Looks good. I did notice that my UPS estimates are based on 2x the weight, but I'll research that one next.

 

(By the way, I lied, never got to bed...)

Share this post


Link to post
Share on other sites
Only one (very, very small) thing ... the 'Update Country' button doesn't line up with the 'Countries' drop-down box (it's slightly higher) - although the previous 'Recalculate' text lined up fine -  ... can't see how to move the button down a bit (tried 'valign="middle" but it doesn't do anything).

 

Anyone had this problem and found a way?

 

 

 

:rolleyes:

A little slow on this, but while trying to add the "state" for a version of ship_in_cart to work with FedEx's new API that requires the state field I figured I would fix the alignment problem. Just find this line in the shipping_estimator.php file:

        $ShipTxt.=' <a href="_" onclick="return shipincart_submit(\'\');">'. tep_image_button('button_update_cart.gif', IMAGE_BUTTON_UPDATE_CART) . ' </a></td></tr>';

 

Change it to this and the update button will align:

        $ShipTxt.=' <td><a href="_" onclick="return shipincart_submit(\'\');">'. tep_image_button('button_update_cart.gif', IMAGE_BUTTON_UPDATE_CART) . ' </a></td></td></tr>';

 

The version for FedEx real time quotes should be available shortly...I hope. <_<

Share this post


Link to post
Share on other sites

Thanks Justin, :rolleyes: that fixed the vertical alignment fine. What's happening now though is that the 'Update Country' button has whizzed off to the right-hand side over the totals column... :blink: ... is it possible to get that more to the left so it's nearer to the country drop-down?

 

I notice the code for that line you posted is slightly different from mine, which may have something to do with it ... (?)

 

My line looks like this (MS2):

 

       $ShipTxt.=' <td><a href="_" onclick="return shipincart_submit(\'\');">'. tep_image_button('button_update_country.gif', IMAGE_BUTTON_UPDATE_COUNTRY) . ' </a></td></td></tr>';

 

 

:rolleyes:

Share this post


Link to post
Share on other sites
I notice the code for that line you posted is slightly different from mine, which may have something to do with it ... (?)

Hmmm... Just reading your post/my post and comparing the code again, and my line of code isn't any different from your's (apart from the change of .gif name) is it?

 

I thought it was was because your line of code came through on the 'there-is a-new-post' notification email differently from what you've posted on here.

 

This is what came through in the notification email:

A little slow on this, but while trying to add the "state" for a version of ship_in_cart to work with FedEx's new API that requires the state field I figured I would fix the alignment problem.  Just find this line in the shipping_estimator.php file:


------------ CODE SAMPLE ----------

       $ShipTxt.=' <a href="_" onclick="return shipincart_submit(\'\');">'. tep_image_button('button_update_cart.gif', IMAGE_BUTTON_UPDATE_CART) . ' </a></td></tr>';
-----------------------------------



Change it to this and the update button will align:


------------ CODE SAMPLE ----------

       $ShipTxt.=' <td><a href="_" onclick="return shipincart_submit(\'\');">'. tep_image_button('button_update_cart.gif', IMAGE_BUTTON_UPDATE_CART) . ' </a></td></td></tr>';
-----------------------------------



The version for FedEx real time quotes should be available shortly...I hope.  <_<  

 

 

Hmmm ... strange ...

 

:rolleyes:

Share this post


Link to post
Share on other sites

Do you have a URL? I do not have an "Update Country Button". I now have it so that it looks like this:

 

Country Dropdown | State Dropdown | Zipcode Field | Update Button

 

If you want go to my site HERE and add an item to the cart. It now has the state dropdown for the FedEx shipping module but yours should look exactly the same just without the state dropdown. The single update button on the right updates everything at once.

Share this post


Link to post
Share on other sites

hallo!

when i change the country - this script calculates correctly prices for shipping but not for tax! all products (tax) are not updated for the new country :(((

 

its possible to change it? i dont know how :((

Share this post


Link to post
Share on other sites

Justin: Thanks for replying. Yes, I see ... that's where my 'Update' button is (now) too. Thing is I only have the Country drop-down menu on that line, so there's a big empty gap across from that menu to where the 'Update' button is now ... I could do with moving the update button over to the left so it's next to the Country drop-down....

 

Is it possible?

 

tia

 

:rolleyes:

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

×