Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Zero weight skips shipping page


Guest

Recommended Posts

Charles: glad you got it all working, always nice to hear :)

 

Stew: thanks again for the help you've provided on this contribution and the people using it.

Link to comment
Share on other sites

...

And thanks to Lane, somewhere out there...

Prime Mover status...well deserved!

In my almost headlong blind rush to find answers, I omitted seeing, much less recognizing(!) the primo genitor aspect of the work...

opps....my apologies, please...

Thanks again to Lane and Stew for helping me fix a significant operational problem!

Best Regards and Many Thanks to all... (It really _does_ work, and nicely, too!)

Charles

B)

Link to comment
Share on other sites

Charles: glad you got it all working, always nice to hear :)

 

Stew: thanks again for the help you've provided on this contribution and the people using it.

 

Charles: ditto.

 

Thanks for the code Lane!

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

  • 5 weeks later...
  • 2 months later...
I run a highly modified cart and have both shipping and download products. I am not using attributes or the download mod (products require registration, no need to protect the download files).

 

Anyway, after searching the boards here without finding an answer and then a bit of head scratching I realized a simple mod could make orders that have a zero weight (ie, all products were download only) skip the shipping page. Since I had not found this answer in my search I thought I'd post my solution for others.

 

In 'checkout_shipping.php' find the lines here:

 

// if the order contains only virtual products, forward the customer to the billing page as
// a shipping address is not needed
 if (($order->content_type == 'virtual') || ($order->content_type == 'virtual_weight')) {
if (!tep_session_is_registered('shipping')) tep_session_register('shipping');
$shipping = false;
$sendto = false;
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
 }

 $total_weight = $cart->show_weight();
 $total_count = $cart->count_contents();

and replace them with this:

 

// IFD MOD_SQUAD BEGIN: zero weight should skip shipping page

 $total_weight = $cart->show_weight();
 $total_count = $cart->count_contents();

// if the order contains only virtual products, forward the customer to the billing page as
// a shipping address is not needed
 if (($order->content_type == 'virtual') ||
  ($order->content_type == 'virtual_weight') ||
  ($total_weight == 0 ) {
if (!tep_session_is_registered('shipping')) tep_session_register('shipping');
$shipping = false;
$sendto = false;
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
 }
// IFD MOD_SQUAD BEGIN

Where did you come up with a value of 'virtual_weight' being set? This value would have to come from the function get_content_type(). However, I cannot find it being set anywhere. The only values I can find being set are 'mixed', 'physical' and 'virtual'. Do you have another contribution installed that is setting this value?

Link to comment
Share on other sites

Zero weight skips payment?

 

I'd like to modify this bit of nifty code to skip both the shipping and the payment pages and go direct to checkout_confirmation.php. The reason for this is to sell to wholesale customers whose shipping is included with the purchase price and whose payment terms are set and will be handled offline. I've already set up Separate Pricing Per Customer, Hide Products from Customer Groups with SPPC, and an Add Multiple Items to Cart mod that together has me almost where I want to be. With this mod it's down to just a few steps for a wholesale customer to checkout- hopefully I can eliminate checkout_payment.php next.

 

My first thought on this would be to just change the instance of FILENAME_CHECKOUT_PAYMENT in the code for this mod to FILENAME_CHECKOUT_CONFIRMATION.

 

After testing this I found it caused the checkout process to get stuck in a loop so I commented out the following code in checkout_confirmation.php:

 

if ( ( is_array($payment_modules->modules) && (sizeof($payment_modules->modules) > 1) && !is_object($$payment) ) || (is_object($$payment) && ($$payment->enabled == false)) ) {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_NO_PAYMENT_MODULE_SELECTED), 'SSL'));
 }

 

Unfortunately now I'm seeing

Warning: htmlspecialchars() expects parameter 1 to be string, array given in /home/content/t/e/s/testsite62/html/includes/functions/general.php on line 43

Warning: htmlspecialchars() expects parameter 1 to be string, array given in /home/content/t/e/s/testsite62/html/includes/functions/general.php on line 43

on checkout_confirmation.php.

 

I can feel myself slowly sinking ever deeper into the code....

 

If anyone has any ideas on this one, I'll buy you a virtual beer. :D

Did you ever get a solution to this issue with htmlspecialchars()? I have tried loading the payment modules before redirection, but it does not prevent the error message. Please advise. Thanks.

Link to comment
Share on other sites

Where did you come up with a value of 'virtual_weight' being set? This value would have to come from the function get_content_type(). However, I cannot find it being set anywhere. The only values I can find being set are 'mixed', 'physical' and 'virtual'. Do you have another contribution installed that is setting this value?

vitual_weight was part of original osC code (or perhaps a mod, I forget now). I also never figured out how to make it work, so I added the total_weight check. That's really what does the magic in this mod :) As for vitual_weight, who knows?

Link to comment
Share on other sites

Did you ever get a solution to this issue with htmlspecialchars()? I have tried loading the payment modules before redirection, but it does not prevent the error message. Please advise. Thanks.

You can't skip from the location of this mod to checkout_confirmation because DB records required for that page have not been created. (At least this is true on my store).

Link to comment
Share on other sites

You can't skip from the location of this mod to checkout_confirmation because DB records required for that page have not been created. (At least this is true on my store).

Actually, you can. See below. Taking some of Stew's suggestions and some from MVS contribution, I have been able to get this working correctly. Just a few things to address (stated at bottom) and it will be complete.

 

Finally got payments to process correctly, with a valid Billing Address populated. The following code should be inserted into the checkout_payment.php directly above where it says "// load all enabled payment modules".

 

if ($order->info['subtotal'] == 0 || $cart->info['subtotal'] == 0) {
if (!tep_session_is_registered('shipping')) tep_session_register('shipping');
$shipping = false;
$sendto = false;
tep_redirect(tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL'));
}

 

I still need to add 2 more modifications to this (actually, I need the help of the experts here) to update the order status from 'Pending' to 'Updated' (or whatever) and to include some form of Payment text both on the order confirmation screen and on the emailed order. Any help would be appreciated.

 

Note: Session registry could change from 'shipping' to 'payment' and a value added for $payment. Also, for me, order_status will need to be updated to automate downloadable products.

 

If anyone is wondering - I was not able to get Download Controller 5.3 working with MVS. That is why I started working with this contribution.

Link to comment
Share on other sites

vitual_weight was part of original osC code (or perhaps a mod, I forget now). I also never figured out how to make it work, so I added the total_weight check. That's really what does the magic in this mod :) As for vitual_weight, who knows?

'virtual_weight' is not part of the original OSC, nor of the milestone update. Since the value is never set anywhere (unless you have another MOD that uses it), it would not be necessary as part of the evaluation. I just wanted to know what contribution you got it from. If you have some sort of text content search utility, it would be an easy thing to identify where it is being used. I use Copernic Desktop on my system (Windows XP).

Link to comment
Share on other sites

'virtual_weight' is not part of the original OSC, nor of the milestone update. Since the value is never set anywhere (unless you have another MOD that uses it), it would not be necessary as part of the evaluation. I just wanted to know what contribution you got it from. If you have some sort of text content search utility, it would be an easy thing to identify where it is being used. I use Copernic Desktop on my system (Windows XP).

It's only in shopping_cart and checkout_shipping on my site... but it seems that this might be some relic code from an attempt to use the download controller module way back when (we never got it to work).

Link to comment
Share on other sites

I still need to add 2 more modifications to this (actually, I need the help of the experts here) to update the order status from 'Pending' to 'Updated' (or whatever) and to include some form of Payment text both on the order confirmation screen and on the emailed order. Any help would be appreciated.

Not sure if this helps, but this is the code used in Recover Cart Sales for selecting an order status:

			$ccquery = tep_db_query('select orders_id, orders_status from ' . TABLE_ORDERS . ' where (customers_id = ' . (int)$curcus . ' OR customers_email_address like "' . $inrec['email'] .'" or customers_name like "' . $inrec['fname'] . ' ' . $inrec['lname'] . '") and date_purchased >= "' . $beforeDate . '"' );
		if (mysql_num_rows($ccquery) > 0)

Link to comment
Share on other sites

It's only in shopping_cart and checkout_shipping on my site... but it seems that this might be some relic code from an attempt to use the download controller module way back when (we never got it to work).

I believe you are correct. Download Controller only used the checkout_shipping and shopping_cart, along with their own definitions and modules (freeshipper and freecharger).

Link to comment
Share on other sites

Not sure if this helps, but this is the code used in Recover Cart Sales for selecting an order status:

			$ccquery = tep_db_query('select orders_id, orders_status from ' . TABLE_ORDERS . ' where (customers_id = ' . (int)$curcus . ' OR customers_email_address like "' . $inrec['email'] .'" or customers_name like "' . $inrec['fname'] . ' ' . $inrec['lname'] . '") and date_purchased >= "' . $beforeDate . '"' );
		if (mysql_num_rows($ccquery) > 0)

I can update the status ($order->info['order_status']) and payment method ($order->info['payment_method']) with the correct information and it shows up in the order database. But, the download link does not show unless I leave it as 'Pending' and update manually. I will need to check this out. In the meantime, I am not updating status or payment method.

 

The query you posted above does not change the database, as it is only a query. It would be better to use the above information from "checkout_process.php" to update this information.

 

Thanks for the suggestion.

Link to comment
Share on other sites

  • 11 months later...

How do I fix this, I have items for shipping and without shipping, how can I use this mod but put both of those in the same order. Right now it skipped the page as long as there is 1 item with no weight.

Link to comment
Share on other sites

How do I fix this, I have items for shipping and without shipping, how can I use this mod but put both of those in the same order. Right now it skipped the page as long as there is 1 item with no weight.

Link to comment
Share on other sites

How do I fix this, I have items for shipping and without shipping, how can I use this mod but put both of those in the same order. Right now it skipped the page as long as there is 1 item with no weight.

Link to comment
Share on other sites

  • 4 weeks later...

Hi,

if anyone is tracking this, is there a way to skip the shipping page (as outlined in lane's original post) but still have tax added?

In my case I tried this mod but GST(Australian) was no longer being added.

 

The reason I want the shipping page to skip but add the tax is because the GST is a part of all transactions in AUS and not related to shipping.

Plus the people I'm doing this for don't want to deliver, instead just have their clients pick up the products.

So this is another reason they don't want the Shipping Page cause customers may get confused, especially after many section of the site state that "Delivery isn't available"

 

I hope some out there can help

Link to comment
Share on other sites

This code is great but I have a similar problem. Client will pick up the order locally, therefore no shipping and handling to be charged. How is this transaction handled in OSC. The previous solution made items virtual for all. I only want S/H ignored for choice clients. Thoughts and ideas or has then been done somewhere that I missed. I am relatively new at OS.

Link to comment
Share on other sites

  • 2 months later...

I have the same problem as Tara.

 

I have no shipping items (memberships) and shipped items (shirts and books). The shirts and books are shipped at predefined rates (ex.: shirts $4.05).

 

Suggestions? Help?

"If you obey all the rules, you miss all the fun." Katherine Hepburn

Link to comment
Share on other sites

  • 6 months later...

I have this contrib installed and also the "add weight to product attributes". I have both downloaded items that require no shipping and a few items that will be shipped. Everything had been working fine, but for some reason now, for those items that are shipped, it is not passing the weight values to the checkout_shipping.php page. Which causes it to go straight to check payment, when it should provide shipping options. However, this is not the weirdest part.... The weirdest part is that there are a few products that do go to the shipping page.

 

Any help would be greatly appreciated.

Link to comment
Share on other sites

  • 1 year later...

Hi

 

I would like to skip my shipping process completely because my items are all downloadable goods.

But when a customer pays using paypal they get the following message:

 

oscommerce PayPal does not allow your country of residence to deliver to the country you wish to

 

Q: how can i stop the script sending shipping/adress details to paypal ... this could solve my problem

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...