Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Ship In Cart


Guest

Recommended Posts

Maybe It won't be a bad idea to add country and zip code...

 

[country dropdown] [zip code input] [recalculate button]

 

My website stats tell me how many visitors i've had from the us...

How can I grab that info ? from the http header?

 

If you look in aplication_top.php you will see how the browser gives the default language. This is an indication of where the visitor is from, but a poor one. But it is an easy start. You can do it with GeoIP stuff or mapping IP's, DNS lookups etc etc but I would not go that route.

People will gladly give their country and zip to see the shipping costs.

 

second:

how do i register session vars?

tep_session_register()?

 

Not all shipping methods require the zip code, things like per item / table rate do not. But you could make the zip box appear depending on the selected shipping mods that might need it.

 

The idea is you create a form, look at how create_account pulls the countries.

You then use indeed tep_session_register() to register the outcome of the form in the clients session.

Any session varialble is available like $whatever_registered_name.

So you'd do a check for it before registering it again.

 

ie

 if ($shipquote) {

      // calculate shipping costs based on $shipquote

}else{

     // show dropdown boxes form that registers the session

}

 

Mattice

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Link to comment
Share on other sites

Burt,

I guess it's how you look at it, then.

 

Obviously, you looked at it and saw functionality that was not there previously, and were happy to see it.

 

I, on the other hand, while not trying to be ungreatfull, saw this mod, and said, "Wow, that is so close to what we really need!"

 

Of course I'm happy to see this additional functionality, and sure it is better than nothing, but that doesn't make it perfect. And I'm sure that the author doesn't think that this was a finished product either.

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

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

Thanks mattice for the session variables info ...

one more question on that subject:

Do i set the value first and than register or the other way around?

$myvar="US"

tep_session_register($myvar)

or

tep_session_register($myvar)

$myvar="US"

 

Not all shipping methods require the zip code, things like per item / table rate do not. But you could make the zip box appear depending on the selected shipping mods that might need it.

That's not a good idea, as I would have to update this contribution whenever their's a new shipping method...

Link to comment
Share on other sites

Also, directed towards Edwin,

 

I hope that my comments were not taken in a way the made me seem overly critical. I assure you that this was not my intention, and I sincerly apologize if this is the case.

 

I think that your contribution is wonderful, and my criticism was meant to be constructive. Please let me know if you are not interested in furthering this contribution to include country and zip code, and I will work on it myself.

 

I appreciate your work, and your contribution.

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

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

$myvar="US"

tep_session_register($myvar)

the first one, look how it is done in application_top.php

That's not a good idea, as I would have to update this contribution whenever their's a new shipping method...

 

True, but you could make it optional in your mod. SHOW_ZIP = 1, let the shop keeper decide.

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Link to comment
Share on other sites

I think that your contribution is wonderful, and my criticism was meant to be constructive. Please let me know if you are not interested in furthering this contribution to include country and zip code, and I will work on it myself.

 

Why not work together?

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Link to comment
Share on other sites

Chris,

 

I thank you for your comments...

 

As for me, I always tought that the people visiting my store would be from within the same country...

And as in Belgium all shipping costs are the same troughout the country, I just took my companies country....

 

I just put myself in place of a us "customer to be" visiting my shop and seeing the cheap shipping costs...

 

He would tell all his friends about it, and they will all be very happy...

Untill they actually register....

Suddenly a wave of frustrated emails would come my way...

 

My goal was to show the shipping cost within the basket, so that the client already sees the shipping cost before registering.

 

I succeeded in doing that, except 1 flaw...

I now need to show my customer the correct shipping price.

Link to comment
Share on other sites

Being predominatly a database programmer, and very new to programming on the web, I hope you excuse my ignorant question, but what is "registering" a variable, a why do we do it?

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

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

We do it because it beats drinking beer and talking to women I guess... :shock:

 

No seriously, sessions can hold data; the session nr. on the URL (or in the cookie) corresponds with a file (or db record) that holds stuff. Variables, arrays, whatever. Ussually variables. These are available at ALL time, making them convenient to program with. You 'register' a variable to the specific session (=client) that calls the script. Registering could be seen as 'writing to the specific session file for this client, making the var immediately available as $whatever on every page to come for this specific client"

 

www.php.net/sessions :D

 

Mattice

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Link to comment
Share on other sites

So when you register a variable, does it always show up in the URL for that session?

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

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

Nope, not at all.

It is available in the global scope.

Best thing to do is to read the link really. ;)

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Link to comment
Share on other sites

Yeah, I did, I just found myself needing clarification.

 

Thnaks.

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

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

add someting to your basket and see all shipping info...

 

I don't see ANY shipping info in my basket?

 

Yeah, I did, I just found myself needing clarification.

Okay ;) So it is the session identifier (sID) that gets appended to the url.

say the sID is 123 you would have a file called /tmp/123 or a db record in table sessions called 123 that holds the variables we 'register' to it. These variables are in 'global scope' which means they are there ALL the time to use. They are 'invisible', like the remote address is constantly there but not 'visible' in the url.

 

Hope that clears things up

Mattice

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Link to comment
Share on other sites

Oh, I SEE! :idea:

 

Sometimes, my grasp of web programming concepts are swiched on like a light switch.

 

add someting to your basket and see all shipping info...

 

I see shipping info, but nothing different from the original contribution.

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

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

So how come mattice didn't see anything?

did you add something to the basket? something that isn't a downloadable product?

I see shipping info, but nothing different from the original contribution.
Yeah i know, but i was happy to see someone's using it! :lol:

It's even a Live store...

 

Anyway, this weekend I will update the Ship in Cart contribution

 

And I even think it would be a great way of checking if your shipping modules are working correctly...

Just keep changing country and zip and check if prices are correct!

Link to comment
Share on other sites

Yup! I plan on installing this contrib as is at my earliest convenience, and then upgrading when you have finished the country and zip code functionality.

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

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

actually, the problem is that i cannot find the code you list in your file to replace in my shopping_cart.php file

 

you say replace [snip]

 

Replace the old display code:

<!-- shipping cost -->

<tr>

<td class="main">

<?php

if(sizeof($quotes)){

etc,etc, etc

 

and this code does not exist in my file

 

$Id: shopping_cart.php,v 1.71 2003/02/14 05:51:28 hpdl Exp $

Link to comment
Share on other sites

it must be - i have so many partial contributions i am trying to finish writing i am just starting to go blind looking at code and read me files..... :lol:

 

8)

Link to comment
Share on other sites

add someting to your basket and see all shipping info...

 

I don't see ANY shipping info in my basket?

 

I also went to that site and don't see any shipping info in the cart

The only thing necessary for evil to flourish is for good men to do nothing

- Edmund Burke

Link to comment
Share on other sites

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...