mtechama Posted July 9, 2006 Share Posted July 9, 2006 (edited) Craig or Jim, can you help me get started on the CCGV with my MVS? Wade Edited July 9, 2006 by mtechama Quote Wade Morris Amarillo, Texas Before you do any changes on your site you need to do BACKUP! BACKUP! Link to comment Share on other sites More sharing options...
mtechama Posted July 9, 2006 Share Posted July 9, 2006 Craig or Jim see if I got this right on (catalog)/checkout_shipping.php? <?php /* $Id: checkout_shipping.php,v 1.16 2003/06/09 23:03:53 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); require('includes/classes/http_client.php'); // if the customer is not logged on, redirect them to the login page if (!tep_session_is_registered('customer_id')) { $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } // if there is nothing in the customers cart, redirect them to the shopping cart page if ($cart->count_contents() < 1) { tep_redirect(tep_href_link(FILENAME_SHOPPING_CART)); } // if no shipping destination address was selected, use the customers own address as default if (!tep_session_is_registered('sendto')) { tep_session_register('sendto'); $sendto = $customer_default_address_id; } else { // verify the selected shipping address $check_address_query = tep_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$sendto . "'"); $check_address = tep_db_fetch_array($check_address_query); if ($check_address['total'] != '1') { $sendto = $customer_default_address_id; if (tep_session_is_registered('shipping')) tep_session_unregister('shipping'); } } require(DIR_WS_CLASSES . 'order.php'); $order = new order; // register a random ID in the session to check throughout the checkout procedure // against alterations in the shopping cart contents if (!tep_session_is_registered('cartID')) tep_session_register('cartID'); $cartID = $cart->cartID; // 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') ) { // Edited for CCGV if (!tep_session_is_registered('shipping')) tep_session_register('shipping'); $shipping = false; $sendto = false; tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); } //MVS if (SELECT_VENDOR_SHIPPING == 'true') { include(DIR_WS_CLASSES . 'vendor_shipping.php'); $shipping_modules = new shipping; } else { include(DIR_WS_CLASSES . 'shipping.php'); $shipping_modules = new shipping; $total_weight = $cart->show_weight(); $cost = $cart->show_total(); $total_count = $cart->count_contents(); } // 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 (SELECT_VENDOR_SHIPPING == 'true') { $total_shipping_cost = 0; $shipping_title = MULTIPLE_SHIP_METHODS_TITLE; $vendor_shipping = $cart->vendor_shipping; $shipping = array(); foreach ($vendor_shipping as $vendor_id => $vendor_data) { $products_shipped = $_POST['products_' . $vendor_id]; $products_array = explode ("_", $products_shipped); $shipping_data = $_POST['shipping_' . $vendor_id]; $shipping_array = explode ("_", $shipping_data); $module = $shipping_array[0]; $method = $shipping_array[1]; $ship_tax = $shipping_array[2]; if ( is_object($$module) || ($module == 'free') ) { if ($module == 'free') { $quote[0]['methods'][0]['title'] = FREE_SHIPPING_TITLE; $quote[0]['methods'][0]['cost'] = '0'; } else { $total_weight = $vendor_shipping[$vendor_id]['weight']; $shipping_weight = $total_weight; $cost = $vendor_shipping[$vendor_id]['cost']; $total_count = $vendor_shipping[$vendor_id]['qty']; $quote = $shipping_modules->quote($method, $module, $vendor_id); } if (isset($quote['error'])) { tep_session_unregister('shipping'); } else { if ( (isset($quote[0]['methods'][0]['title'])) && (isset($quote[0]['methods'][0]['cost'])) ) { $output[$vendor_id] = array('id' => $module . '_' . $method, 'title' => $quote[0]['methods'][0]['title'], 'ship_tax' => $ship_tax, 'products' => $products_array, 'cost' => $quote[0]['methods'][0]['cost'] ); $total_ship_tax += $ship_tax; $total_shipping_cost += $quote[0]['methods'][0]['cost']; }//if isset }//if isset }//if is_object }//foreach if ($free_shipping == true) { $shipping_title = $quote[0]['module']; } elseif (count($output) <2) { $shipping_title = $quote[0]['methods'][0]['title']; } $shipping = array('id' => $shipping, 'title' => $shipping_title, 'cost' => $total_shipping_cost, 'shipping_tax_total' => $total_ship_tax, 'vendor' => $output ); } else { 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'); } } tep_redirect(tep_href_link('checkout_payment.php', '', 'SSL')); exit; } //MVS END $total_weight = $cart->show_weight(); $total_count = $cart->count_contents(); // 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(); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_SHIPPING); $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo TITLE; ?></title> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> <script language="javascript"><!-- var selected; function selectRowEffect(object, buttonSelect) { if (!selected) { if (document.getElementById) { selected = document.getElementById('defaultSelected'); } else { selected = document.all['defaultSelected']; } } if (selected) selected.className = 'moduleRow'; object.className = 'moduleRowSelected'; selected = object; // one button is not an array if (document.checkout_address.shipping[0]) { document.checkout_address.shipping[buttonSelect].checked=true; } else { document.checkout_address.shipping.checked=true; } } function rowOverEffect(object) { if (object.className == 'moduleRow') object.className = 'moduleRowOver'; } function rowOutEffect(object) { if (object.className == 'moduleRowOver') object.className = 'moduleRow'; } //--></script> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" width="100%" cellspacing="3" cellpadding="3"> <tr> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- left_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> <!-- left_navigation_eof //--> </table></td> <!-- body_text //--> <td width="100%" valign="top"><?php echo tep_draw_form('checkout_address', tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')) . tep_draw_hidden_field('action', 'process'); ?><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_delivery.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="main"><b><?php echo TABLE_HEADING_SHIPPING_ADDRESS; ?></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"> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main" width="50%" valign="top"><?php echo TEXT_CHOOSE_SHIPPING_DESTINATION . '<br><br><a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING_ADDRESS, '', 'SSL') . '">' . tep_image_button('button_change_address.gif', IMAGE_BUTTON_CHANGE_ADDRESS) . '</a>'; ?></td> <td align="right" width="50%" valign="top"><table border="0" cellspacing="0" cellpadding="2"> <tr> <td class="main" align="center" valign="top"><?php echo '<b>' . TITLE_SHIPPING_ADDRESS . '</b><br>' . tep_image(DIR_WS_IMAGES . 'arrow_south_east.gif'); ?></td> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main" valign="top"><?php echo tep_address_label($customer_id, $sendto, true, ' ', '<br>'); ?></td> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> </table></td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?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><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main" width="50%" valign="top"><?php echo TEXT_CHOOSE_SHIPPING_METHOD; ?></td> <td class="main" width="50%" valign="top" align="right"><?php echo '<b>' . TITLE_PLEASE_SELECT . '</b><br>' . tep_image(DIR_WS_IMAGES . 'arrow_east_south.gif'); ?></td> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> <?php } elseif ($free_shipping == false) { ?> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main" width="100%" colspan="2"><?php echo TEXT_ENTER_SHIPPING_INFORMATION; ?></td> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> <?php } if ($free_shipping == true) { ?> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td colspan="2" width="100%"><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 id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, 0)"> <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><?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><?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 $quotes[$i]['module']; ?></b> <?php if (isset($quotes[$i]['icon']) && tep_not_null($quotes[$i]['icon'])) { echo $quotes[$i]['icon']; } ?></td> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> <?php if (isset($quotes[$i]['error'])) { ?> <tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main" colspan="3"><?php echo $quotes[$i]['error']; ?></td> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></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 width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main" width="75%"><?php echo $quotes[$i]['methods'][$j]['title']; ?></td> <?php if ( ($n > 1) || ($n2 > 1) ) { ?> <td class="main"><?php echo $currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], (isset($quotes[$i]['tax']) ? $quotes[$i]['tax'] : 0))); ?></td> <td class="main" align="right"><?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"><?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 } ?> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> <?php $radio_buttons++; } } ?> </table></td> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> <?php } } ?> </table></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php } ?> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="main"><b><?php echo TABLE_HEADING_COMMENTS; ?></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"> <tr> <td><?php echo tep_draw_textarea_field('comments', 'soft', '60', '5'); ?></td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></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"> <tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main"><?php echo '<b>' . TITLE_CONTINUE_CHECKOUT_PROCEDURE . '</b><br>' . TEXT_CONTINUE_CHECKOUT_PROCEDURE; ?></td> <td class="main" align="right"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td width="50%" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'checkout_bullet.gif'); ?></td> <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td> </tr> </table></td> <td width="25%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td> <td width="25%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td> <td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td> <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '1', '5'); ?></td> </tr> </table></td> </tr> <tr> <td align="center" width="25%" class="checkoutBarCurrent"><?php echo CHECKOUT_BAR_DELIVERY; ?></td> <td align="center" width="25%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_PAYMENT; ?></td> <td align="center" width="25%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_CONFIRMATION; ?></td> <td align="center" width="25%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_FINISHED; ?></td> </tr> </table></td> </tr> </table></form></td> <!-- body_text_eof //--> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- right_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?> <!-- right_navigation_eof //--> </table></td> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> <br> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> Quote Wade Morris Amarillo, Texas Before you do any changes on your site you need to do BACKUP! BACKUP! Link to comment Share on other sites More sharing options...
♥kymation Posted July 9, 2006 Share Posted July 9, 2006 Craig or Jim,can you help me get started on the CCGV with my MVS? Wade Install one, then install the other? Really, I can't think of anything better. Both contributions have instructions for installing on a modified shop. Follow the instructions carefully. If you have already modified osCommerce the line numbers will not match, so use Search to find the lines to modify. Craig likes to use a compare program, so you could try that as well. It lets you see all of the differences between files, so you can spot changes even if the instructions are incomplete or incorrect. If both contributions modify the same line (usually SQL queries), you'll need to find what was changed on both and merge the changes. Usually one or more fields have been added to a SQL query, so just find all of the additions in both contributions and add them all. If you get stuck on a particular chunk of code, post it here and we'll give you some more advice. Please post only the code in question and not the entire file so we don't have to go hunting. Regards Jim Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
Bozmium Posted July 9, 2006 Share Posted July 9, 2006 Hi Forum, Ok the very last thing i have to do to make MVS fully functional in my shop is to get the old shipping estimator working. It works at the moment but does not pull any values (obviously!) So is showing no info. I have had a look at the file i need to change which i have posted below (apologies in advance for the large post!) but am stumped as to where to begin. Has anybody done this before or is anyone able to point me in the right direction? shipping_estimator.php <!-- shipping_estimator //--> <script language="JavaScript"> function shipincart_submit(sid){ if(sid){ document.estimator.sid.value=sid; } document.estimator.submit(); return false; } </script> <table align="center"><tr valign="top"><td> <?php // Only do when something is in the cart if ($cart->count_contents() > 0) { require(DIR_WS_LANGUAGES . $language . '/modules/' . FILENAME_SHIPPING_ESTIMATOR); // shipping cost require('includes/classes/http_client.php'); // shipping in basket //if($cart->get_content_type() !== 'virtual') { if (tep_session_is_registered('customer_id')) { // user is logged in if (isset($HTTP_POST_VARS['address_id'])){ // user changed address $sendto = $HTTP_POST_VARS['address_id']; }elseif (tep_session_is_registered('cart_address_id')){ // user once changed address $sendto = $cart_address_id; }else{ // first timer $sendto = $customer_default_address_id; } // set session now $cart_address_id = $sendto; tep_session_register('cart_address_id'); // set shipping to null ! multipickup changes address to store address... $shipping=''; // include the order class (uses the sendto !) require(DIR_WS_CLASSES . 'order.php'); $order = new order; }else{ // user not logged in ! if (isset($HTTP_POST_VARS['country_id'])){ // country is selected $country_info = tep_get_countries($HTTP_POST_VARS['country_id'],true); $order->delivery = array('postcode' => $HTTP_POST_VARS['zip_code'], 'country' => array('id' => $HTTP_POST_VARS['country_id'], 'title' => $country_info['countries_name'], 'iso_code_2' => $country_info['countries_iso_code_2'], 'iso_code_3' => $country_info['countries_iso_code_3']), 'country_id' => $HTTP_POST_VARS['country_id'], //add state zone_id 'zone_id' => $HTTP_POST_VARS['state'], 'format_id' => tep_get_address_format_id($HTTP_POST_VARS['country_id'])); $cart_country_id = $HTTP_POST_VARS['country_id']; tep_session_register('cart_country_id'); //add state zone_id $cart_zone = $HTTP_POST_VARS['zone_id']; tep_session_register('cart_zone'); $cart_zip_code = $HTTP_POST_VARS['zip_code']; tep_session_register('cart_zip_code'); }elseif (tep_session_is_registered('cart_country_id')){ // session is available $country_info = tep_get_countries($cart_country_id,true); $order->delivery = array('postcode' => $cart_zip_code, 'country' => array('id' => $cart_country_id, 'title' => $country_info['countries_name'], 'iso_code_2' => $country_info['countries_iso_code_2'], 'iso_code_3' => $country_info['countries_iso_code_3']), 'country_id' => $cart_country_id, 'format_id' => tep_get_address_format_id($cart_country_id)); } else { // first timer $cart_country_id = STORE_COUNTRY; tep_session_register('cart_country_id'); $country_info = tep_get_countries(STORE_COUNTRY,true); tep_session_register('cart_zip_code'); $order->delivery = array(//'postcode' => '', 'country' => array('id' => STORE_COUNTRY, 'title' => $country_info['countries_name'], 'iso_code_2' => $country_info['countries_iso_code_2'], 'iso_code_3' => $country_info['countries_iso_code_3']), 'country_id' => STORE_COUNTRY, 'format_id' => tep_get_address_format_id($HTTP_POST_VARS['country_id'])); } // set the cost to be able to calculate free shipping $order->info = array('total' => $cart->show_total(), // TAX ???? 'currency' => $currency, 'currency_value'=> $currencies->currencies[$currency]['value']); } // weight and count needed for shipping $total_weight = $cart->show_weight(); $total_count = $cart->count_contents(); require(DIR_WS_CLASSES . 'shipping.php'); $shipping_modules = new shipping; $quotes = $shipping_modules->quote(); $order->info['subtotal'] = $cart->total; // set selections for displaying $selected_country = $order->delivery['country']['id']; $selected_address = $sendto; //} // eo shipping cost // check free shipping based on order total if ( defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING') && (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true')) { 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; default: $pass = false; 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; } // begin shipping cost if(!$free_shipping && $cart->get_content_type() !== 'virtual'){ if (tep_not_null($HTTP_POST_VARS['sid'])){ list($module, $method) = explode('_', $HTTP_POST_VARS['sid']); $cart_sid = $HTTP_POST_VARS['sid']; tep_session_register('cart_sid'); }elseif (tep_session_is_registered('cart_sid')){ list($module, $method) = explode('_', $cart_sid); }else{ $module=""; $method=""; } if (tep_not_null($module)){ $selected_quote = $shipping_modules->quote($method, $module); if($selected_quote[0]['error'] || !tep_not_null($selected_quote[0]['methods'][0]['cost'])){ $selected_shipping = $shipping_modules->cheapest(); $order->info['shipping_method'] = $selected_shipping['title']; $order->info['shipping_cost'] = $selected_shipping['cost']; $order->info['total']+= $selected_shipping['cost']; }else{ $order->info['shipping_method'] = $selected_quote[0]['module'].' ('.$selected_quote[0]['methods'][0]['title'].')'; $order->info['shipping_cost'] = $selected_quote[0]['methods'][0]['cost']; $order->info['total']+= $selected_quote[0]['methods'][0]['cost']; $selected_shipping['title'] = $order->info['shipping_method']; $selected_shipping['cost'] = $order->info['shipping_cost']; $selected_shipping['id'] = $selected_quote[0]['id'].'_'.$selected_quote[0]['methods'][0]['id']; } }else{ $selected_shipping = $shipping_modules->cheapest(); $order->info['shipping_method'] = $selected_shipping['title']; $order->info['shipping_cost'] = $selected_shipping['cost']; $order->info['total']+= $selected_shipping['cost']; } } // virtual products use free shipping if($cart->get_content_type() == 'virtual') { $order->info['shipping_method'] = CART_SHIPPING_METHOD_FREE_TEXT . ' ' . CART_SHIPPING_METHOD_ALL_DOWNLOADS; $order->info['shipping_cost'] = 0; } if($free_shipping) { $order->info['shipping_method'] = MODULE_ORDER_TOTAL_SHIPPING_TITLE; $order->info['shipping_cost'] = 0; } $shipping=$selected_shipping; // end of shipping cost // end free shipping based on order total $info_box_contents = array(); $info_box_contents[] = array('text' => CART_SHIPPING_OPTIONS); new ContentBoxHeading($info_box_contents, true, true); $ShipTxt= tep_draw_form('estimator', tep_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'), 'post'); //'onSubmit="return check_form();"' $ShipTxt.=tep_draw_hidden_field('sid', $selected_shipping['id']); $ShipTxt.='<table>'; if(sizeof($quotes)) { if (tep_session_is_registered('customer_id')) { // logged in if (CARTSHIP_SHOWWT == 'true') { $showweight = ' (' . $total_weight . ' ' . CARTSHIP_WTUNIT . ')'; } else { $showweight = ''; } if(CARTSHIP_SHOWIC == 'true'){ $ShipTxt.='<tr><td colspan=6><span class="smallAmber"><center>SELECT THE APPROPRIATE OPTION BELOW AS INDICATED AT THE BOTTOM OF THE PRODUCTS PAGE</span><BR><span class="smallText">AUSPOST ONLY SUITABLE FOR SMALLER NON ELECTRONIC ITEMS SUCH AS TORCHES & BATTERIES.<BR>AAE IS NORMALLY YOUR MOST EFFICIENT CHOICE FOR SMALLER ORDERS GOING INTERSTATE, STAR FOR LOCAL.<BR>AIRROAD FOR LARGER ITEMS GOING INTERSTATE SUCH AS MONITORS, SET TOP BOXES & PC CASES, PRINTERS<br>PLEASE NOTE: All figures shown here are based on despatch from Melbourne.<br>For large items such as printers, monitors & Cases please <a href="'.tep_ascii_email(1, "[email protected]").'"><u>Contact Us</u></a><br>We can often have items despatched from our interstate warehouses located closer to you to reduce your freight costs. Its often worth the email!<BR>METRO: within approx 20km of the city center.<br>OUTER: Everywhere else<br>BCT DOES NOT OFFER PICKUPS</center></SPAN></td></tr><tr><td class="smallAmber">' . ($total_count == 1 ? ' <b>Item:</b></td><td colspan="2" class="smalltext">' : ' <b>Items:</b></td><td colspan="2" class="smalltext">') . $total_count . $showweight . '</td></tr>'; } $addresses_query = tep_db_query("select address_book_id, entry_city as city, entry_postcode as postcode, entry_state as state, entry_zone_id as zone_id, entry_country_id as country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . $customer_id . "'"); // only display addresses if more than 1 if (tep_db_num_rows($addresses_query) > 1){ while ($addresses = tep_db_fetch_array($addresses_query)) { $addresses_array[] = array('id' => $addresses['address_book_id'], 'text' => tep_address_format(tep_get_address_format_id($addresses['country_id']), $addresses, 0, ' ', ' ')); } $ShipTxt.='<tr><td colspan="3" class="smallAmber" nowrap>' . CART_SHIPPING_METHOD_ADDRESS .' '. tep_draw_pull_down_menu('address_id', $addresses_array, $selected_address, 'onchange="return shipincart_submit(\'\');"').'</td></tr>'; } $ShipTxt.='<tr valign="top"><td class="smallAmber"><b>' . CART_SHIPPING_METHOD_TO .'</b> </td><td colspan="2" class="smalltext">'. tep_address_format($order->delivery['format_id'], $order->delivery, 1, ' ', '<br>') . '</td></tr>'; } else { // not logged in // $ShipTxt.=tep_output_warning(CART_SHIPPING_OPTIONS_LOGIN); if(CARTSHIP_SHOWIC == 'true'){ $ShipTxt.='<tr><td colspan=6><span class="smallAmber"><center>SELECT THE APPROPRIATE OPTION BELOW AS INDICATED AT THE BOTTOM OF THE PRODUCTS PAGE</span><BR><span class="smallText">AUSPOST ONLY SUITABLE FOR SMALLER NON ELECTRONIC ITEMS SUCH AS TORCHES & BATTERIES.<BR>AAE IS NORMALLY YOUR MOST EFFICIENT CHOICE FOR SMALLER ORDERS GOING INTERSTATE, STAR FOR LOCAL.<BR>AIRROAD FOR LARGER ITEMS GOING INTERSTATE SUCH AS MONITORS, SET TOP BOXES & PC CASES, PRINTERS<br>PLEASE NOTE: All figures shown here are based on despatch from Melbourne.<br>For large items such as printers, monitors & Cases please <a href="'.tep_ascii_email(1, "[email protected]").'"><u>Contact Us</u></a><br>We can often have items despatched from our interstate warehouses located closer to you to reduce your freight costs. Its often worth the email!<BR>METRO: within approx 20km of the city center.<br>OUTER: Everywhere else<br>BCT DOES NOT OFFER PICKUPS</center></td></tr><tr><td class="smallAmber">' . ($total_count == 1 ? ' <b>Item:</b></td><td colspan="2" class="smalltext">' : ' <b>Items:</b></td><td colspan="2" class="smalltext">') . $total_count . $showweight . '</td></tr>'; } if($cart->get_content_type() != 'virtual'){ if(CARTSHIP_SHOWCDD == 'true'){ $ShipTxt.='<tr><td colspan="3" class="smallAmber" nowrap>' . ENTRY_COUNTRY .' '. tep_get_country_list('country_id', $selected_country,'style="width=200"'); } //add state zone_id $state_array[] = array('id' => '', 'text' => 'Please Select'); $state_query = tep_db_query("select zone_name, zone_id from " . TABLE_ZONES . " where zone_country_id = '$selected_country' order by zone_country_id DESC, zone_name"); while ($state_values = tep_db_fetch_array($state_query)) { $state_array[] = array('id' => $state_values['zone_id'], 'text' => $state_values['zone_name']); } if(CARTSHIP_SHOWSDD == 'true'){ $ShipTxt.=' ' .ENTRY_STATE .' '. tep_draw_pull_down_menu('state',$state_array); } if(CARTSHIP_SHOWZDD == 'true'){ $ShipTxt.=' '.ENTRY_POST_CODE .' '. tep_draw_input_field('zip_code', $selected_zip, 'size="5"'); } // $ShipTxt.=' <a href="_" onclick="return shipincart_submit(\'\');">'.CART_SHIPPING_METHOD_RECALCULATE.'</a></td></tr>'; if(CARTSHIP_SHOWUB == 'true'){ $ShipTxt.=' <td><a href="_" onclick="return shipincart_submit(\'\');">'. tep_image_button('Update.gif', IMAGE_BUTTON_UPDATE_CART) . ' </a></td></td></tr>'; } } } if($cart->get_content_type() == 'virtual'){ // virtual product-download //$ShipTxt.='<tr><td colspan="3" class="main">'.tep_draw_separator().'</td></tr>'; $ShipTxt.='<tr><td class="main" colspan="3"> </td></tr><tr><td class="main" colspan="3"><i>' . CART_SHIPPING_METHOD_FREE_TEXT . ' ' . CART_SHIPPING_METHOD_ALL_DOWNLOADS . '</i></td></tr>'; }elseif ($free_shipping==1) { // order $total is free //$ShipTxt.='<tr><td colspan="3" class="main">'.tep_draw_separator().'</td></tr>'; $ShipTxt.='<tr><td class="main" colspan="3"> </td></tr><tr><td class="largeGreen" colspan="3"><i>' . sprintf(FREE_SHIPPING_DESCRIPTION, $currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)) . '</i></td><td> </td></tr>'; }else{ // shipping display $ShipTxt.='<tr><td colspan="3" class="main"> </td></tr><tr><td class="smallAmber"><b><u>' . CART_SHIPPING_CARRIER_TEXT . '</u></b></td><td class="smallAmber" align="left"><b><u>' . CART_SHIPPING_METHOD_TEXT . '</u></b></td><td class="smallAmber" colspan="2" align="right"><b><u>' . CART_SHIPPING_METHOD_RATES . '</u></b></td></tr>'; $ShipTxt.='<tr><td colspan="3" class="footer">'.tep_draw_separator().'</td></tr>'; for ($i=0, $n=sizeof($quotes); $i<$n; $i++) { if(sizeof($quotes[$i]['methods'])==1){ // simple shipping method $thisquoteid = $quotes[$i]['id'].'_'.$quotes[$i]['methods'][0]['id']; $ShipTxt.= '<tr class="'.$extra.'">'; $ShipTxt.='<td class="main">'.$quotes[$i]['icon'].' </td>'; if($quotes[$i]['error']){ $ShipTxt.='<td colspan="2" class="smallText">'.$quotes[$i]['module'].' '; $ShipTxt.= '('.$quotes[$i]['error'].')</td></tr>'; }else{ if($selected_shipping['id'] == $thisquoteid){ $ShipTxt.='<td class="infoBoxHeading"><a title="Select this method" href="_" onclick="return shipincart_submit(\''.$thisquoteid.'\');"><b>'.$quotes[$i]['module'].' '; $ShipTxt.= ''.$quotes[$i]['methods'][0]['title'].'</b></a> </td><td align="right" class="infoBoxHeading"><b>'.$currencies->format(tep_add_tax($quotes[$i]['methods'][0]['cost'], $quotes[$i]['tax'])).'</b></td><td class="smalltext">'.tep_image(DIR_WS_ICONS . 'selected.gif', 'Selected').'</td></tr>'; }else{ $ShipTxt.='<td class="smalltext"><a title="Select this method" href="_" onclick="return shipincart_submit(\''.$thisquoteid.'\');">'.$quotes[$i]['module'].' '; $ShipTxt.= ''.$quotes[$i]['methods'][0]['title'].'</a> </td><td align="right" colspan="2" class="smalltext">'.$currencies->format(tep_add_tax($quotes[$i]['methods'][0]['cost'], $quotes[$i]['tax'])).'</td></tr>'; } } } else { // shipping method with sub methods (multipickup) for ($j=0, $n2=sizeof($quotes[$i]['methods']); $j<$n2; $j++) { $thisquoteid = $quotes[$i]['id'].'_'.$quotes[$i]['methods'][$j]['id']; $ShipTxt.= '<tr class="'.$extra.'">'; $ShipTxt.='<td class="smalltext">'.$quotes[$i]['icon'].' </td>'; if($quotes[$i]['error']){ $ShipTxt.='<td colspan="2" class="smalltext">'.$quotes[$i]['module'].' '; $ShipTxt.= '('.$quotes[$i]['error'].')</td></tr>'; }else{ if($selected_shipping['id'] == $thisquoteid){ $ShipTxt.='<td class="infoBoxHeading"><a title="Select this method" href="_" onclick="return shipincart_submit(\''.$thisquoteid.'\');"><b>'.$quotes[$i]['module'].' '; $ShipTxt.= ''.$quotes[$i]['methods'][$j]['title'].'</b></a> </td><td align="right" class="infoBoxHeading"><b>'.$currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])).'</b></td><td class="smalltext">'.tep_image(DIR_WS_ICONS . 'selected.gif', 'Selected').'</td></tr>'; }else{ $ShipTxt.='<td class="smalltext"><a title="Select this method" href="_" onclick="return shipincart_submit(\''.$thisquoteid.'\');">'.$quotes[$i]['module'].' '; $ShipTxt.= ''.$quotes[$i]['methods'][$j]['title'].'</a> </td><td align="right" colspan="2" class="smalltext">'.$currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])).'</td><td class="smalltext"> </td></tr>'; } } } } } } } $ShipTxt.= '</table></form>'; $info_box_contents = array(); $info_box_contents[] = array('text' => $ShipTxt); new DarkInfoBox($info_box_contents); if (CARTSHIP_SHOWOT == 'true'){ // BOF get taxes if not logged in if (!tep_session_is_registered('customer_id')){ $products = $cart->get_products(); for ($i=0, $n=sizeof($products); $i<$n; $i++) { $products_tax = tep_get_tax_rate($products[$i]['tax_class_id'], $order->delivery['country_id'],$order->delivery['zone_id']); $products_tax_description = tep_get_tax_description($products[$i]['tax_class_id'], $order->delivery['country_id'], $order->delivery['zone_id']); if (DISPLAY_PRICE_WITH_TAX == 'true') { //Modified by Strider 42 to correct the tax calculation when a customer is not logged in // $tax_val = ($products[$i]['final_price']-(($products[$i]['final_price']*100)/(100+$products_tax)))*$products[$i]['quantity']; $tax_val = (($products[$i]['final_price']/100)*$products_tax)*$products[$i]['quantity']; } else { $tax_val = (($products[$i]['final_price']*$products_tax)/100)*$products[$i]['quantity']; } $order->info['tax'] += $tax_val; $order->info['tax_groups']["$products_tax_description"] += $tax_val; // Modified by Strider 42 to correct the order total figure when shop displays prices with tax if (DISPLAY_PRICE_WITH_TAX == 'true') { $order->info['total']; } else { $order->info['total']+=$tax_val; } } } // EOF get taxes if not logged in (seems like less code than in order class) require(DIR_WS_CLASSES . 'order_total.php'); $order_total_modules = new order_total; //echo '</td><td align="right">'; // order total code $order_total_modules->process(); $info_box_contents = array(); $info_box_contents[] = array('text' => CART_OT); new ContentBoxHeading($info_box_contents, true, true); $otTxt='<table align="right">'; $otTxt.=$order_total_modules->output().'</table>'; $info_box_contents = array(); $info_box_contents[] = array('text' => $otTxt); new DarkInfoBox($info_box_contents); } } else { echo '<table align="center"><tr><td class="largeGreen"><i>Please login to view shipping and order total estimates.</i></td></tr></table>'; } ?> </td></tr></table> Cheers & thanks! Quote And with a 9 in 10 search rate success the no.1 returned Oscommerce forum hit: "The administrator has enabled flood control - please try again in 30 seconds." Never fails. Every time. Link to comment Share on other sites More sharing options...
blucollarguy Posted July 9, 2006 Author Share Posted July 9, 2006 Hi Forum, Ok the very last thing i have to do to make MVS fully functional in my shop is to get the old shipping estimator working. It works at the moment but does not pull any values (obviously!) So is showing no info. I have had a look at the file i need to change which i have posted below (apologies in advance for the large post!) but am stumped as to where to begin. Has anybody done this before or is anyone able to point me in the right direction? shipping_estimator.php <!-- shipping_estimator //--> <-----SNIP-----> </td></tr></table> Cheers & thanks! The thing you need to do here is see how this code does what it does. "order->...." is the data being used to pass the needed information to the pages in order to obtain the quote. This ordinarily comes from includes/classes/order.php, MVS changes some things there, vicually compare what is here with what is changed by MVS. Then, the code that collects and displays the quote, from checkout_shippng.php, is also re-written here. Again, visually compare the changes. This will not be very easy, but it can be done. Good luck, Craig :) Quote Happy Coding! Craig Garrison Sr Anything worth having, is worth working for. Multi Vendor Shipping V1.1 Demo Catalog 3 Vendors, each category, "buy" a product from each category to see how MVS works during checkout. Multi Vendor Shipping V1.1 Demo Admin login: [email protected] pass: mvs_demo MVS Thread: Multi-Vendor Shipping My contribs: Download Multi Vendor Shipping V1.1 Vendor Email Vendor Info in easypopulate EZ Price Updater And more to come! Link to comment Share on other sites More sharing options...
spicyshop Posted July 10, 2006 Share Posted July 10, 2006 I'm trying to add the italian shipping method to vendors shipping... Which lines of code I must change? there's a method to use the old shipping method previously installed? Thanks, Max Quote Link to comment Share on other sites More sharing options...
iofast Posted July 10, 2006 Share Posted July 10, 2006 I haven't had time to read through this entire thread but I was able to gather enough to install MVS1.1 on my already pretty well modified 2.2MS2 setup. I made a small list of corrections to the manual install instructions that I will clean up and post later tonight if anyone is interested. I am curious about something though. If all of my vendors/warehouses use the same shipping method, for example they all support UPS Ground, 3DS, 2DA,etc; and that is all I wish to offer, is there a simple method to display only one set of shipping values with the combined total of UPS ground, 3DS, 2DA from my multiple vendors. I am worried customers will be confused by the checkout process in the event that they order from more than one vendor and would like to make it as simple as possible. Also, this would force them to use the same method for each vendor making my life a lot easier. I appreciate all of the great work on this project. I think it is a big step for osCommerce! Quote Link to comment Share on other sites More sharing options...
blucollarguy Posted July 11, 2006 Author Share Posted July 11, 2006 I'm trying to add the italian shipping method to vendors shipping... Which lines of code I must change? there's a method to use the old shipping method previously installed? Thanks, Max There are some instructions about modifying shipping modules included in the package. Take a look and give it a go, if you run into any problems. post the section of code you are having trouble with and what the error is and we will try to help you with it. Good luck, Craig :) I haven't had time to read through this entire thread but I was able to gather enough to install MVS1.1 on my already pretty well modified 2.2MS2 setup. I made a small list of corrections to the manual install instructions that I will clean up and post later tonight if anyone is interested. I am curious about something though. If all of my vendors/warehouses use the same shipping method, for example they all support UPS Ground, 3DS, 2DA,etc; and that is all I wish to offer, is there a simple method to display only one set of shipping values with the combined total of UPS ground, 3DS, 2DA from my multiple vendors. I am worried customers will be confused by the checkout process in the event that they order from more than one vendor and would like to make it as simple as possible. Also, this would force them to use the same method for each vendor making my life a lot easier. I appreciate all of the great work on this project. I think it is a big step for osCommerce! I appreciate any input for the instructions, they are very difficult to keep up with. The ability to offer a compiled quote is an option we considered adding to MVS but have not done it yet. It would require a fair amount of planning and code work to get thru it and display all the correct prices with the options available prooerly. A good bit of work. If you want to try to tackle yourself, we would certainly be willing to help. Good luck with whatever you decide to do, Craig :) Quote Happy Coding! Craig Garrison Sr Anything worth having, is worth working for. Multi Vendor Shipping V1.1 Demo Catalog 3 Vendors, each category, "buy" a product from each category to see how MVS works during checkout. Multi Vendor Shipping V1.1 Demo Admin login: [email protected] pass: mvs_demo MVS Thread: Multi-Vendor Shipping My contribs: Download Multi Vendor Shipping V1.1 Vendor Email Vendor Info in easypopulate EZ Price Updater And more to come! Link to comment Share on other sites More sharing options...
iofast Posted July 11, 2006 Share Posted July 11, 2006 I appreciate any input for the instructions, they are very difficult to keep up with. The ability to offer a compiled quote is an option we considered adding to MVS but have not done it yet. It would require a fair amount of planning and code work to get thru it and display all the correct prices with the options available prooerly. A good bit of work. If you want to try to tackle yourself, we would certainly be willing to help. Good luck with whatever you decide to do, Craig :) Sorry guys I got home tonight and had a pipe to my A/C frozen with about 1/2inch of ice on it. I'm guessing a freon leak. Fun! Anyhow I have been dealing wiht that all night and will try to get those modifications live tomorrow. I may consider writing some of the code Craig. I only have time to really toy around with code on weekends so maybe this weekend if I have a lot of time to kill I will sit down and start to test some stuff out. I was thinking there has to be an easy hack to do it - maybe not the cleanest and best solution but for a one time thing it might not be so bad. I'd imagine there is some loop being called at the checkout shipping page that could be modified a bit to combine allthe shipping quotes into 1 price per option. Well I am off to bed. Take it easy Quote Link to comment Share on other sites More sharing options...
spicyshop Posted July 11, 2006 Share Posted July 11, 2006 (edited) I'm trying to add the italian shipping method to vendors shipping... Which lines of code I must change? there's a method to use the old shipping method previously installed? Thanks, Max Here there is the script: <?php /* modulo di spedizione tramite PostaRaccomandata by hOZONE, [email protected], [url=http://hozone.cjb.net]http://hozone.cjb.net[/url] visita osCommerceITalia, [url=http://www.oscommerceitalia.com]http://www.oscommerceitalia.com[/url] derivato dal modulo: $Id: zones.php,v 1.20 2003/06/15 19:48:09 thomasamoulton Exp $ osCommerce, Open Source E-Commerce Solutions [url=http://www.oscommerce.com]http://www.oscommerce.com[/url] Copyright ? 2003 osCommerce Released under the GNU General Public License */ class postepostaraccomandata { var $code, $title, $description, $enabled, $num_zones; // class constructor function postepostaraccomandata() { $this->code = 'postepostaraccomandata'; $this->title = MODULE_SHIPPING_POSTEPOSTARACCOMANDATA_TEXT_TITLE; $this->description = MODULE_SHIPPING_POSTEPOSTARACCOMANDATA_TEXT_DESCRIPTION; $this->sort_order = MODULE_SHIPPING_POSTEPOSTARACCOMANDATA_SORT_ORDER; $this->icon = ''; $this->tax_class = MODULE_SHIPPING_POSTEPOSTARACCOMANDATA_TAX_CLASS; $this->enabled = ((MODULE_SHIPPING_POSTEPOSTARACCOMANDATA_STATUS == 'True') ? true : false); // CUSTOMIZE THIS SETTING FOR THE NUMBER OF POSTEPOSTARACCOMANDATA NEEDED $this->num_zones = 3; } // class methods function quote($method = '') { global $order, $shipping_weight, $shipping_num_boxes; $dest_country = $order->delivery['country']['iso_code_2']; $dest_zone = 0; $error = false; for ($i=1; $i<=$this->num_zones; $i++) { $countries_table = constant('MODULE_SHIPPING_POSTEPOSTARACCOMANDATA_COUNTRIES_' . $i); $country_zones = split("[,]", $countries_table); if (in_array($dest_country, $country_zones)) { $dest_zone = $i; break; } } //Added to select default country if not in listing if ($dest_zone == 0) { for ($i=1; $i<=$this->num_zones; $i++) { $countries_table = constant('MODULE_SHIPPING_POSTEPOSTARACCOMANDATA_COUNTRIES_' . $i); $country_zones = split("[,]", $countries_table); if (in_array("*", $country_zones)) { $dest_zone = $i; break; } } } if ($dest_zone == 0) { $error = true; $error_text = MODULE_SHIPPING_POSTEPOSTARACCOMANDATA_INVALID_ZONE; } else { $shipping = -1; $postepostaraccomandata_cost = constant('MODULE_SHIPPING_POSTEPOSTARACCOMANDATA_COST_' . $dest_zone); $postepostaraccomandata_table = split("[:,]" , $postepostaraccomandata_cost); $size = sizeof($postepostaraccomandata_table); for ($i=0; $i<$size; $i+=2) { if ($shipping_weight <= $postepostaraccomandata_table[$i]) { $shipping = $postepostaraccomandata_table[$i+1]; $shipping_method = MODULE_SHIPPING_POSTEPOSTARACCOMANDATA_TEXT_WAY; break; } } if ($shipping == -1) { $shipping_cost = 0; $error = true; $error_text = MODULE_SHIPPING_POSTEPOSTARACCOMANDATA_UNDEFINED_RATE; } else { $shipping_cost = ($shipping * $shipping_num_boxes) + constant('MODULE_SHIPPING_POSTEPOSTARACCOMANDATA_HANDLING_' . $dest_zone); } } $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_POSTEPOSTARACCOMANDATA_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => $shipping_method, 'cost' => $shipping_cost))); if ($this->tax_class > 0) { $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); } if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title); if ($error == true) $this->quotes['error'] = $error_text; return $this->quotes; } function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_POSTEPOSTARACCOMANDATA_STATUS'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; } function install() { tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Enable PostaRaccomandata Method', 'MODULE_SHIPPING_POSTEPOSTARACCOMANDATA_STATUS', 'True', 'Do you want to offer zone rate shipping?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_POSTEPOSTARACCOMANDATA_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_POSTEPOSTARACCOMANDATA_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())"); for ($i = 1; $i <= $this->num_zones; $i++) { $default_countries = ''; if ($i == 1) { //europa (zona 1) $default_countries = 'FX,ES,GI,MC,BG,CH,HU,PL,CZ,VA,IT,AL,RU,FO,LT,AT,SI,GE,MT,BE,SJ,GR,NL,HR,UA,I S,PT,DK,YU,LV,AD,SM,FI,LU,AZ,GS,DE,MD,BA,SE,GL,NO,CY,GB,IE,RO,EE,LI,AM,SK,FR,MK,B Y'; $shipping_table = '0.02:2.58,0.1:2.94,0.349:3.72,1:5.78,2:8.37'; } if ($i == 2) { //oceania (zona 3) $default_countries = 'NZ,AU,HM,MP,FJ,PN,KI,TK,NR,VU,AS,NU,CC,PW,PF,WS,MH,TO,NC,WF,AQ,NF,CK,PG,GU,S B,FM,TV'; $shipping_table = '0.02:3.69,0.1:3.41,0.349:4.75,1:6.30,2:9.40'; } if ($i == 3) { //altri paesi (zona 2) $default_countries = '*'; $shipping_table = '0.02:2.69,0.1:3.20,0.349:4.49,1:6.04,2:8.88'; } tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " . $i ." Countries', 'MODULE_SHIPPING_POSTEPOSTARACCOMANDATA_COUNTRIES_" . $i ."', '" . $default_countries . "', 'Comma separated list of two character ISO country codes that are part of Zone " . $i . ".', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " . $i ." Shipping Table', 'MODULE_SHIPPING_POSTEPOSTARACCOMANDATA_COST_" . $i ."', '" . $shipping_table . "', 'Shipping rates to Zone " . $i . " destinations based on a group of maximum order weights. Example: 3:8.50,7:10.50,... Weights less than or equal to 3 would cost 8.50 for Zone " . $i . " destinations.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " . $i ." Handling Fee', 'MODULE_SHIPPING_POSTEPOSTARACCOMANDATA_HANDLING_" . $i."', '0', 'Handling Fee for this shipping zone', '6', '0', now())"); } } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { $keys = array('MODULE_SHIPPING_POSTEPOSTARACCOMANDATA_STATUS', 'MODULE_SHIPPING_POSTEPOSTARACCOMANDATA_TAX_CLASS', 'MODULE_SHIPPING_POSTEPOSTARACCOMANDATA_SORT_ORDER'); for ($i=1; $i<=$this->num_zones; $i++) { $keys[] = 'MODULE_SHIPPING_POSTEPOSTARACCOMANDATA_COUNTRIES_' . $i; $keys[] = 'MODULE_SHIPPING_POSTEPOSTARACCOMANDATA_COST_' . $i; $keys[] = 'MODULE_SHIPPING_POSTEPOSTARACCOMANDATA_HANDLING_' . $i; } return $keys; } } ?> Edited July 11, 2006 by spicyshop Quote Link to comment Share on other sites More sharing options...
UncleSteve Posted July 13, 2006 Share Posted July 13, 2006 Hi, I'm struggling to change a bit of code in catalog/checkout_process.php // lets start with the email confirmation EMAIL_TEXT_GREETING . $email_order = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n"; if ($order->info['comments']) { The above is almost at the bottom of the page. I have defined - EMAIL_TEXT_GREETING in another file, as something like "welcome to" EMAIL_TEXT_ORDER_NUMBER as "Purchase Order Number" I was hoping the email sent to the customer would appear as Welcome to My Store------------------------------------------------------ Purchase Order Number: 202 Detailed Invoice: https://mystore.com/store/account_history_i...hp?order_id=202 Date Ordered: Thursday 13 July, 2006 Products However, I have found the "Welcome to" does not appear. What can I do to make good? If I insert EMAIL_TEXT_GREETING after $email_order = STORE_NAME . "\n" . It will appear, so it needs something before it to appear. I would also like to change "Date Ordered: Thursday 13 July, 2006" to display the time as well. How can I do that? The url used to be displayed as a blue underline hyperlink, its now just plain text. Any ideas what I may have done to cause the loss of the hyperlink? Rather than say what I need to do with the above, as you'll shot straight over my head :( can you give an example please? Thanks in advance for any help and guidence :) Quote ____________________________________________________________________ ____________________________________________________________________ Link to comment Share on other sites More sharing options...
lisa65 Posted July 13, 2006 Share Posted July 13, 2006 Hello, With MVS installed I have set up table rate shipping based on price and it's not calcutating it correctly. I have a product that's $50 and I have the table rate set to calculate by price. When I order 5 of the $50 product which totals $250 it only adds $10 shipping to the total shipping cost where it should be adding $30. Any ideas? Table Rate Enable Table Method True Shipping Table 100:10,200:20,300:30,400:40,500:50,600:60,700:70,800:80,900:90,1000:100,1100:110 ,1200:120,1300:130 Table Method price Handling Fee 0 Tax Class Taxable Goods Shipping Zone --none-- Sort Order 0 Quote Link to comment Share on other sites More sharing options...
UncleSteve Posted July 13, 2006 Share Posted July 13, 2006 Hi Lisa. I'm not expert, but have you checked for something like tare settings perhaps? If the shipping cost is always out by say ?10, this would probably indicate there is a setting to change somewhere. Sorry I can't help any further. Steve Quote ____________________________________________________________________ ____________________________________________________________________ Link to comment Share on other sites More sharing options...
UncleSteve Posted July 13, 2006 Share Posted July 13, 2006 Hi Lisa. I'm not expert, but have you checked for something like tare settings perhaps? If the shipping cost is always out by say ?10, this would probably indicate there is a setting to change somewhere. Sorry I can't help any further. Steve Quote ____________________________________________________________________ ____________________________________________________________________ Link to comment Share on other sites More sharing options...
UncleSteve Posted July 13, 2006 Share Posted July 13, 2006 Hi Lisa. I'm not expert, but have you checked for something like tare settings perhaps? If the shipping cost is always out by say ?10, this would probably indicate there is a setting to change somewhere. Sorry I can't help any further. Steve Quote ____________________________________________________________________ ____________________________________________________________________ Link to comment Share on other sites More sharing options...
♥kymation Posted July 13, 2006 Share Posted July 13, 2006 Hello, With MVS installed I have set up table rate shipping based on price and it's not calcutating it correctly. I have a product that's $50 and I have the table rate set to calculate by price. When I order 5 of the $50 product which totals $250 it only adds $10 shipping to the total shipping cost where it should be adding $30. Any ideas? <snipped> There's a bug in the Table module. Find this code in catalog/includes/modules/vendors_shipping/table.php (line 98) if (@constant('MODULE_SHIPPING_TABLE_MODE_' . $vendors_id) == 'price') { $order_total = $shipping_cost; } else { $order_total = $shipping_weight; } and change it to this: if (@constant('MODULE_SHIPPING_TABLE2_MODE_' . $vendors_id) == 'price') { $order_total = $cart->vendor_shipping[$vendors_id]['cost']; } else { $order_total = $cart->vendor_shipping[$vendors_id]['weight']; } That should fix the problem. If not, please let us know. Craig is working on another release, but he's buried in work right now. Regards Jim Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
UncleSteve Posted July 13, 2006 Share Posted July 13, 2006 Gawd knows what happened there! Suppose that's what happens when bb goes on the blink, then have to use dial-up :( Quote ____________________________________________________________________ ____________________________________________________________________ Link to comment Share on other sites More sharing options...
lisa65 Posted July 13, 2006 Share Posted July 13, 2006 There's a bug in the Table module. Find this code in catalog/includes/modules/vendors_shipping/table.php (line 98) if (@constant('MODULE_SHIPPING_TABLE_MODE_' . $vendors_id) == 'price') { $order_total = $shipping_cost; } else { $order_total = $shipping_weight; } and change it to this: if (@constant('MODULE_SHIPPING_TABLE2_MODE_' . $vendors_id) == 'price') { $order_total = $cart->vendor_shipping[$vendors_id]['cost']; } else { $order_total = $cart->vendor_shipping[$vendors_id]['weight']; } That should fix the problem. If not, please let us know. Craig is working on another release, but he's buried in work right now. Regards Jim Well, that gave me some hope but it didn't fix the problem. Sorry. Thanks for the try. It seems to be working from the products price rather than the order total from that vender. Lisa Quote Link to comment Share on other sites More sharing options...
♥kymation Posted July 13, 2006 Share Posted July 13, 2006 Well, that gave me some hope but it didn't fix the problem. Sorry. Thanks for the try. It seems to be working from the products price rather than the order total from that vender. Lisa I just tested this using the table that you posted. It works fine on my test site. The data here comes from the Shopping Cart class (catalog/includes/classes/shopping_cart.php). That gets the data from the database. If your database is recording the quantities in an order correctly, then I would look at that class file. Regards Jim Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
lisa65 Posted July 13, 2006 Share Posted July 13, 2006 What should I look for in this file or should I just delete my test cart and start over? Should I have one of you guys look at the shopping_cart.php file before I start over? I am not a programmer and this is my first time implementing a shopping cart but I have never had this much trouble tweaking code before. I had no idea it would take so long to get a shopping cart going. I just want to get through this testing process so I can get my site up and running. I appreciate your help. Lisa Quote Link to comment Share on other sites More sharing options...
♥kymation Posted July 13, 2006 Share Posted July 13, 2006 What should I look for in this file or should I just delete my test cart and start over? Should I have one of you guys look at the shopping_cart.php file before I start over? I am not a programmer and this is my first time implementing a shopping cart but I have never had this much trouble tweaking code before. I had no idea it would take so long to get a shopping cart going. I just want to get through this testing process so I can get my site up and running. I appreciate your help. Lisa Check your version of the file against the one from MVS 1.1. If you haven't made any other changes to this file, just overwrite yours with the stock MVS file. Backup your file first, of course. If that doesn't do it, put the following code in the top of checkout_shipping.php, just above the HTML section: print "<b>Vendor Shipping: </b>\n"; print '<pre>'; print_r ($cart->vendor_shipping); print '</pre>'; That will display the data array that is being used by the shipping module. There is an example of what this should look like in catalog/includes/classes/shopping_cart.php (line 262.) Check that the [cost] field is correct for each vendor. If it is, you have an error in your Table module. If the cost is incorrect the error is in the Shopping Cart class or in the database. Regards Jim Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
lisa65 Posted July 14, 2006 Share Posted July 14, 2006 Jim, I ordered 5 of a $50 product that = $250. I am still only getting a shipping charge of $10 where it should be $20. I have the table method set to price. Is there a setting or something that I am missing? Below is what the code printed. Array ( [1] => Array ( [weight] => 0 [cost] => 250 [qty] => 5 [products_id] => Array ( [0] => 28 ) ) ) Quote Link to comment Share on other sites More sharing options...
lisa65 Posted July 14, 2006 Share Posted July 14, 2006 I changed the weight field to the price and it charged the right amount of shipping. Is this what I needed to do? I sure hope so because it sure worked. Lisa Quote Link to comment Share on other sites More sharing options...
♥kymation Posted July 14, 2006 Share Posted July 14, 2006 I changed the weight field to the price and it charged the right amount of shipping. Is this what I needed to do? I sure hope so because it sure worked. Lisa That's correct. Glad that you found the problem. Regards Jim Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
UncleSteve Posted July 14, 2006 Share Posted July 14, 2006 Hi, I'm struggling to change a bit of code in catalog/checkout_process.php // lets start with the email confirmation EMAIL_TEXT_GREETING . $email_order = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n"; if ($order->info['comments']) { The above is almost at the bottom of the page. I have defined - EMAIL_TEXT_GREETING in another file, as something like "welcome to" EMAIL_TEXT_ORDER_NUMBER as "Purchase Order Number" I was hoping the email sent to the customer would appear as Welcome to My Store------------------------------------------------------ Purchase Order Number: 202 Detailed Invoice: https://mystore.com/store/account_history_i...hp?order_id=202 However, I have found the "Welcome to" does not appear. What can I do to make good? If I insert EMAIL_TEXT_GREETING after $email_order = STORE_NAME . "\n" . It will appear, so it needs something before it to appear. The url used to be displayed as a blue underline hyperlink, its now just plain text. Any ideas what I may have done to cause the loss of the hyperlink? I've now sorted parts of my original question :) (snipped from above) I'm still stuck with getting some text to appear before $email_order = STORE_NAME . "\n" . It still won't appear in the email. Can any one give me a hand please? Quote ____________________________________________________________________ ____________________________________________________________________ Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.