Jump to content
ednique

[Contribution] Ship In Cart

Recommended Posts

Uh -oh ... I spoke too soon ... htmlspecialchars is back on my site too, same situation as other people are having ...

 

1. Create a new user, put something in cart and you get the error showing in shipincart.

 

2. BUT ... if you create a second address for that user, go back to the 'cart contents' screen, update the address drop-down in shipincart to the second address, then the error goes. From then on you can happily switch to either address in shipincart, log out/log-in with no error showing at all.

 

3. If you delete one of those two addresses (doesn't seem to matter which one) the error reappears.

 

So it seems to need (at least in my case...) to have 2 addresses for each new user in order to work ... just spent 2 days looking over all files and putting fresh individual MS2 files in to test, no progress so far. Can't see why it works fine with 2 addresses in but not one.

 

Interesting thing is ... this error only appeared for me when I installed shipincart, and I have one 'user' that I've been using for testing over several weeks (before I installed shipincart) and that 'user' still gives no errors with one address, so it looks like (in my case too) it's only new accounts that are being affected.

 

Looks like it's a case of disabling it for the time being...

 

:(

Share this post


Link to post
Share on other sites

I have shipping estimator installed. Tested and works fine for me. I currently am only using it for UPS (continental US and Canada) and am not using taxes.

 

I had the idea of showing the shipping box in the product_info.php page. I have this installed on this page already. I renamed it to shipping_estimator2.php and am calling this file from product_info.php with the idea that the code might be modified to display the shipping box for the product showing on product_info.php. ATM mechanically this works except for the code looking for something to be in the cart before displaying the quote. Might the code be modified a little to show a quote for the weight of the product on product_info.php?

 

 

I also had the idea of displaying the selected cost of shipping for the cart into the shopping cart's info box so the box will show cart contents and shipping costs as well.

 

What do you think about these ideas?

 

 

Chris

Share this post


Link to post
Share on other sites

Htmlspecialchars() error - an update...

 

 

Tim Elliott (tlelliott77) has discovered an interesting thing about this error:

 

At the moment the error only occurs when you log in as a user, log out and then log in as a different user using the same browser window. Whilst this isn't ideal I hope that it won't be something that happens very often for customers.

 

Ah-hah! - me too ... except in my case I have to quit/restart the browser rather than just use a new browser window.

 

So, been doing some tests ... tried Mozilla, Netscape 7.0, IE6.0 and Mozilla Firebird so far and this happens in all of them:

 

What seems to be happening is that the osCsid cookie is not being deleted at the end of the user's session (even though it says 'expires this session' on it), so it's being re-used for the next login/user/account creation and creates the error - presumably part of the shipincart code must be using the session ID to keep track of the customer and retrieve the customer's address array to display in the ship in cart mod ... (haven't looked at that bit yet).

 

Try this (with a freshly started-up browser program):

 

Login/create an account as user 1 - no error from shipincart - logout.

 

Delete the osCSid cookie from the browser's prefs, save prefs

 

Login/create account as user 2 using the same browser window - no error, and a new (different) oscsid cookie is created.

 

Don't know yet who/what is responsible for deleting 'this session only' cookies - OSC or the browser. Don't quite understand either how the shop can welcome you back if the cookie has been deleted/expired at end of the session ...

 

As Tim says, it's unlikely a customer would login/logout then immediately create a new user/account using the same browser/window, so it may not be a big problem in practice - it's just showing up for us because we're creating more than one user with the same browser/window/session as part of our testing. Would be nice to find the cause and fix it though...

 

 

:rolleyes:

Share this post


Link to post
Share on other sites

shipping estimator in product_info.php:

 

Around line 202, I replaced:

$ShipTxt= tep_draw_form('estimator', tep_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'), 'post'); //'onSubmit="return check_form();"'

 

With this line:

$ShipTxt= tep_draw_form('estimator', tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $products_id, 'NONSSL'), 'post'); //'onSubmit="return check_form();"'

 

Which when a non logged in user updates the cart with their zip code, does grab the shipping quote and updates the product_info.php page correctly except for 1 thing. The rate is different (lower) than when a user adds this item to his cart.

Why is this? BTW, I am referring to the UPS Methods.

Is the weight of the product listing not being grabbed here?

Share this post


Link to post
Share on other sites

Don't understand why we cannot edit our posts. Anyway, as a BTW for the above message, I also changed this:

if ($cart->count_contents() >= 0) { so the display would work on an empty cart.

Share this post


Link to post
Share on other sites

Pixxi-

Try adding this to your catalog/logoff.php file around line 25 along with all of the other "unregisters" in that section of code and see if it helps:

 

tep_session_unregister('cart_address_id');

Share this post


Link to post
Share on other sites

I see I made a big mistake. After turning off shipping tare weight and handling fee, The shipping display did not return anything. Makes sense now. It was merely returning the quote from tare and handling fee and not adding the product weight.

 

Can something be done like so?:

 

$total_weight = ($products_weight + MODULE_SHIPPING_UPS_HANDLING);

Share this post


Link to post
Share on other sites

I am a little confused: in the array European Union is a inconsistancy. In the original file the entry is:

 

// European Union Origin

'European Union Origin' => array(

'07' => MODULE_SHIPPING_UPSXML_SERVICE_CODE_EU_ORIGIN_07,

'08' => MODULE_SHIPPING_UPSXML_SERVICE_CODE_EU_ORIGIN_08,

'11' => MODULE_SHIPPING_UPSXML_SERVICE_CODE_EU_ORIGIN_11,

'54' => MODULE_SHIPPING_UPSXML_SERVICE_CODE_EU_ORIGIN_54,

'64' => MODULE_SHIPPING_UPSXML_SERVICE_CODE_EU_ORIGIN_65,

'65' => MODULE_SHIPPING_UPSXML_SERVICE_CODE_EU_ORIGIN_69

),

 

but should it not be:

 

// European Union Origin

'European Union Origin' => array(

'07' => MODULE_SHIPPING_UPSXML_SERVICE_CODE_EU_ORIGIN_07,

'08' => MODULE_SHIPPING_UPSXML_SERVICE_CODE_EU_ORIGIN_08,

'11' => MODULE_SHIPPING_UPSXML_SERVICE_CODE_EU_ORIGIN_11,

'54' => MODULE_SHIPPING_UPSXML_SERVICE_CODE_EU_ORIGIN_54,

'64' => MODULE_SHIPPING_UPSXML_SERVICE_CODE_EU_ORIGIN_64,

'65' => MODULE_SHIPPING_UPSXML_SERVICE_CODE_EU_ORIGIN_65

),

 

Does anyone know what is correct??

 

rgds

Werner

Share this post


Link to post
Share on other sites

Oops, I believe I posted to the wrong contribution, sorry. Please disregard the last posting.

Share this post


Link to post
Share on other sites
Pixxi-

Try adding this to your catalog/logoff.php file around line 25 along with all of the other "unregisters" in that section of code and see if it helps:

 

tep_session_unregister('cart_address_id');

Thanks a million Justin, your code sorted the problem instantly! :D

 

Sometimes the smallest things can take an age when you don't know what the problem is ...

 

Interestingly, the cookie is still there after logout and seems to get reused by the next user/login, so I can't see how OSC keeps track of a customer unless it's based on IP, but ship in cart seems to work fine now.

 

Thanks again

 

 

:rolleyes:

Share this post


Link to post
Share on other sites
QUOTE (JB @ Mar 17 2004, 12:01 AM)
Pixxi-

Try adding this to your catalog/logoff.php file around line 25 along with all of the other "unregisters" in that section of code and see if it helps:

 

tep_session_unregister('cart_address_id'); 

 

Thanks a million Justin, your code sorted the problem instantly!

 

Sometimes the smallest things can take an age when you don't know what the problem is ...

 

Interestingly, the cookie is still there after logout and seems to get reused by the next user/login, so I can't see how OSC keeps track of a customer unless it's based on IP, but ship in cart seems to work fine now.

 

Thanks again

 

I'd like to add my thanks to Justin for sorting out this problem. It's the sort of thing you just can't seem to track down unless you really know what's going on.

 

Tim

Share this post


Link to post
Share on other sites

Lol, don't thank me as you guys were the ones that figured it out by finding and describing just how to create the error- from there it was easy to track down. I always tested it by acting like a new customer or a returning customer, but had never thought to try multiple accounts one after the other without closing the browser. Feel free to add the fix in the contribs section if you would like.

Share this post


Link to post
Share on other sites
Lol, don't thank me as you guys were the ones that figured it out by finding and describing just how to create the error- from there it was easy to track down. I always tested it by acting like a new customer or a returning customer, but had never thought to try multiple accounts one after the other without closing the browser. Feel free to add the fix in the contribs section if you would like.

:rolleyes:

 

Thanks for your kind words Justin, but we only identified the problem ... I think I might speak for Tim also when I say we wouldn't have had any idea how to fix it - so all the credit is yours. Excellent solution. :)

 

I think that you should (if you want to) post the update to the mod too - for the above reason, and also because you will be able to describe the problem and the solution much better than we could.

 

Thanks again - you saw what we didn't know what we were looking for ...

 

 

:rolleyes:

Share this post


Link to post
Share on other sites

Having problems using Ship in Cart with the CanadaPost shipping module.

 

I don't get any shipping charge displayed when not logged in. Works perfectly once logged in.

 

Any suggestions on where I should be looking for a fix??

Share this post


Link to post
Share on other sites

hello on our store, norpacfish.com i have the ship in cart..what i am wondering is how i can make the country, state, and postal code have thier own line. that way the info box wont be as wide. how would i do that?

 

thanks,

 

~William

Share this post


Link to post
Share on other sites

I'm finding that when I change currency on the shipping estimator (cart contents) page it goes into Advanced Search mode. This rings a bell but I can't think what might be causing it (on MS2). I do have the ordinary search box in the header if that makes a difference.

 

Any ideas?

Share this post


Link to post
Share on other sites

Anyone know a solution on what to do when item's are downloaded instead of shipped to hide shipping estimator?

 

For instance if people purchase only a gift voucher they would see the shipping_estimator.

Share this post


Link to post
Share on other sites

Anyone know how to get rid of all the other "shipping rates" such as overnight, 3 day, etc that show up in the estimator?

 

I only want the cheapest rate displayed, so I don't scare off customers.

 

Thanks in Advance!

Share this post


Link to post
Share on other sites

What is the latest version of this mod and where is it?

 

I have just installed it on my test site and theres so many bugs.


Dan

Share this post


Link to post
Share on other sites

When I change the post code and click RECALCULATE I get document.estimator is null or not an object.

 

The javascipt is right though I checked it out and I even made a small HTML page with the example used in the code:

 

<HTML>

<HEAD>

</HEAD>

<BODY>

 

 

<form name="estimator" action="http://192.168.0.3/shopping_cart.php" method="post">

    <form name="estimator" action="http://192.168.0.3/shopping_cart.php" method="post"><input type="hidden" name="sid" value="auspost_auspost"><table>Please <a href="http://192.168.0.3/login.php"><u>Log In</u></a>, to display your personal shipping costs.<tr><td colspan="3" class="main"> Item: 1 - Weight: 1lbs</td></tr><tr><td colspan="3" class="main" nowrap>Country: <select name="country_id" style="width=200;"><option value="">Please Select</option><option value="13" SELECTED>Australia</option></select> Post Code: <input type="text" name="zip_code" class="textbox" value="6000" size="10"> <a href="java script:shipincart_submit('');">Recalculate</a></td></tr><tr><td></td><td class="main" align="left"><b>Shipping Methods:</b></td><td class="main" align="center"><b>Rates:</b></td></tr><tr><td colspan="3" class="main"><img src="images/pixel_black.gif" border="0" alt="" width="100%" height="1"></td></tr><tr class=""><td class="main"> </td><td class="main"><b>AusPOST Parcel Post (Delivery to 6000  (includes $4.2 insurance and $2.35 registered post) )</b></td><td align="right" class="main"><b>$12.05<b></td><td class="main">[<a href="_"  onclick="return shipincart_submit('auspost_auspost');">select</a>]</td></tr></table></form>

 

 

<a href="java script:shipincart_submit('');">meh</a>

<script language="JavaScript">

  function shipincart_submit(sid){

    if(sid){

      document.estimator.sid.value=sid;

    }

    document.estimator.submit();

    return false;

  }

</script>

</BODY>

</HTML>

 

Works a charm... any ideas??


Dan

Share this post


Link to post
Share on other sites

Hey this looks like a REALLY nice mod to OSC. Could you upload this contribution so the reset of us can use it? :)

 

Thanks

Charles


Best of luck!

Charles

 

Installed Contributions:

MS2

USPS

UPS

PayPal IPN

2CheckOut

Some other too that I am trying to figure out!

-To all OSC programmers: Thank you for all your hard work put into this application!

Share this post


Link to post
Share on other sites

.Hey this looks like a REALLY nice mod to OSC. Could you upload this contribution so the reset of us can use it?

 

Thanks

Charles


Best of luck!

Charles

 

Installed Contributions:

MS2

USPS

UPS

PayPal IPN

2CheckOut

Some other too that I am trying to figure out!

-To all OSC programmers: Thank you for all your hard work put into this application!

Share this post


Link to post
Share on other sites

Quick thought: To make this module even more productive it would be nice to have it added to the product_info page. But to keep that page clean have a link that says something like

 

Click Here for shipping estimates

 

And when the link is clicked it opens up a popup of the ship in cart, and users can type in their zip code as usual and update to see how much that particular item would cost to ship.

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

×