Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Posted

I searched the forum and contributions and found no way to disable checkout for orders over a certain weight, in my case 20kg. It is unlikely that there will be any orders of that weight - the items in the shop are all pretty light, but we want to reduce the possible cancellations and refunds.

 

The RFQ contribution was the closest, but there is no way at present to have it only come up when the total weight is over a certain amount, and the customer can proceed with the order regardless.

 

I thought that this was "maximum weight" on Admin - Configuration - Shipping/Packaging, but now know that this is for calculation of weight and number of packages only. I am surprised that this doesn't come up more often.

 

Thanks in advance for any helpful insights!

Posted
I searched the forum and contributions and found no way to disable checkout for orders over a certain weight, in my case 20kg. It is unlikely that there will be any orders of that weight - the items in the shop are all pretty light, but we want to reduce the possible cancellations and refunds.

 

The RFQ contribution was the closest, but there is no way at present to have it only come up when the total weight is over a certain amount, and the customer can proceed with the order regardless.

 

I thought that this was "maximum weight" on Admin - Configuration - Shipping/Packaging, but now know that this is for calculation of weight and number of packages only. I am surprised that this doesn't come up more often.

 

Thanks in advance for any helpful insights!

 

well, normally shops ship regardless of weight other than box weight considerations.

 

but still, you can put this in checkout_shipping.php just after :

 

require('includes/application_top.php');

 

you add:

 

if ($cart->show_weight() > 2000) {

tep_redirect(tep_href_link(FILENAME_SHOPPING_CART), 'NONSSL'); // to the shopping cart

exit();

}

 

Then if the cart weight is over 2000 it will go back to the shopping cart page.

Maybe put a nice message in the message stack when doing that so people know why.

Treasurer MFC

Posted

Ann Donnelly

 

I would also include this code to let the customer know what is happening.

Add this right after the if statement it will display an error message at top

 

 

$messageStack->add('shopping_cart', TEXT_SHOPPING_CART_EXCEEDED_WEIGHT_ERROR);

 

and add this into program catalog/includes/languages/english/shopping_cart.php

 

define(TEXT_SHOPPING_CART_EXCEEDED_WEIGHT_ERROR', 'The total weight exceeds the order limit ');

 

or what ever you want to tell the customer.

TEXT_SHOPPING_CART_EXCEEDED_WEIGHT_ERROR

Posted

Thanks for two great replies!

 

The redirect back to the cart is working, but I cannot get the error message to appear.

 

I put this at the top of catalog/checkout_shipping.php:

 

if ($cart->show_weight() > 20) {

tep_redirect(tep_href_link(FILENAME_SHOPPING_CART), 'NONSSL'); // to the shopping cart

exit();

$messageStack->add('shopping_cart', TEXT_SHOPPING_CART_EXCEEDED_WEIGHT_ERROR);

}

 

Is that correct placement of the statement? I did also include the Define statement in the language file.

 

I was thinking maybe it should be at the top of shopping_cart.php, as the shopper does not see checkout_shipping.php due to the redirect. I tried adding the following at the top of catalog/shopping_cart.php. As I don't know php, I was guessing on how to put it.

 

if ($cart->show_weight() > 20) {

$messageStack->add('shopping_cart', TEXT_SHOPPING_CART_EXCEEDED_WEIGHT_ERROR);

}

 

My Shopping Cart is nearly perfect!!

Posted
Thanks for two great replies!

 

The redirect back to the cart is working, but I cannot get the error message to appear.

 

I put this at the top of catalog/checkout_shipping.php:

 

if ($cart->show_weight() > 20) {

tep_redirect(tep_href_link(FILENAME_SHOPPING_CART), 'NONSSL'); // to the shopping cart

exit();

$messageStack->add('shopping_cart', TEXT_SHOPPING_CART_EXCEEDED_WEIGHT_ERROR);

}

 

Is that correct placement of the statement? I did also include the Define statement in the language file.

 

I was thinking maybe it should be at the top of shopping_cart.php, as the shopper does not see checkout_shipping.php due to the redirect. I tried adding the following at the top of catalog/shopping_cart.php. As I don't know php, I was guessing on how to put it.

 

if ($cart->show_weight() > 20) {

$messageStack->add('shopping_cart', TEXT_SHOPPING_CART_EXCEEDED_WEIGHT_ERROR);

}

 

My Shopping Cart is nearly perfect!!

 

 

you will ten have to add code to shopping_cart.php to display that message:

 

<?php

if ($messageStack->size('shopping_cart') > 0) {

?>

<tr>

<td><?php echo $messageStack->output('shopping_cart'); ?></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<?php

}

?>

Treasurer MFC

Posted

Thanks again Amanda!

 

It now shows the error, but it says "SHOPPING_CART_EXCEEDS_MAX_WEIGHT" (which I changed that to) instead of the defined text in english/shopping_cart.php:

 

define('SHOPPING_CART_EXCEEDS_MAX_WEIGHT', 'The total weight exceeds the order limit. Please contact us to complete your order.');

 

Does this need to be defined anywhere else?

Posted

I would like to do this with my cart also. I have the redirect working, but I would like to clarify. Did you put the message stack in the checkout of the chopping cart, and where did you add the additional code and the define?

 

This is a good thread.

 

Thanks,

Kevin

Posted

I've got it sorted!! Thanks again to boxtel and dittones for providing the info!

 

Step-by-Step:

 

1)

 

put this in checkout_shipping.php

 

just after

 

require('includes/application_top.php');

 

you add:

 

if ($cart->show_weight() > 2000) {

tep_redirect(tep_href_link(FILENAME_SHOPPING_CART), 'NONSSL'); // to the shopping cart

exit();

}

 

2)

 

Add this right after the if statement (at the top of catalog/shopping_cart.php) it will display an error message at top

 

$messageStack->add('shopping_cart', TEXT_SHOPPING_CART_EXCEEDED_WEIGHT_ERROR);

 

3)

 

and add this into catalog/includes/languages/english/shopping_cart.php (and catalog/includes/languages/english.php)

 

define(TEXT_SHOPPING_CART_EXCEEDED_WEIGHT_ERROR', 'The total weight exceeds the order limit ');

 

4)

 

you will then have to add code to shopping_cart.php - where you would like it to display that message:

 

<?php

if ($messageStack->size('shopping_cart') > 0) {

?>

<tr>

<td><?php echo $messageStack->output('shopping_cart'); ?></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<?php

}

?>

 

This has worked for me - take a look at https://www.angelico.ie/catalog - checkout is not yet live.

Posted

Ann Donnelly,

 

Great colors...You might want to turn totals of on your products...this

can be done on the admin side...

Speed will come into play as you add more product and things...

Good luck,

Dittone.com

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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