Jump to content
Sign in to follow this  
wheeloftime

Estimated Shipping Costs

Recommended Posts

Estimated Shipping Costs

 

This contribution will add an infobox to your osCommerce shop which shows the estimated shipping costs to the customer. It will show as soon as the customer adds a

product to his shopping cart and (re)calculate the estimated shipping costs. As it is based on the checkout shipping page the calculated shipping costs will be accurate and not really an estimate. At this stage only country based shipping costs information can be shown ! Alternatively you can show the estimated shipping cost module in your mainpage instead as a left, or right, column infobox. The module will disable itself once the customer reaches the checkout shipping page.

 

Contribution Link

Share this post


Link to post
Share on other sites

To the author:

 

Thanks for the contribution.

 

Is the estimated shipping cost computed on weight? It is possible to compute the shipping cost on a slding scale or would that require a lot of new code? For Example Shipping $2.00 up to $50.00 of sales then $4.00 up to $100.00 etc.

 

Thanks again.

Share this post


Link to post
Share on other sites
To the author:

 

Thanks for the contribution.

 

Is the estimated shipping cost computed on weight?  It is possible to compute the shipping cost on a slding scale or would that require a lot of new code?  For Example Shipping $2.00 up to $50.00 of sales then $4.00 up to $100.00 etc.

 

Thanks again.

 

I think you misunderstood the purpose of this contribution. It is not a shipping module by itself but more like a realtime shipping cost calculator based on country input and working outside the scope of the checkout pages so a customer can already get an insight about what shipping costs to expect when adding products to his cart. Your example should be easily setup with ie. the table or zones shipping module and this contrib will then show your shipping cost upfront to the customer while he is still shopping.

 

Regards,

Howard

Share this post


Link to post
Share on other sites

Hello wheeloftime

 

Thank you for a great contribution. It is just what I am looking for. This way customer can get an estimate of the shipping cost even before they register for an account at my shop.

 

I do have a bug to report though. I am offering free shipping for orders above certain amount. Therefore, when a customer qualifies for the free shipping they will get an error. It looks like this on the frontend.

 

Warning: tep_get_estimated_shipping_quotes(includes/languages//modules/order_total/ot_shipping.php): failed to open stream: No such file or directory in /home/username/public_html/sandbox/includes/functions/estimated_shipping_functions.php on line 61

Warning: tep_get_estimated_shipping_quotes(includes/languages//modules/order_total/ot_shipping.php): failed to open stream: No such file or directory in /home/username/public_html/sandbox/includes/functions/estimated_shipping_functions.php on line 61

Warning: tep_get_estimated_shipping_quotes(): Failed opening 'includes/languages//modules/order_total/ot_shipping.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/username/public_html/sandbox/includes/functions/estimated_shipping_functions.php on line 61

BTW, the abovementioned codes are from my test shop. The free shipping is defined in the osCommerce Administration under Modules -> Order Total -> Shipping.

 

Do you have any suggestions as to how this can be fixed? All help is greatly appreciated.

 

Thanks

Share this post


Link to post
Share on other sites
Hello wheeloftime

 

Thank you for a great contribution. It is just what I am looking for. This way customer can get an estimate of the shipping cost even before they register for an account at my shop.

 

I do have a bug to report though. I am offering free shipping for orders above certain amount. Therefore, when a customer qualifies for the free shipping they will get an error. It looks like this on the frontend.

 

Warning: tep_get_estimated_shipping_quotes(includes/languages//modules/order_total/ot_shipping.php): failed to open stream: No such file or directory in /home/username/public_html/sandbox/includes/functions/estimated_shipping_functions.php on line 61

Warning: tep_get_estimated_shipping_quotes(includes/languages//modules/order_total/ot_shipping.php): failed to open stream: No such file or directory in /home/username/public_html/sandbox/includes/functions/estimated_shipping_functions.php on line 61

Warning: tep_get_estimated_shipping_quotes(): Failed opening 'includes/languages//modules/order_total/ot_shipping.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/username/public_html/sandbox/includes/functions/estimated_shipping_functions.php on line 61

BTW, the abovementioned codes are from my test shop. The free shipping is defined in the osCommerce Administration under Modules -> Order Total -> Shipping.

 

Do you have any suggestions as to how this can be fixed? All help is greatly appreciated.

 

Thanks

 

Hello rezdwan,

 

Good to hear this contribution is also useful for you !

What I can say right now is that somehow your language variable is not picked up correctly and therefore this:

includes/languages//modules/order_total/ot_shipping.php

is broken. Between the '//' should have been 'english', 'dutch' or whatever languages you use.

 

What you can try is the following:

edit the file includes/functions/estimated_shipping_functions.php by adding the variable $language to the globals of the function tep_get_estimated_shipping_quotes.

So this:

function tep_get_estimated_shipping_quotes($country, $getvar, $customer_country) {
global $HTTP_POST_VARS, $country, $cart, $currencies, $country_to_ship_to, $country_name, $order, $total_weight, $total_count;

should become:

function tep_get_estimated_shipping_quotes($country, $getvar, $customer_country) {
global $HTTP_POST_VARS, $language, $country, $cart, $currencies, $country_to_ship_to, $country_name, $order, $total_weight, $total_count;

 

I have never been able to test the free shipping part of the code because I use a seperate free shipping module but I am pretty sure this will do the trick. If you would be so kind to try this for me and tell if that worked I will update this in the next release.

 

Regards,

Howard

Share this post


Link to post
Share on other sites
Hello rezdwan,

 

Good to hear this contribution is also useful for you !

What I can say right now is that somehow your language variable is not picked up correctly and therefore this:

includes/languages//modules/order_total/ot_shipping.php

is broken. Between the '//' should have been 'english', 'dutch' or whatever languages you use.

 

What you can try is the following:

edit the file includes/functions/estimated_shipping_functions.php by adding the variable $language to the globals of the function tep_get_estimated_shipping_quotes.

So this:

function tep_get_estimated_shipping_quotes($country, $getvar, $customer_country) {
global $HTTP_POST_VARS, $country, $cart, $currencies, $country_to_ship_to, $country_name, $order, $total_weight, $total_count;

should become:

function tep_get_estimated_shipping_quotes($country, $getvar, $customer_country) {
global $HTTP_POST_VARS, $language, $country, $cart, $currencies, $country_to_ship_to, $country_name, $order, $total_weight, $total_count;

 

I have never been able to test the free shipping part of the code because I use a seperate free shipping module but I am pretty sure this will do the trick. If you would be so kind to try this for me and tell if that worked I will update this in the next release.

 

Regards,

Howard

Hello wheeloftime

 

I have followed your instructions and it works great! It shows the estimated shipping cost and also the free shipping cost for orders above the certain amount.

 

Thank you for the help and also for the very prompt reply!

 

Thanks

Share this post


Link to post
Share on other sites
Hello wheeloftime

 

I have followed your instructions and it works great! It shows the estimated shipping cost and also the free shipping cost for orders above the certain amount.

 

Thank you for the help and also for the very prompt reply!

 

Thanks

 

No problem, thanks for trying it out and and I will make an update for this asap !

Share this post


Link to post
Share on other sites
No problem, thanks for trying it out and and I will make an update for this asap !

Hello wheeloftime

 

I have successfully used this contribution. I have added the information on the right column under the shopping cart box. It works fine but the text of the various shipping charges are too long and looks unsightly on my site.

 

I was thinking of adding this estimated shipping cost information in the shopping cart page (ie in the file shopping_cart.php) just under the sub-total. I have followed step 6 and option b of your instruction except that the codes are in shopping_cart.php instead of index.php. It works fine and customer will see the estimated shipping cost of the default destination. But when I try to select another country, nothing happens and it will still display the default shipping destination.

 

Did I left something out or would certain modification need to be made to the codes so that it works in shopping_cart.php? Or is this the limitation of this contribution? All help is greatly appreciated.

 

Thanks

Share this post


Link to post
Share on other sites
Hello wheeloftime

 

I have successfully used this contribution. I have added the information on the right column under the shopping cart box. It works fine but the text of the various shipping charges are too long and looks unsightly on my site.

 

I was thinking of adding this estimated shipping cost information in the shopping cart page (ie in the file shopping_cart.php) just under the sub-total. I have followed step 6 and option b of your instruction except that the codes are in shopping_cart.php instead of index.php. It works fine and customer will see the estimated shipping cost of the default destination. But when I try to select another country, nothing happens and it will still display the default shipping destination.

 

Did I left something out or would certain modification need to be made to the codes so that it works in shopping_cart.php? Or is this the limitation of this contribution? All help is greatly appreciated.

 

Thanks

 

No, you did it correctly and it was something I tried also when developing this. The problem is that the shopping cart page already uses a form and as the estimated shipping module also does you get a form inside a form with the result the last one, estimated shipping, will not work. I probably should have mentioned this in the readme so it would be clear that on the index page it works allright but not on the shopping cart page where I would have liked to put it myself also.

Hope this clarifies it, I have not been able to find a solution for this.

 

Howard

Share this post


Link to post
Share on other sites
No, you did it correctly and it was something I tried also when developing this. The problem is that the shopping cart page already uses a form and as the estimated shipping module also does you get a form inside a form with the result the last one, estimated shipping, will not work. I probably should have mentioned this in the readme so it would be clear that on the index page it works allright but not on the shopping cart page where I would have liked to put it myself also.

Hope this clarifies it, I have not been able to find a solution for this.

 

Howard

Hello Howard

 

Thank you for clearing things up. Let's hope we'll be able to find a solution for this as I felt that the contribution is very useful.

 

Anyone out there who's able to help, please do not hesitate.

 

Thanks

Share this post


Link to post
Share on other sites
No, you did it correctly and it was something I tried also when developing this. The problem is that the shopping cart page already uses a form and as the estimated shipping module also does you get a form inside a form with the result the last one, estimated shipping, will not work. I probably should have mentioned this in the readme so it would be clear that on the index page it works allright but not on the shopping cart page where I would have liked to put it myself also.

Hope this clarifies it, I have not been able to find a solution for this.

 

Howard

 

any way for it to work with regions based shipping? in particualr the contribution 'MultiGeoZone MultiTable Shipping - version 1.100' ?

 

thanks

Share this post


Link to post
Share on other sites
any way for it to work with regions based shipping? in particualr the contribution 'MultiGeoZone MultiTable Shipping - version 1.100' ?

 

thanks

 

I don't know that contribution but what I read of it now it might just work fine with Estimated Shipping. You'll have to try to see if it gets picked up correctly.

Share this post


Link to post
Share on other sites
im not a really good php coder. Can u point me in the right direction?

 

You have to install the Estimated Shipping contrib and just try it out. If the shipping contrib you mentioned shows correct during checkout you should see the same output through Estimated Shipping on beforehand. If it doesn't it means there is not enough information available to be able to use Estimated Shipping for that shipping module. As the shipping module you mentioned is based on country information it might work.

Share this post


Link to post
Share on other sites

im getting this error "Fatal error: Cannot redeclare class shipping in /**********l/catalog/includes/classes/shipping.php on line 13

 

and here is line 13

class shipping {

var $modules;

Share this post


Link to post
Share on other sites
im getting this error "Fatal error: Cannot redeclare class shipping in /**********l/catalog/includes/classes/shipping.php on line 13

 

and here is line 13

class shipping {

    var $modules;

 

How did you install Estimated Shipping ? Only install it as a left or right column infobox or inside your main page. Do not put it on other pages or you might get conflicts.

Share this post


Link to post
Share on other sites
also can i make it match my other boxes with a shadow? im using drop shadows 1.0 contribution

 

I have implemented it as a seperate infobox class so you should be able to do whatever change you like to the Estimated Shipping Infobox seperate from the others.

As for your previous question: yes, that should be possible.

If you look at the catalog/includes/modules/estimated_shipping.php you see the following condition:

	if ($cart->count_contents() > 0 && (substr(basename($PHP_SELF), 0, 8) != 'checkout')) {

You can add another conditional there to check if you are on the shopping_cart.php page to not show it there also.

	if ($cart->count_contents() > 0 && (substr(basename($PHP_SELF), 0, 8) != 'checkout') || substr(basename($PHP_SELF), 0, 8) != 'shopping')) {

Haven't checked this so you could get an error on too many or less opening/closing quotes.

Share this post


Link to post
Share on other sites
No, you did it correctly and it was something I tried also when developing this. The problem is that the shopping cart page already uses a form and as the estimated shipping module also does you get a form inside a form with the result the last one, estimated shipping, will not work. I probably should have mentioned this in the readme so it would be clear that on the index page it works allright but not on the shopping cart page where I would have liked to put it myself also.

Hope this clarifies it, I have not been able to find a solution for this.

 

Howard

Hello Howard

 

I managed to get your contribution working in catalog/shopping_cart.php like I wanted. I thought you might like to know.

 

Here's how I did it. All the install instructions are the same as you have provided. For those who wishes to add the code to shopping_cart.php, they will have to do the following.

 

Open and find the following line in shopping_cart.php (line 229).

    </table></form></td>

Replace with the following.

</form>
 <tr>
   <td><br><?php include(DIR_WS_MODULES . FILENAME_ESTIMATED_SHIPPING); ?></td>
 </tr></table></td>

Basically all are the same except that I have moved the </form> tag to be before the </table> tag. I hope changing this does not affect the overall functionality of osCommerce. Howard, if it is not too much to ask, please check the abovementioned and give me your advise.

 

Thanks

Share this post


Link to post
Share on other sites
Hello Howard

 

I managed to get your contribution working in catalog/shopping_cart.php like I wanted. I thought you might like to know.

 

Here's how I did it. All the install instructions are the same as you have provided. For those who wishes to add the code to shopping_cart.php, they will have to do the following.

 

Open and find the following line in shopping_cart.php (line 229).

 ? ?</table></form></td>

Replace with the following.

</form>
?<tr>
? ?<td><br><?php include(DIR_WS_MODULES . FILENAME_ESTIMATED_SHIPPING); ?></td>
?</tr></table></td>

Basically all are the same except that I have moved the </form> tag to be before the </table> tag. I hope changing this does not affect the overall functionality of osCommerce. Howard, if it is not too much to ask, please check the abovementioned and give me your advise.

 

Thanks

 

Rezdwan,

 

Yep, that would work but you will have to disable the Estimated Shipping infobox to prevent a redeclare error or make an extra conditional within the catalog/includes/modules/estimated_shipping.php for the shopping_cart.php page.

Good work :thumbsup:

 

Grtz.

Howard

Share this post


Link to post
Share on other sites
Rezdwan,

 

Yep, that would work but you will have to disable the Estimated Shipping infobox to prevent a redeclare error or make an extra conditional within the catalog/includes/modules/estimated_shipping.php for the shopping_cart.php page.

Good work  :thumbsup:

 

Grtz.

Howard

Hello Howard

 

Thank you for reviewing the changes that I have made.

 

I am not too sure what you meant by disabling the Estimated Shipping infobox or make an extra conditional within the catalog/includes/modules/estimated_shipping.php. Could you please elaborate?

 

Thanks

Share this post


Link to post
Share on other sites
Hello Howard

 

Thank you for reviewing the changes that I have made.

 

I am not too sure what you meant by disabling the Estimated Shipping infobox or make an extra conditional within the catalog/includes/modules/estimated_shipping.php. Could you please elaborate?

 

Thanks

 

If you have the Estimated Shipping infobox activated in your left or right column and put it on the shopping cart page also you will get an error on the shopping cart page. One way to prevent this is to not use the left/right column infobox variant or add another conditional statement to the catalog/includes/modules/estimated_shipping.php like

substr(basename($PHP_SELF), 0, 8) != 'shopping'

That way the infobox will not show when you are on the shopping cart page hence you prevent the error to be born.

When you use the infobox variant it is a bit 'double' to use the module also on the shopping cart page as the information is already there in the right or left column.

Personally I would say it is one way or another, not on both the shopping cart page and as an left/right column infobox.

Share this post


Link to post
Share on other sites
If you have the Estimated Shipping infobox activated in your left or right column and put it on the shopping cart page also you will get an error on the shopping cart page. One way to prevent this is to not use the left/right column infobox variant or add another conditional statement to the catalog/includes/modules/estimated_shipping.php like

substr(basename($PHP_SELF), 0, 8) != 'shopping'

That way the infobox will not show when you are on the shopping cart page hence you prevent the error to be born.

When you use the infobox variant it is a bit 'double' to use the module also on the shopping cart page as the information is already there in the right or left column.

Personally I would say it is one way or another, not on both the shopping cart page and as an left/right column infobox.

Hello Howard

 

I got what you mean now. I did not add the contribution to the left or right column. It only appears on the shopping_cart.php page. It is working fine.

 

Now my customers can see the shipping cost even before they sign up for an account. Hopefully this translate to more completed orders and less dummy customers (users that just sign up so they can see the shipping cost). Thank you for all the help.

 

Thanks

Share this post


Link to post
Share on other sites
Hello Howard

 

I got what you mean now. I did not add the contribution to the left or right column. It only appears on the shopping_cart.php page. It is working fine.

 

Now my customers can see the shipping cost even before they sign up for an account. Hopefully this translate to more completed orders and less dummy customers (users that just sign up so they can see the shipping cost). Thank you for all the help.

 

Thanks

 

Exactly my idea and why I made this contrib ! I hope it will help you as it does me !

 

Grtz.

Howard

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
Sign in to follow this  

×