Guest Posted October 25, 2007 Posted October 25, 2007 I have a heavily modified cart that has run smoothly for years. I made some modifications to the checkout to bypass the checkout_shipping page because we offered free shipping. It is deeply modified with checks and redirects that involve many pages. Now, I want to switch to a flat fee shipping, but I don't want to add the page back into the process. Quick checkout is king! As it stands now, even when I activate flat fee in admin, it isn't captured. Right now, I use the Low Order Fee Contribution but I want to be able to add items that ship for free (I've hacked in a Gift Certificate item using Option Type Attributes and Discount Coupons) using Free Shipping by Products or Free Shipping by Categories or even enabling downloadable products. So, how can I add elements of checkout_shipping to checkout_payment to capture the cost? Any help would be appreciated.
Guest Posted October 26, 2007 Posted October 26, 2007 I studied various Contributions that combined files to make the checkout process shorter and pulled 2 chunks of code out of checkout_shipping.php and stuck them into likely looking spots in checkout_payment.php. At first it seemed to work just fine, then something unusual happened. On checkout_confirmation.php, during checkout tests, the shipping line said "f: $0.00". When I added another shipping method and chose it for checkout, it said "t: $0.00" (or some similar single letter before the cost). is this a clue to the lines I've added to the file? Any suggestions?
♥toyicebear Posted October 26, 2007 Posted October 26, 2007 Checkout Fast and Easy Checkout, it includes the complete file set for combining the shipping and payment page into just one page. (If you want to simplify it look at the older versions, those pre. the modular approche) Basics for osC 2.2 Design - Basics for Design V2.3+ - Seo & Sef Url's - Meta Tags for Your osC Shop - Steps to prevent Fraud... - MS3 and Team News... - SEO, Meta Tags, SEF Urls and osCommerce - Commercial Support Inquiries - OSC 2.3+ How To To see what more i can do for you check out my profile [click here]
Guest Posted October 26, 2007 Posted October 26, 2007 Thanks, Nick. That's the one I've been looking into for it. My files are so heavily modified with other contribs that it isn't a simple process for me. I was hoping to get pointers on which specific bits of code were necessary from shipping to add to payment. I pulled this from above the head: // load all enabled shipping modules require(DIR_WS_CLASSES . 'shipping.php'); $shipping_modules = new shipping; if ( defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING') && (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') ) { $pass = false; switch (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) { case 'national': if ($order->delivery['country_id'] == STORE_COUNTRY) { $pass = true; } break; case 'international': if ($order->delivery['country_id'] != STORE_COUNTRY) { $pass = true; } break; case 'both': $pass = true; break; } $free_shipping = false; if ( ($pass == true) && ($order->info['total'] >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) ) { $free_shipping = true; include(DIR_WS_LANGUAGES . $language . '/modules/order_total/ot_shipping.php'); } } else { $free_shipping = false; } // process the selected shipping method if ( isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process') ) { if (!tep_session_is_registered('comments')) tep_session_register('comments'); if (tep_not_null($HTTP_POST_VARS['comments'])) { $comments = tep_db_prepare_input($HTTP_POST_VARS['comments']); } if (!tep_session_is_registered('shipping')) tep_session_register('shipping'); if ( (tep_count_shipping_modules() > 0) || ($free_shipping == true) ) { if ( (isset($HTTP_POST_VARS['shipping'])) && (strpos($HTTP_POST_VARS['shipping'], '_')) ) { $shipping = $HTTP_POST_VARS['shipping']; list($module, $method) = explode('_', $shipping); if ( is_object($$module) || ($shipping == 'free_free') ) { if ($shipping == 'free_free') { $quote[0]['methods'][0]['title'] = FREE_SHIPPING_TITLE; $quote[0]['methods'][0]['cost'] = '0'; } else { $quote = $shipping_modules->quote($method, $module); } if (isset($quote['error'])) { tep_session_unregister('shipping'); } else { if ( (isset($quote[0]['methods'][0]['title'])) && (isset($quote[0]['methods'][0]['cost'])) ) { $shipping = array('id' => $shipping, 'title' => (($free_shipping == true) ? $quote[0]['methods'][0]['title'] : $quote[0]['module'] . ' (' . $quote[0]['methods'][0]['title'] . ')'), 'cost' => $quote[0]['methods'][0]['cost']); tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); } } } else { tep_session_unregister('shipping'); } } } else { $shipping = false; tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); } } // get all available shipping quotes $quotes = $shipping_modules->quote(); // if no shipping method has been selected, automatically select the cheapest method. // if the modules status was changed when none were available, to save on implementing // a javascript force-selection method, also automatically select the cheapest shipping // method if more than one module is now enabled if ( !tep_session_is_registered('shipping') || ( tep_session_is_registered('shipping') && ($shipping == false) && (tep_count_shipping_modules() > 1) ) ) $shipping = $shipping_modules->cheapest(); and this from the body: <?php if (tep_count_shipping_modules() > 0) { ?> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="main"><b><?php echo TABLE_HEADING_SHIPPING_METHOD; ?></b></td> </tr> </table></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> <tr class="infoBoxContents"> <td> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <?php if (sizeof($quotes) > 1 && sizeof($quotes[0]) > 1) { ?> <tr> <td width="4%"> <?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?> </td> <td class="main" width="87%" valign="top"> <?php echo TEXT_CHOOSE_SHIPPING_METHOD; ?> </td> <td class="main" width="5%" valign="top" align="right"> <?php echo '<b>' . TITLE_PLEASE_SELECT . '</b><br>' . tep_image(DIR_WS_IMAGES . 'arrow_east_south.gif'); ?> </td> <td width="4%"> <?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?> </td> </tr> <?php } elseif ($free_shipping == false) { ?> <tr> <td width="4%"> <?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?> </td> <td class="main" colspan="2"> <?php echo TEXT_ENTER_SHIPPING_INFORMATION; ?> </td> <td width="4%"> <?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?> </td> </tr> <?php } if ($free_shipping == true) { ?> <tr> <td width="4%"> <?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?> </td> <td colspan="2"> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td width="10"> <?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?> </td> <td class="main" colspan="3"><b> <?php echo FREE_SHIPPING_TITLE; ?> </b> <?php echo $quotes[$i]['icon']; ?> </td> <td width="10"> <?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?> </td> </tr> <tr> <td width="10"> <?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?> </td> <td class="main" width="100%"> <?php echo /*sprintf(FREE_SHIPPING_DESCRIPTION, $currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)) .*/ tep_draw_hidden_field('shipping', 'free_free'); ?> </td> <td width="10"> <?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?> </td> </tr> </table> </td> <td width="4%"> <?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?> </td> </tr> <?php } else { $radio_buttons = 0; for ($i=0, $n=sizeof($quotes); $i<$n; $i++) { ?> <tr> <td colspan="2"> <table border="0" width="110%" cellspacing="0" cellpadding="2"> <tr> <td class="main" colspan="3"> <?php if (isset($quotes[$i]['icon']) && tep_not_null($quotes[$i]['icon'])) { echo $quotes[$i]['icon']; } ?> </td> </tr> <?php if (isset($quotes[$i]['error'])) { ?> <tr> <td class="main" colspan="3"> <?php echo $quotes[$i]['error']; ?> </td> </tr> <?php } else { for ($j=0, $n2=sizeof($quotes[$i]['methods']); $j<$n2; $j++) { // set the radio button to be checked if it is the method chosen $checked = (($quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'] == $shipping['id']) ? true : false); if ( ($checked == true) || ($n == 1 && $n2 == 1) ) { echo ' <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n"; } else { echo ' <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n"; } ?> <td class="main" width="50%"> <?php echo $quotes[$i][$j]['title']; ?> <b> <?php echo $quotes[$i]['module']; ?> </b></td> <?php if ( ($n > 1) || ($n2 > 1) ) { ?> <td class="main" align="right" width="47%"><b> </b> <?php echo tep_draw_radio_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'], $checked); ?> </td> <?php } else { ?> <td class="main" align="right" colspan="2" width="3%"> <?php echo $currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])) . tep_draw_hidden_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id']); ?> </td> <?php } ?> </tr> <?php $radio_buttons++; } } ?> </table> </td> </tr> <?php } } ?> </table> </td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php } ?> and placed them in appropriate locations in the head and body of payment Maybe I need the javascript from in the head?
Guest Posted October 26, 2007 Posted October 26, 2007 OK, Nick. looks much easier to move the payment lines into shipping. That's the way it's done in Fast Easy Checkout. I've almost completed it. Thanks!
rezonat0r Posted October 28, 2007 Posted October 28, 2007 Hey, I wondered if you got this to work. The only payment method I accept is Credit, so I too want to skip "checkout_payment", so that "checkout_shipping" jumps straight to "checkout_confirmation". Fast Easy Checkout doesn't properly pass the credit card info when installing with RC1 (it's designed for MS2). Any chance you can post which code you moved from payment to shipping to get this to work? Thanks! OK, Nick. looks much easier to move the payment lines into shipping. That's the way it's done in Fast Easy Checkout. I've almost completed it. Thanks!
Guest Posted October 28, 2007 Posted October 28, 2007 Got errors in credit card number validation that I couldn't figure around. I'm on MS2. I actually went back to separate shipping and payment pages for now. It's not great but not the end of the world.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.