Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

yufonb

Members
  • Posts

    8
  • Joined

  • Last visited

  • Days Won

    1

yufonb last won the day on March 22 2022

yufonb had the most liked content!

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

yufonb's Achievements

  1. Is it possible to migrate this addon from card-element to payment-element? To my understanding this will increase more payment options other than just credit cards, e.g. apple pay/google pay. I have been reading this: https://stripe.com/docs/payments/payment-element/migration and tried to make some tweaks to this addon but I can't it to work.
  2. Had the same problem, worked after paypal.com.crt update.
  3. Hi @raiwa, I redid the whole thing, looks like I made some mistakes combining the QTPro module and Wholesale module. Now everything works fine, Thank you very much for your time.
  4. Hello @raiwa, I am developing this site with Phoenix 1.0.4.0 with QTpro Phoenix 6.0.1 When I tried to Add to Cart (any items with options) using single_dropdown or single_radioset display plugin, the items does not appear in the cart. Add to Cart worked correctly using multiple_dropdowns and sequenced_dropdowns. It also worked with item without options. Is this compatibility issue? Any idea how to resolve this or where to look at? Thank you in advance.
  5. Hi @raiwa, Work like a charm, thanks for the help. For anyone who want to change the look of the 'ugly' radio button to a responsive button, here is my code and css. You can adapt it to probably any radio field if you are technical. a<?php /* $Id: cm_sc_shipping.php $Loc: catalog/includes/modules/content/shopping_cart/ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Shipping Estimator 4.3 BS by @raiwa [email protected] www.oscaddons.com Original version: Edwin Bekaert ([email protected]) Justin Baldwin Linda McGrath ([email protected]) Copyright (c) 2016 osCommerce Released under the GNU General Public License */ class cm_sc_shipping { var $code; var $group; var $title; var $description; var $sort_order; var $enabled = false; function __construct() { $this->code = get_class($this); $this->group = basename(dirname(__FILE__)); $this->title = MODULE_CONTENT_SC_SHIPPING_TITLE; $this->description = MODULE_CONTENT_SC_SHIPPING_DESCRIPTION; $this->description .= '<div class="secWarning">' . MODULE_CONTENT_BOOTSTRAP_ROW_DESCRIPTION . '</div>'; if ( defined('MODULE_CONTENT_SC_SHIPPING_STATUS') ) { $this->sort_order = MODULE_CONTENT_SC_SHIPPING_SORT_ORDER; $this->enabled = (MODULE_CONTENT_SC_SHIPPING_STATUS == 'True'); } } function execute() { global $oscTemplate, $currencies, $currency, $request_type, $cart, $order, $total_count, $quotes, $method, $module, $shipping, $navigation, $cart_sid, $cart_country_id, $cart_zone, $cart_zip_code, $cart_address_id, $total_weight, $language, $customer_id, $sendto, $billto; $content_width = (int)MODULE_CONTENT_SC_SHIPPING_CONTENT_WIDTH; if (($cart->count_contents() > 0)) { $selected_shipping = null; // include the order class (uses the sendto !) if (!class_exists('order')) { require('includes/classes/order.php'); } $order = new order; if (tep_session_is_registered('customer_id')) { // user is logged in if (isset($_POST['address_id'])){ // user changed address $order->delivery = array(); $sendto = $_POST['address_id']; $addresses_query = tep_db_query("select address_book_id, entry_firstname as firstname, entry_lastname as lastname, entry_company, entry_street_address as street_address, entry_suburb as suburb, 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 address_book where customers_id = '" . $customer_id . "' and address_book_id = '" . $sendto . "'"); $addresses_array_changed = tep_db_fetch_array($addresses_query); $country_info = tep_get_countries($addresses_array_changed['country_id'],true); $order->delivery = array('name' => $addresses_array_changed['firstname'] . ' ' . $addresses_array_changed['lastname'], 'company' => $addresses_array_changed['entry_company'], 'street_address' => $addresses_array_changed['street_address'], 'postcode' => $addresses_array_changed['postcode'], 'suburb' => $addresses_array_changed['suburb'], 'city' => $addresses_array_changed['city'], 'country' => array('id' => $addresses_array_changed['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' => $addresses_array_changed['country_id'], 'state' => $addresses_array_changed['state'], 'zone_id' => $addresses_array_changed['zone_id'], 'format_id' => tep_get_address_format_id($addresses_array_changed['country_id'])); } elseif ( !tep_session_is_registered('sendto') ) { if ( tep_session_is_registered('cart_address_id') ) { // user once changed address $sendto = (isset($_POST['cart_address_id'])? $_POST['cart_address_id'] : null); } else { // first timer $sendto = (isset($_POST['customer_default_address_id'])? $_POST['customer_default_address_id'] : null); } } // set session now $cart_address_id = $sendto; tep_session_register('sendto'); tep_session_register('cart_address_id'); // set shipping to null ! multipickup changes address to store address... $shipping=''; } else { // user not logged in ! if ( isset($_POST['country_id']) ) { // country is selected $country_info = tep_get_countries($_POST['country_id'],true); $cache_state_prov_values = tep_db_fetch_array(tep_db_query("select zone_code from zones where zone_country_id = '" . $_POST['country_id'] . "' and zone_id = '" . $_POST['zone_id'] . "'")); $cache_state_prov_code = $cache_state_prov_values['zone_code']; $order->delivery = array(); $order->delivery = array('postcode' => (isset($_POST['zip_code'])? $_POST['zip_code'] : null), 'state' => $cache_state_prov_code, 'country' => array('id' => $_POST['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' => $_POST['country_id'], //add state zone_id 'zone_id' => $_POST['zone_id'], 'format_id' => tep_get_address_format_id($_POST['country_id'])); $cart_country_id = $_POST['country_id']; tep_session_register('cart_country_id'); //add state zone_id $cart_zone = isset($_POST['zone_id'])? $_POST['zone_id'] : null; tep_session_register('cart_zone'); $cart_zip_code = (isset($_POST['zip_code'])? $_POST['zip_code'] : null); 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(); $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), 'zone_id' => $cart_zone); } else { // first timer $cart_country_id = STORE_COUNTRY; $cart_zone = STORE_ZONE; $cart_zip_code = MODULE_CONTENT_SC_SHIPPING_DEFAULT_ZIP; tep_session_register('cart_country_id'); tep_session_register('cart_zone'); tep_session_register('cart_zip_code'); $country_info = tep_get_countries(STORE_COUNTRY,true); $order->delivery = array(); $order->delivery = array('postcode' => MODULE_CONTENT_SC_SHIPPING_DEFAULT_ZIP, '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($cart_country_id), 'zone_id' => STORE_ZONE); } // 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('includes/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('includes/languages/' . $language . '/modules/order_total/ot_shipping.php'); } } else { $free_shipping = false; } // begin shipping cost if( !$free_shipping && $cart->get_content_type() !== 'virtual' ) { if (isset($_POST['sid']) && tep_not_null($_POST['sid'])){ list($module, $method) = explode('_', $_POST['sid']); $cart_sid = $_POST['sid']; tep_session_register('cart_sid'); } elseif ( tep_session_is_registered('cart_sid') ) { list($module, $method) = explode('_', $cart_sid); } else { $module = null; $method = null; } if ( tep_not_null($module) && tep_not_null($shipping_modules->quote($method, $module)) ) { $selected_quote = $shipping_modules->quote($method, $module); if( isset($selected_quote[0]['error'])) { $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'] . (tep_not_null($selected_quote[0]['methods'][0]['title'])? ' (' . $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'] = MODULE_CONTENT_SC_SHIPPING_SHIPPING_METHOD_FREE_TEXT . ' ' . MODULE_CONTENT_SC_SHIPPING_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; if (!tep_session_is_registered('shipping')) tep_session_register('shipping'); // end of shipping cost // end free shipping based on order total $sc_order_shipping = '<div class="panel panel-default">'; $sc_order_shipping .= ' <div class="panel-heading">'; $sc_order_shipping .= ' <h3 class="panel-title">' . MODULE_CONTENT_SC_SHIPPING_MODULE_TITLE . '</h3>'; // BS panel heading $sc_order_shipping .= ' </div>'; $sc_order_shipping .= ' <div class="panel-body">'; $sc_order_shipping .= tep_draw_form('estimator', tep_href_link('shopping_cart.php', '', 'NONSSL'), 'post'); //'onSubmit="return check_form();"' $sc_order_shipping .= tep_draw_hidden_field('sid', $selected_shipping['id']); $sc_order_shipping .= ' <div class="row">'; if ( tep_session_is_registered('customer_id') ) { // logged in if ( MODULE_CONTENT_SC_SHIPPING_SHOWWT == 'True' ) { $showweight = '&nbsp;(' . $total_weight . '&nbsp;' . MODULE_CONTENT_SC_SHIPPING_WTUNIT . ')'; } if ( MODULE_CONTENT_SC_SHIPPING_SHOWIC == 'True' ) { $sc_order_shipping .= '<div class="col-sm-12">' . ($total_count == 1 ? ' <strong>' . MODULE_CONTENT_SC_SHIPPING_ITEM . '</strong>' : ' <strong>' . MODULE_CONTENT_SC_SHIPPING_ITEM . '</strong>') . '&nbsp;' . $total_count . ((isset($showweight))? $showweight : '') . '</div>'; } if ( $cart->get_content_type() != 'virtual' ) { $addresses_query = tep_db_query("select distinct address_book_id, entry_company as company, entry_street_address as street_address, entry_suburb as suburb, 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 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, ' ', ' ')); } $sc_order_shipping .= '<div class="col-sm-2 estimator-padding">' . MODULE_CONTENT_SC_SHIPPING_SHIPPING_METHOD_ADDRESS . '</div><div class="col-sm-10 estimator-padding">'. tep_draw_pull_down_menu('address_id', $addresses_array, $selected_address, 'onchange="return shipincart_submit(\'\');"') . '</div>'; } $sc_order_shipping .= '<div class="clearfix"></div>'; $sc_order_shipping .= '<div class="col-sm-2 estimator-padding"><strong>' . MODULE_CONTENT_SC_SHIPPING_SHIPPING_METHOD_TO .'</strong>' . '</div><div class="col-sm-6 estimator-padding">'. tep_address_format($order->delivery['format_id'], $order->delivery, 1, ' ', '<br>') . '</div><div class="col-sm-4 estimator-padding text-right">'. tep_draw_button(IMAGE_BUTTON_ADD_ADDRESS, 'fa fa-envelope', tep_href_link('checkout_shipping_address.php', '', 'SSL'), NULL, NULL, 'btn btn-info btn-xs' ) . '</div>'; } } else { // not logged in $navigation->set_snapshot(); $sc_order_shipping .= '<div class="col-sm-12">' . MODULE_CONTENT_SC_SHIPPING_SHIPPING_OPTIONS_LOGIN . tep_draw_button(MODULE_CONTENT_SC_SHIPPING_BUTTON_LOGIN, 'glyphicon glyphicon-log-in', tep_href_link('login.php'), 'btn-success btn-sm') . '</div>'; if( MODULE_CONTENT_SC_SHIPPING_SHOWIC == 'True' ) { $sc_order_shipping .= '<div class="col-sm-12 estimator-padding">' . ($total_count == 1 ? ' <strong>' . MODULE_CONTENT_SC_SHIPPING_ITEM . '</strong>' : ' <strong>' . MODULE_CONTENT_SC_SHIPPING_ITEM . '</strong>') . '&nbsp;' . $total_count . ((isset($showweight))? $showweight : '') . '</div>'; } if ( $cart->get_content_type() != 'virtual' ) { if ( MODULE_CONTENT_SC_SHIPPING_SHOWCDD == 'True' ) { $sc_order_shipping.= '<div class="form-group has-feedback">'; if ( MODULE_CONTENT_SC_SHIPPING_SHOWSDD == 'True' || MODULE_CONTENT_SC_SHIPPING_SHOWZDD == 'True' ) { $sc_order_shipping.= '<label for="inputCountry" class="control-label col-sm-4">' . ENTRY_COUNTRY . '</label>'; } else { $sc_order_shipping.= '<label for="inputCountry" class="control-label col-sm-4">' . ENTRY_COUNTRY . '</label>'; } $sc_order_shipping.= '<div class="col-sm-8">' . tep_get_country_list('country_id', $selected_country, 'id="inputCountry"') . '</div>'; $sc_order_shipping.= '</div>'; } else { $sc_order_shipping.= tep_draw_hidden_field('country_id', STORE_COUNTRY); } //add state zone_id $state_array[] = array('id' => '', 'text' => PULL_DOWN_DEFAULT); $state_query = tep_db_query("select zone_name, zone_id from 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 ( MODULE_CONTENT_SC_SHIPPING_SHOWSDD == 'True' && count($state_array) > 1) { $sc_order_shipping.= '<div class="form-group has-feedback">'; $sc_order_shipping.= '<label for="inputState" class="control-label col-sm-4">' . ENTRY_STATE . '</label>'; $sc_order_shipping.= '<div class="col-sm-8">' . tep_draw_pull_down_menu('zone_id', $state_array, (isset($_POST['zone_id'])? $_POST['zone_id'] : STORE_ZONE), 'id="inputState"') . '</div>'; $sc_order_shipping.= '</div>'; } else { $sc_order_shipping.= tep_draw_hidden_field('zone_id', STORE_ZONE); } if ( MODULE_CONTENT_SC_SHIPPING_SHOWZDD == 'True' ) { $sc_order_shipping.= '<div class="form-group has-feedback">'; $sc_order_shipping.= '<label for="inputZip" class="control-label col-sm-4">' . ENTRY_POST_CODE . '</label>'; $sc_order_shipping.= '<div class="col-sm-4">' . tep_draw_input_field('zip_code', (isset($_POST['zip_code'])? $_POST['zip_code'] : MODULE_CONTENT_SC_SHIPPING_DEFAULT_ZIP), 'id="inputZip"', 'text', true, 'class="form-control" style="width: 125px;"') . '</div>'; $sc_order_shipping.= '</div>'; if ( MODULE_CONTENT_SC_SHIPPING_SHOWUB == 'True' ) { $sc_order_shipping.='<div class="col-sm-4 text-right"><a class="btn btn-default" role="button" href="_" onclick="return shipincart_submit(\'\');"><i class="glyphicon glyphicon-refresh"></i>&nbsp;'. IMAGE_BUTTON_UPDATE . ' </a></div>'; } } else { if ( MODULE_CONTENT_SC_SHIPPING_SHOWUB == 'True' ) { $sc_order_shipping.='<div class="col-sm-12 text-right"><a class="btn btn-default" role="button" href="_" onclick="return shipincart_submit(\'\');"><i class="glyphicon glyphicon-refresh"></i>&nbsp;'. IMAGE_BUTTON_UPDATE . ' </a></div>'; } } } } $sc_order_shipping .= ' </div><br>'; $sc_order_shipping .= ' <div class="shippingradio">'; $sc_order_shipping .= ' <table class="table table-condensed table-hover"'; $at_least_one_quote_printed = false; if ( $cart->get_content_type() == 'virtual' ) { // virtual product-download $sc_order_shipping .= '<tr><td><i>' . MODULE_CONTENT_SC_SHIPPING_SHIPPING_METHOD_FREE_TEXT . ' ' . MODULE_CONTENT_SC_SHIPPING_SHIPPING_METHOD_ALL_DOWNLOADS . '</i></td></tr>'; $at_least_one_quote_printed = true; } elseif ( $free_shipping==1 ) { // order $total is free $sc_order_shipping.='<tr><td><i>' . sprintf(FREE_SHIPPING_DESCRIPTION, $currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)) . '</i></td></tr>'; } else { // shipping display if ( empty($quotes[0]['error']) || (!empty($quotes[1])&&empty($quotes[1]['error'])) ) { // added to Display Message when No Shipping Options are Available $at_least_one_quote_printed = false; } else { $sc_order_shipping .= '<tr><td>&nbsp;</td></tr>'; } $sc_order_shipping .= ' <tbody>'; if ( sizeof($quotes) ) { for ( $i=0, $n=sizeof($quotes); $i<$n; $i++ ) { if ( isset($quotes[$i]['methods']) && sizeof($quotes[$i]['methods'])==1 ) { // simple shipping method $thisquoteid = $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][0]['id']; $sc_order_shipping .= ''; if ( !empty($quotes[$i]['error']) ) { $sc_order_shipping .= '<tr><td>' . $quotes[$i]['module'] . '&nbsp;(' . $quotes[$i]['error'] . ')</td></tr>'; } else { if ( $selected_shipping['id'] == $thisquoteid) { $sc_order_shipping.='<tr class="success col-sm-6"><td class="col-sm-6" style="background-color:#fff;border-width: 2px" onclick="return shipincart_submit(\''.$thisquoteid.'\');">'; $sc_order_shipping.='<label class="RadioContainer">' . tep_draw_radio_field('', true, true) . '<a href="_" title="' . MODULE_CONTENT_SC_SHIPPING_SELECT_THIS_METHOD .'">&nbsp;<strong>' . $quotes[$i]['module'] . '</strong></a>'; $sc_order_shipping.= (isset($quotes[$i]['icon']) && tep_not_null($quotes[$i]['icon']))? $quotes[$i]['icon'] : ''; $sc_order_shipping.= (tep_not_null($quotes[$i]['methods'][0]['title'])? '<div class="shippingcontent help-block"><hr>' . $quotes[$i]['methods'][0]['title'] . '<hr></div>': '' ); $sc_order_shipping.= '<div class="shippingamount"><span>' . $currencies->format(tep_add_tax($quotes[$i]['methods'][0]['cost'], ((!empty($quotes[$i]['tax']))? $quotes[$i]['tax'] : null ))) . '</span></div><span class="RadioCheckmark"></span></label></td></tr>'; } else { $sc_order_shipping.= '<tr class="col-sm-6"><td class="col-sm-6" style="background-color:#fff;border-width: 2px" onclick="return shipincart_submit(\''.$thisquoteid.'\');">' ; $sc_order_shipping.= '<label class="RadioContainer">'. tep_draw_radio_field('', false, false) . '<a href="_" title="' . MODULE_CONTENT_SC_SHIPPING_SELECT_THIS_METHOD . '">&nbsp;' . $quotes[$i]['module'] . '</a>'; $sc_order_shipping.= (isset($quotes[$i]['icon']) && tep_not_null($quotes[$i]['icon']))? $quotes[$i]['icon'] : ''; $sc_order_shipping.= (tep_not_null($quotes[$i]['methods'][0]['title'])? '<div class="shippingcontent help-block"><hr>' . $quotes[$i]['methods'][0]['title'] . '<hr></div>': '' ); $sc_order_shipping.= '<div class="shippingamount"><span>' . $currencies->format(tep_add_tax($quotes[$i]['methods'][0]['cost'], ((!empty($quotes[$i]['tax']))? $quotes[$i]['tax'] : null ))) . '</span></div><span class="RadioCheckmark"></span></label></td></tr>'; } } // added to Display Message when No Shipping Options are Available $at_least_one_quote_printed = true; } elseif ( isset($quotes[$i]['methods']) && sizeof($quotes[$i]['methods'])>1 ) { // 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']; $sc_order_shipping .= ''; if ( isset($quotes[$i]['error']) && $quotes[$i]['error'] == true ) { $sc_order_shipping .= '<tr><td>' . $quotes[$i]['module'] . '&nbsp;(' . $quotes[$i]['error'] . ')</td></tr>'; } else { if ( $selected_shipping['id'] == $thisquoteid ) { $sc_order_shipping.= '<tr class="success col-sm-6"><td class="col-sm-6" style="background-color:#fff;border-width: 2px" onclick="return shipincart_submit(\''.$thisquoteid.'\');">' ; $sc_order_shipping.= '<label class="RadioContainer">'. tep_draw_radio_field('', true, true) . '<a href="_" title="' . MODULE_CONTENT_SC_SHIPPING_SELECT_THIS_METHOD .'"><strong>' . $quotes[$i]['module'] . '</strong></a>'; $sc_order_shipping.= (isset($quotes[$i]['icon']) && tep_not_null($quotes[$i]['icon']))? $quotes[$i]['icon'] : ''; $sc_order_shipping.= (tep_not_null($quotes[$i]['methods'][$j]['title'])? '<div class="shippingcontent help-block"><hr>' . $quotes[$i]['methods'][$j]['title'] . '<hr></div>': '' ); $sc_order_shipping.= '<div class="shippingamount"><span>' . $currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], ((!empty($quotes[$i]['tax']))? $quotes[$i]['tax'] : null ))) . '</span></div><span class="RadioCheckmark"></span></label></td></tr>'; } else { $sc_order_shipping.= '<tr class="col-sm-6"><td class="col-sm-6" style="background-color:#fff;border-width: 2px" onclick="return shipincart_submit(\''.$thisquoteid.'\');">'; $sc_order_shipping.= '<label class="RadioContainer">'. tep_draw_radio_field('', false, false) . '<a href="_" title="' . MODULE_CONTENT_SC_SHIPPING_SELECT_THIS_METHOD . '">' . $quotes[$i]['module'] . '</a>'; $sc_order_shipping.= (isset($quotes[$i]['icon']) && tep_not_null($quotes[$i]['icon']))? $quotes[$i]['icon'] : ''; $sc_order_shipping.= (tep_not_null($quotes[$i]['methods'][$j]['title'])? '<div class="shippingcontent help-block"><hr>' . $quotes[$i]['methods'][$j]['title'] . '<hr></div>': '' ); $sc_order_shipping.= '<div class="shippingamount"><span>' . $currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], ((!empty($quotes[$i]['tax']))? $quotes[$i]['tax'] : null ))) . '</span></div><span class="RadioCheckmark"></span></label></td></tr>'; } } } // added to Display Message when No Shipping Options are Available $at_least_one_quote_printed = true; } } } // end if size of quotes } // end if not virtual // added to Display Message when No Shipping Options are Available if ( !$at_least_one_quote_printed ) { $sc_order_shipping .= '<tr><td class="text-center">' . MODULE_CONTENT_SC_SHIPPING_NO_OPTIONS_MESSAGE . '</td></tr>'; } $sc_order_shipping .= ' </tbody>'; $sc_order_shipping .= ' </table>'; $sc_order_shipping .= ' </div>'; $sc_order_shipping .= ' </form>'; $sc_order_shipping .= ' </div>'; // end body $sc_order_shipping .= '</div>'; //end panel tep_session_register('shipping'); ob_start(); include('includes/modules/content/' . $this->group . '/templates/tpl_' . basename(__FILE__)); $template = ob_get_clean(); $oscTemplate->addContent($template, $this->group); $script = <<<EOL <script> function shipincart_submit(sid){ if(sid){ document.estimator.sid.value=sid; } document.estimator.submit(); return false; } </script> EOL; $oscTemplate->addBlock($script, 'footer_scripts'); } // Use only when cart_contents > 0 } function isEnabled() { return $this->enabled; } function check() { return defined('MODULE_CONTENT_SC_SHIPPING_STATUS'); } function install() { tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Shipping Estimator Module', 'MODULE_CONTENT_SC_SHIPPING_STATUS', 'True', 'Do you want to add the module to your shop?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Width', 'MODULE_CONTENT_SC_SHIPPING_CONTENT_WIDTH', '12', 'What width container should the content be shown in?', '6', '2', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now())"); tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_CONTENT_SC_SHIPPING_SORT_ORDER', '400', 'Sort order of display. Lowest is displayed first.', '6', '3', now())"); tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display item count', 'MODULE_CONTENT_SC_SHIPPING_SHOWIC', 'True', 'Display item count?', '6', '4', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display shipping weight', 'MODULE_CONTENT_SC_SHIPPING_SHOWWT', 'True', 'Display shipping weight?', '6', '5', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Shipping weight unit', 'MODULE_CONTENT_SC_SHIPPING_WTUNIT', 'lbs', 'Shipping weight unit.', '6', '6', now())"); tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display Country drop-down menu', 'MODULE_CONTENT_SC_SHIPPING_SHOWCDD', 'True', 'Display Country drop-down menu?', '6', '7', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display State drop-down menu', 'MODULE_CONTENT_SC_SHIPPING_SHOWSDD', 'False', 'Display State drop-down menu?', '6', '8', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display Zip Code Input Field', 'MODULE_CONTENT_SC_SHIPPING_SHOWZDD', 'False', 'Display Zip Code drop-down menu?', '6', '9', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Default ZIP', 'MODULE_CONTENT_SC_SHIPPING_DEFAULT_ZIP', '', 'The dafault Zip Code to show for first time load if \"Display Zip Code\" is enabled.', '6', '10', now())"); tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display Update button', 'MODULE_CONTENT_SC_SHIPPING_SHOWUB', 'True', 'Display Update button?', '6', '11', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); } function remove() { tep_db_query("delete from configuration where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_CONTENT_SC_SHIPPING_STATUS', 'MODULE_CONTENT_SC_SHIPPING_CONTENT_WIDTH', 'MODULE_CONTENT_SC_SHIPPING_SORT_ORDER', 'MODULE_CONTENT_SC_SHIPPING_SHOWIC', 'MODULE_CONTENT_SC_SHIPPING_SHOWWT', 'MODULE_CONTENT_SC_SHIPPING_WTUNIT', 'MODULE_CONTENT_SC_SHIPPING_SHOWCDD', 'MODULE_CONTENT_SC_SHIPPING_SHOWSDD', 'MODULE_CONTENT_SC_SHIPPING_SHOWZDD', 'MODULE_CONTENT_SC_SHIPPING_DEFAULT_ZIP', 'MODULE_CONTENT_SC_SHIPPING_SHOWUB'); } } .shippingradio table { border-collapse: separate; border-spacing: 0px 5px; } .shippingradio td{ border: solid 2px #ddd; border-radius: 10px; padding: 5px 10px 5px 10px; } .shippingradio td:hover { border: solid 2px #999; transition: border 0.5s ease-in; } .shippingradio tr.success > td{ border: solid 2px #F00; transition: border 0.5s ease-in; } .shippingamount span{ color:#333; } .shippingradio tr.success>td>label>div.shippingamount>span{ color:#F00; } .shippingcollapsible { color: #333; cursor: pointer; padding-right: 10px; border: none; outline: none; } .shippingcontent { padding: 0 18px; max-height: 0; overflow: hidden; transition: max-height 0.5s ease-out; } .shippingradio tr.success>td>label>div.shippingcontent { max-height:100%; transition: max-height 0.5s ease-out; }
  6. Hi, thank you for this addon. I use MultiGeoZone MultiTable Shipping(MZMT) (https://apps.oscommerce.com/osvz6&amp;multigeozone-multitable-shipping&amp;c=shipping) There is 2 table (i.e. 2 methods) under MZMT. I am having a problem. Scenario1: With cm_sc_shipping.php installed, and MZMT is the only shipping module the cheapest method is selected by default. When i tried to select the other method, the page is redirected, but sill the cheapest method is the selected method. I checked the $thisquoteid should be correct which is mzmt_table1 and mzmt_table2 respectively, hence onclick="return shipincart_submit(\''.$thisquoteid.'\');" (line392/397 of cm_sc_shipping.php) should be correct. Scenario2: With cm_sc_shipping.php installed, and MZMT plus any shipping method (discount etc) The selection works fine (i.e. correct module is selected after redirect) Other shipping methods (discount, table etc) work fine too. To sum it: If MZMT is the only shipping module available, the selection does not work. MZMT is the only shipping method that I used that has 2 methods. Any idea where i should look to solve this problem. Attached MZMT module. <?php /* $Id: mzmt.php, v2.1a 20140125 Kymation Exp $ $Portions From: mzmt.php,v 1.000 2004-10-29 Josh Dechant Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2014 osCommerce Protions Copyright (c) 2004 Josh Dechant Released under the GNU General Public License */ class mzmt { var $version = '2.1a'; var $code = ''; var $title = ''; var $description = ''; var $icon = ''; var $enabled = false; var $num_tables = 0; var $num_geozones = 0; var $delivery_geozone = 0; var $geozone_mode = 'weight'; var $order_total = 0; var $languages_array = array(); var $quotes = array(); //// // Set up all of the default values available at this time function mzmt() { global $order; $this->code = 'mzmt'; $this->sort_order = @MODULE_SHIPPING_MZMT_SORT_ORDER; $this->tax_class = @MODULE_SHIPPING_MZMT_TAX_CLASS; $this->enabled = ( ( @MODULE_SHIPPING_MZMT_STATUS == 'True' ) ? true : false ); // When the language file has been included if( defined( 'MODULE_SHIPPING_MZMT_TEXT_TITLE' ) ) { $this->title = MODULE_SHIPPING_MZMT_TEXT_TITLE; $this->description = MODULE_SHIPPING_MZMT_TEXT_DESCRIPTION; } // Second pass and later, when the number of geo zones and tables have been set if( defined( 'MODULE_SHIPPING_MZMT_NUMBER_GEOZONES' ) ) { $this->num_geozones = MODULE_SHIPPING_MZMT_NUMBER_GEOZONES; $this->num_tables = MODULE_SHIPPING_MZMT_NUMBER_TABLES; if ($this->enabled == true) { $this->enabled = false; for($n = 1; $n <= $this->num_geozones; $n ++) { if ((( int ) constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $n . '_ID' ) > 0) && (( int ) constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $n . '_ID' ) == $this->getGeoZoneID ( $order->delivery ['country'] ['id'], $order->delivery ['zone_id'] ))) { $this->enabled = true; $this->delivery_geozone = $n; break; } elseif ((( int ) constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $n . '_ID' ) == 0) && ($n == ( int ) $this->num_geozones)) { $this->enabled = true; $this->delivery_geozone = $n; break; } } } } // Set the languages_array to the current store languages $this->get_languages(); } //// // Get a quote or all quotes for a geo zone function quote( $method = '' ) { global $order, $shipping_weight, $shipping_num_boxes, $language; $combined_quote_weight = $shipping_num_boxes * $shipping_weight; $weight_string = ''; if( tep_not_null( MODULE_SHIPPING_MZMT_WEIGHT_UNITS ) ) { $weight_string = ' (' . $combined_quote_weight . ' ' . MODULE_SHIPPING_MZMT_WEIGHT_UNITS . ')'; } $this->quotes = array ( 'id' => $this->code, 'module' => constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_TEXT_TITLE_' . strtoupper( $language ) ) . $weight_string, 'methods' => array () ); $this->determineTableMethod ( constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_MODE' ) ); if ( $method != '' ) { // Single quote $table_number = substr ( $method, 5 ); $shipping = $this->determineShipping ( preg_split ( "/[:,]/", constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_TABLE_' . $table_number ) ) ); $this->quotes ['methods'] [] = array ( 'id' => 'table' . $table_number, 'title' => constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_TABLE_' . $table_number . '_TEXT_WAY_' . strtoupper( $language ) ), 'cost' => $shipping + constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_HANDLING' ) ); } else { // All applicable quotes for( $table_number = 1; $table_number <= $this->num_tables; $table_number ++ ) { if (! tep_not_null ( constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_TABLE_' . $table_number ) )) continue; $shipping = $this->determineShipping ( preg_split ( "/[:,]/", constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_TABLE_' . $table_number ) ) ); $this->quotes ['methods'] [] = array ( 'id' => 'table' . $table_number, 'module' => constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_TABLE_' . $table_number . '_TEXT_WAY_' . strtoupper( $language ) ), 'title' => constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_TABLE_' . $table_number . '_TEXT_WAY_' . strtoupper( $language ) ), 'cost' => $shipping + constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_HANDLING' ) ); } } // If shipping is set as taxable, add the appropriate tax if ($this->tax_class > 0) { $this->quotes ['tax'] = tep_get_tax_rate ( $this->tax_class, $order->delivery ['country'] ['id'], $order->delivery ['zone_id'] ); } // Add the icon if there is one if (tep_not_null ( constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_ICON' ) )) $this->quotes ['icon'] = tep_image ( DIR_WS_ICONS . constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_ICON' ), $this->title ); return $this->quotes; } // function quote //// // Return the module status function check() { if (! isset ( $this->_check ) ) { $check_query = tep_db_query ( "select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_MZMT_STATUS'" ); $this->_check = tep_db_num_rows ( $check_query ); } return $this->_check; } //// // Second pass of the initial edit, or the Update box has been checked. // This method is executed by modified code in admin/modules.php // It adds the Configuration table entries for the number of // Zones and Tables set in the first pass, and modifies // existing entries to allow for later updates. function update( $vars_array ) { // Check that we are actually in the second stage install process or later if( ( is_array( $vars_array ) && array_key_exists( 'MODULE_SHIPPING_MZMT_NUMBER_GEOZONES', $vars_array ) && $vars_array['MODULE_SHIPPING_MZMT_NUMBER_GEOZONES'] > 0 && ( array_key_exists( 'MODULE_SHIPPING_MZMT_NUMBER_TABLES', $vars_array ) && $vars_array['MODULE_SHIPPING_MZMT_NUMBER_TABLES'] > 0 ) ) ) { $this->num_geozones = $vars_array['MODULE_SHIPPING_MZMT_NUMBER_GEOZONES']; $this->num_tables = $vars_array['MODULE_SHIPPING_MZMT_NUMBER_TABLES']; // Add, remove, or modify the database entries for the selected number of Zones/Tables $this->zones_tables( $vars_array ); // This part is only done on the second pass of the initial install if( $vars_array['MODULE_SHIPPING_MZMT_UPDATE_ZONES_TABLES'] != 'True' ) { // Modify these two entries to add an update warning message // Update must be run if the first two are changed as they make changes to the number of geo zones/tables $sql_data_array[] = array( 'configuration_key' => 'MODULE_SHIPPING_MZMT_NUMBER_GEOZONES', 'configuration_array' => array( 'configuration_description' => 'The number of shipping geo zones you want to use. ' . MODULE_SHIPPING_MZMT_UPDATE_WARNING ) ); $sql_data_array[] = array( 'configuration_key' => 'MODULE_SHIPPING_MZMT_NUMBER_TABLES', 'configuration_array' => array( 'configuration_description' => 'The number of shipping tables per geo zone. ' . MODULE_SHIPPING_MZMT_UPDATE_WARNING ) ); // Remove the second install message and replace it with the update checkbox $sql_data_array[] = array( 'configuration_key' => 'MODULE_SHIPPING_MZMT_UPDATE_ZONES_TABLES', 'configuration_array' => array( 'configuration_title' => 'Update', 'configuration_description' => 'Check if you want to change the number of geo zones or tables. <span style="color:red;"><b>WARNING:</b> This will remove all of the settings below.</span>', 'configuration_value' => '', 'set_function' => 'tep_cfg_mzmt_update( ', 'use_function' => '' ) ); // Use the above arrays to update the configuration table with the tables etc. foreach( $sql_data_array as $configuration_data ) { tep_db_perform( TABLE_CONFIGURATION, $configuration_data['configuration_array'], 'update', "configuration_key = '" . $configuration_data['configuration_key'] . "'"); } } // if( $vars_array } // if( array_key_exists } // function update //// // Update existing, add new, and/or remove unwanted zones/tables function zones_tables( $vars_array ) { // Check whether an update has been requested // This is always the case for the first pass if( ! array_key_exists( 'MODULE_SHIPPING_MZMT_UPDATE_ZONES_TABLES', $vars_array ) || ( array_key_exists( 'MODULE_SHIPPING_MZMT_UPDATE_ZONES_TABLES', $vars_array ) && $vars_array ['MODULE_SHIPPING_MZMT_UPDATE_ZONES_TABLES'] == 'True' ) ) { // loop an arbitrary number of times, breaking out when we are done for( $zone = 1; $zone < 999; $zone ++ ) { switch (true) { case (! array_key_exists ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_ID', $vars_array ) && $zone <= $this->num_geozones) : // If the Zone does not exist, and we have less than the selected number of zones, we add the Zone 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 ('<hr />Geo Zone " . $zone . "', 'MODULE_SHIPPING_MZMT_GEOZONE_" . $zone . "_ID', '', 'Enable this method for the following geo zone.', '6', '0', 'tep_get_zone_class_title', 'tep_cfg_pull_down_geozones(', now())" ); 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 ('Geo Zone " . $zone . " Table Mode', 'MODULE_SHIPPING_MZMT_GEOZONE_" . $zone . "_MODE', 'weight', 'The shipping cost is based on the total weight, total price, or total count of the items ordered.', '6', '0', 'tep_cfg_select_option(array(\'weight\', \'price\', \'count\'), ', now())" ); tep_db_query ( "insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Geo Zone " . $zone . " Table Icon', 'MODULE_SHIPPING_MZMT_GEOZONE_" . $zone . "_ICON', '', 'The icon of the shipping method. Leave blank if none.', '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 ('Geo Zone " . $zone . " Handling Fee', 'MODULE_SHIPPING_MZMT_GEOZONE_" . $zone . "_HANDLING', '0', 'Handling Fee for this geo zone.', '6', '0', now())" ); foreach ( $this->languages_array as $language ) { $lang = '_' . strtoupper ( $language ); $language_name = ucfirst ( $language ); tep_db_query ( "insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Geo Zone " . $zone . " Table Title in " . $language_name . "', 'MODULE_SHIPPING_MZMT_GEOZONE_" . $zone . "_TEXT_TITLE" . $lang . "', '', 'The title of the shipping method in " . $language_name . ".', '6', '0', now())" ); } // Update the tables for this zone $this->update_tables ( $vars_array, $zone ); break; case (array_key_exists ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_ID', $vars_array ) && $zone <= $this->num_geozones) : // The Zone data exists, and we are still within the selected number of zones, // so we just need to fix the Tables (if required) $this->update_tables ( $vars_array, $zone ); break; case (array_key_exists ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_ID', $vars_array ) && $zone > $this->num_geozones) : // The zone data exists and we no longer want it, so remove the entries tep_db_query ( "delete from " . TABLE_CONFIGURATION . " where configuration_key like 'MODULE_SHIPPING_MZMT_GEOZONE_" . $zone . "%'" ); $this->update_tables ( $vars_array, $zone ); break; default : case (! array_key_exists ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_ID', $vars_array ) && $zone > $this->num_geozones) : // The zone does not already exist and we do not need it. We're done here. // Break out of the loop and return. break 2; } } } } // function zones_tables //// // Update existing, add new, and/or remove unwanted tables // Done here so that we don't have to repeat this code multiple times in the zones_tables() method function update_tables( $vars_array, $zone ) { // loop an arbitrary number of times, breaking out when we are done for( $tables = 1; $tables < 999; $tables ++ ) { switch( true ) { case ( ! array_key_exists( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_TABLE_' . $tables, $vars_array ) && $tables <= $this->num_tables ) : // The table does not already exist and we need to create it tep_db_query ( "insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Geo Zone " . $zone . " Shipping Table " . $tables . "', 'MODULE_SHIPPING_MZMT_GEOZONE_" . $zone . "_TABLE_" . $tables . "', '', 'Shipping table " . $tables . " for this geo zone', '6', '0', now())" ); foreach( $this->languages_array as $language ) { $lang = '_' . strtoupper( $language ); $language_name = ucfirst( $language ); tep_db_query ( "insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Geo Zone " . $zone . " Shipping Table " . $tables . " Name', 'MODULE_SHIPPING_MZMT_GEOZONE_" . $zone . "_TABLE_" . $tables . "_TEXT_WAY" . $lang . "', '', 'Shipping table " . $tables . " name for this geo zone in " . $language_name . "', '6', '0', now())" ); } break; case ( array_key_exists( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_TABLE_' . $tables, $vars_array ) && $tables <= $this->num_tables ) : // The table already exists and we only need to update it // The normal update process handles this, so nothering to do here break; case ( array_key_exists( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_TABLE_' . $tables, $vars_array ) && $tables > $this->num_tables ) : // The table already exists and we no longer want it, so remove the entries tep_db_query ( "delete from " . TABLE_CONFIGURATION . " where configuration_key like 'MODULE_SHIPPING_MZMT_GEOZONE_" . $zone . "_TABLE_" . $tables . "%'" ); break; default : case ( ! array_key_exists( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_TABLE_' . $tables, $vars_array ) && $tables > $this->num_tables ) : // The table does not already exist and we do not need it. We're done here. // Break out of the loop and quit. break 2; } // switch( true ) } // for( $tables = 1 } // function update_tables //// // Initial install 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 ( 'Module Version', 'MODULE_SHIPPING_MZMT_VERSION', '" . $this->version . "', 'The version of this module that you are running', '6', '0', 'tep_cfg_disabled(', now() ) "); tep_db_query ( "insert into " . TABLE_CONFIGURATION . " ( configuration_key, configuration_group_id, sort_order, use_function, set_function ) values ( 'MODULE_SHIPPING_MZMT_LANGUAGE_FILE_TEST', '6', '0', 'tep_cfg_mzmt_language_file_check', 'tep_cfg_do_nothing(' ) "); tep_db_query ( "insert into " . TABLE_CONFIGURATION . " ( configuration_key, configuration_group_id, sort_order, use_function, set_function ) values ( 'MODULE_SHIPPING_MZMT_MODULE_MODS_TEST', '6', '0', 'tep_cfg_mzmt_modules_mod_test', 'tep_cfg_do_nothing(' ) "); 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 Multi-Geo Zone Multi-Table Shipping', 'MODULE_SHIPPING_MZMT_STATUS', 'True', 'Do you want to offer multi-region multi-table 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_MZMT_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 ('Prefix', 'MODULE_SHIPPING_MZMT_PREFIX', 'shp', 'Use only geo zones that start with this string. Leave blank to show all geo zones, including tax zones.', '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 ('Weight Units', 'MODULE_SHIPPING_MZMT_WEIGHT_UNITS', 'lbs.', 'Show these units after the weight. If blank, no weight will be shown.', '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 ('Sort Order', 'MODULE_SHIPPING_MZMT_SORT_ORDER', '0', 'Sort order of display.', '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 ('Number of Geo Zones', 'MODULE_SHIPPING_MZMT_NUMBER_GEOZONES', '0', 'The number of shipping geo zones you want to use.', '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 ('Number of Tables/Geo Zone', 'MODULE_SHIPPING_MZMT_NUMBER_TABLES', '0', 'The number of shipping tables per geo zone.', '6', '0', now())" ); tep_db_query ( "insert into " . TABLE_CONFIGURATION . " ( configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function ) values ( 'MODULE_SHIPPING_MZMT_UPDATE_ZONES_TABLES', 'True', '6', '0', 'tep_cfg_mzmt_warning_second_install', 'tep_cfg_do_nothing(' ) "); // The remaining configuration values will be added by the Update function once the numbers of geo zones and tables are known. } //// // Uninstall function remove() { tep_db_query ( "delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode ( "', '", $this->keys () ) . "')" ); } //// // Keys match the database configuration table's configuration_key field function keys() { $keys = array (); $keys [] = 'MODULE_SHIPPING_MZMT_VERSION'; $keys [] = 'MODULE_SHIPPING_MZMT_LANGUAGE_FILE_TEST'; $keys [] = 'MODULE_SHIPPING_MZMT_MODULE_MODS_TEST'; $keys [] = 'MODULE_SHIPPING_MZMT_STATUS'; $keys [] = 'MODULE_SHIPPING_MZMT_TAX_CLASS'; $keys [] = 'MODULE_SHIPPING_MZMT_PREFIX'; $keys [] = 'MODULE_SHIPPING_MZMT_WEIGHT_UNITS'; $keys [] = 'MODULE_SHIPPING_MZMT_SORT_ORDER' ; $keys [] = 'MODULE_SHIPPING_MZMT_NUMBER_GEOZONES'; $keys [] = 'MODULE_SHIPPING_MZMT_NUMBER_TABLES'; $keys [] = 'MODULE_SHIPPING_MZMT_UPDATE_ZONES_TABLES'; for( $zone = 1; $zone <= $this->num_geozones; $zone ++ ) { $keys [] = 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_ID'; $keys [] = 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_MODE'; $keys [] = 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_ICON'; foreach( $this->languages_array as $language ) { $lang = strtoupper( $language ); $keys [] = 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_TEXT_TITLE_' . $lang; } $keys [] = 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_HANDLING'; for( $tables = 1; $tables <= $this->num_tables; $tables ++ ) { $keys [] = 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_TABLE_' . $tables; foreach( $this->languages_array as $language ) { $lang = strtoupper( $language ); $keys [] = 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_TABLE_' . $tables . '_TEXT_WAY_' . $lang; } } } return $keys; } //// // Get an array of installed languages function get_languages() { if( !class_exists( 'language' ) ) { include_once DIR_WS_CLASSES . 'language.php'; } $language_class = new language; $languages = $language_class->catalog_languages; foreach( $languages as $this_language ) { $this->languages_array[$this_language['id']] = $this_language['directory']; } } //// // Set the correct order total value for the selected shipping basis function determineTableMethod($geozone_mode) { global $total_count, $shipping_weight; $this->geozone_mode = $geozone_mode; if ($this->geozone_mode == 'price') { $this->order_total = $_SESSION['cart']->show_total (); } elseif ($this->geozone_mode == 'count') { $this->order_total = $total_count; } else { $this->order_total = $shipping_weight; } return true; } //// // Return the shipping cost based on the table function determineShipping( $table_cost ) { global $shipping_num_boxes; for($i = 0, $n = sizeof ( $table_cost ); $i < $n; $i += 2) { if ($this->order_total >= $table_cost [$i]) { $shipping_factor = $table_cost [$i + 1]; } } if (substr_count ( $shipping_factor, '%' ) > 0) { $shipping = ((($this->order_total * 10) / 10) * ((str_replace ( '%', '', $shipping_factor )) / 100)); } else { $shipping = str_replace ( '$', '', $shipping_factor ); } if ($this->geozone_mode == 'weight') { $shipping = $shipping * $shipping_num_boxes; } return $shipping; } //// // Check if the current zone matches one of the geo zones we have set up here function getGeoZoneID( $country_id, $zone_id ) { // Set the SQL for thegeo zone prefix if any. $prefix_sql = ''; if( MODULE_SHIPPING_MZMT_PREFIX != '' ) { $prefix_sql = " and LOWER(gz.geo_zone_name) like '" . strtolower( MODULE_SHIPPING_MZMT_PREFIX ) . "%'"; } // Check for a Geo Zone that explicity includes the country & specific zone (useful for splitting countries with zones up) $zone_query = tep_db_query ( "select gz.geo_zone_id from " . TABLE_GEO_ZONES . " gz left join " . TABLE_ZONES_TO_GEO_ZONES . " ztgz on (gz.geo_zone_id = ztgz.geo_zone_id) where ztgz.zone_country_id = '" . ( int ) $country_id . "' and ztgz.zone_id = '" . ( int ) $zone_id . "'" . $prefix_sql ); if (tep_db_num_rows ( $zone_query )) { $zone = tep_db_fetch_array ( $zone_query ); return $zone ['geo_zone_id']; } else { // No luck… Now check for a Geo Zone for the country and "All Zones" of the country. $zone_query = tep_db_query ( "select gz.geo_zone_id from " . TABLE_GEO_ZONES . " gz left join " . TABLE_ZONES_TO_GEO_ZONES . " ztgz on (gz.geo_zone_id = ztgz.geo_zone_id) where ztgz.zone_country_id = '" . ( int ) $country_id . "' and (ztgz.zone_id = '0' or ztgz.zone_id is NULL)" . $prefix_sql ); if (tep_db_num_rows ( $zone_query )) { $zone = tep_db_fetch_array ( $zone_query ); return $zone ['geo_zone_id']; } else { return false; } } } } // class /// // Function (not a method!) generates a pulldown menu filled with the available Geo Zones if( ! function_exists( 'tep_cfg_pull_down_geozones' ) ) { function tep_cfg_pull_down_geozones( $zone_class_id, $key = '' ) { $name = ( ( $key ) ? 'configuration[' . $key . ']' : 'configuration_value' ); $zone_class_array = array ( array ( 'id' => '0', 'text' => 'Rest of the World' ) ); $zone_class_query_raw = " select geo_zone_id, geo_zone_name from " . TABLE_GEO_ZONES . " where LOWER(geo_zone_name) like '" . strtolower( MODULE_SHIPPING_MZMT_PREFIX ) . "%' order by geo_zone_name "; $zone_class_query = tep_db_query( $zone_class_query_raw ); while( $zone_class = tep_db_fetch_array ( $zone_class_query ) ) { $zone_class_array [] = array ( 'id' => $zone_class ['geo_zone_id'], 'text' => $zone_class ['geo_zone_name'] ); } return tep_draw_pull_down_menu( $name, $zone_class_array, $zone_class_id ); } } //// // Check whether admin/modules.php has been modified/replaced if( !function_exists( 'tep_cfg_mzmt_modules_mod_test' ) ) { function tep_cfg_mzmt_modules_mod_test() { $filename = DIR_FS_ADMIN . 'modules.php'; if( file_exists( $filename ) ) { // Read the file into an array, one line per element $file_array = file( $filename ); // Step through the file and check for a match with the selected code foreach ($file_array as $line) { // Check if the line matches one of the lines that should be removed if( trim( $line ) == '$module->update( $HTTP_POST_VARS[\'configuration\'] );' ) { // The critical line exists, so return success and quit return '<div style="margin-top:-2em;">' . tep_image( DIR_WS_ICONS . 'tick.gif', '', '16', '16', 'style="vertical-align:middle;"' ) . ' <span style="vertical-align:middle; font-weight:bold;">' . MODULE_SHIPPING_MZMT_MODULES . '</span></div>'; break; } } } else { // The file was not found, so return an error return '<div style="margin-top:-2em;">' . tep_image( DIR_WS_ICONS . 'cross.gif', '', '16', '16', 'style="vertical-align:middle;"' ) . ' <span style="vertical-align:middle; font-weight:bold; color:red;">' . MODULE_SHIPPING_MZMT_MODULES_MISSING . '</span></div>'; } // if( file_exists // The lines were not found in the file, so return an error message return '<div style="margin-top:-2em;">' . tep_image( DIR_WS_ICONS . 'cross.gif', '', '16', '16', 'style="vertical-align:middle;"' ) . ' <span style="vertical-align:middle; font-weight:bold; color:red;">' . MODULE_SHIPPING_MZMT_MODULES_NOT_MODIFIED . '</span></div>'; } // function tep_cfg_mzmt_modules_mod_test } // if( !function_exists //// // Check whether the language file for this module exists // We should only need to check the Admin language, so that is taken from $language if (!function_exists('tep_cfg_mzmt_language_file_check')) { function tep_cfg_mzmt_language_file_check() { global $language; $language_file = DIR_FS_CATALOG . DIR_WS_LANGUAGES . $language . '/modules/shipping/mzmt.php'; if (file_exists($language_file) && is_file($language_file)) { return '<div style="margin-top:-1em;">' . tep_image(DIR_WS_ICONS . 'tick.gif', '', '16', '16', 'style="vertical-align:middle;"') . ' <span style="vertical-align:middle; font-weight:bold;">' . MODULE_SHIPPING_MZMT_LANGUAGE_FILE_FOUND . '</span></div>'; break; } // if( file_exists // The language file was not found, so return an error message return '<div style="margin-top:-1em;">' . tep_image(DIR_WS_ICONS . 'cross.gif', '', '16', '16', 'style="vertical-align:middle;"') . ' <span style="vertical-align:middle; font-weight:bold; color:red;">' . MODULE_SHIPPING_MZMT_LANGUAGE_FILE_MISSING . '</span></div>'; } // function tep_cfg_mzmt_language_file_check } // if( !function_exists //// // Show a warning message about second install step // This function is used only in the initial install, // it is removed the first time the module is edited. if (!function_exists('tep_cfg_mzmt_warning_second_install')) { function tep_cfg_mzmt_warning_second_install() { return '<div style="margin-top:-1em;">' . tep_image(DIR_WS_IMAGES . 'ms_info.png', '', '16', '16', 'style="vertical-align:middle;"') . ' <span style="vertical-align:middle; font-weight:bold;">' . MODULE_SHIPPING_MZMT_TEXT_EXPLAIN_SECOND_STEP . '</span></div>'; } } //// // Selector for the Update function // Can be set to True, but is reset to False once Update runs if( !function_exists( 'tep_cfg_mzmt_update' ) ) { function tep_cfg_mzmt_update( $key_value, $key ) { $string = ''; $select_array = array( 0 => 'True', 1 => 'False' ); for ($i=0, $n=sizeof($select_array); $i<$n; $i++) { $name = ((tep_not_null($key)) ? 'configuration[' . $key . ']' : 'configuration_value'); if( $select_array[$i] != 'False' ) { $string .= '<input type="checkbox" name="' . $name . '" value="' . $select_array[$i] . '" /> '; $string .= $select_array[$i]; } } return $string; } } //// // Function to show a disabled entry if( !function_exists( 'tep_cfg_disabled' ) ) { function tep_cfg_disabled( $value ) { return tep_draw_input_field( 'configuration_value', $value, ' disabled' ); } } //// // Prevent input boxes showing for the output-only test functions if (!function_exists('tep_cfg_do_nothing')) { function tep_cfg_do_nothing() { return ''; } } ?>
  7. Hi @raiwa, thanks for your support. I tried with another standard payment module (money order), the shipping method did not appear either. I compared the checkout_process.php with the modified one in the QTPro package and found no significant difference. I also tried using the checkout_process.php in the QTPro 5.5 package. The shipping method did not appear in either case. This is the checkout_process.php <?php /* $Id$ Modified for: QTpro Version 5.0 BS by @raiwa [email protected] www.oscaddons.com osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2012 osCommerce Released under the GNU General Public License */ include('includes/application_top.php'); // QTPro $OSCOM_Hooks->register('qtpro'); // if the customer is not logged on, redirect them to the login page if (!tep_session_is_registered('customer_id')) { $navigation->set_snapshot(array('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_PAYMENT)); 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 method has been selected, redirect the customer to the shipping method selection page if (!tep_session_is_registered('shipping') || !tep_session_is_registered('sendto')) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); } if ( (tep_not_null(MODULE_PAYMENT_INSTALLED)) && (!tep_session_is_registered('payment')) ) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); } // avoid hack attempts during the checkout procedure by checking the internal cartID if (isset($cart->cartID) && tep_session_is_registered('cartID')) { if ($cart->cartID != $cartID) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); } } include(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PROCESS); // load selected payment module require(DIR_WS_CLASSES . 'payment.php'); $payment_modules = new payment($payment); // load the selected shipping module require(DIR_WS_CLASSES . 'shipping.php'); $shipping_modules = new shipping($shipping); require(DIR_WS_CLASSES . 'order.php'); $order = new order; // QTPro $OSCOM_Hooks->call('qtpro', 'StockCheckProcess'); // Stock Check $any_out_of_stock = false; if (STOCK_CHECK == 'true') { for ($i=0, $n=sizeof($order->products); $i<$n; $i++) { if (tep_check_stock($order->products[$i]['id'], $order->products[$i]['qty'])) { $any_out_of_stock = true; } } // Out of Stock if ( (STOCK_ALLOW_CHECKOUT != 'true') && ($any_out_of_stock == true) ) { tep_redirect(tep_href_link(FILENAME_SHOPPING_CART)); } } $payment_modules->update_status(); if ( ($payment_modules->selected_module != $payment) || ( 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')); } require(DIR_WS_CLASSES . 'order_total.php'); $order_total_modules = new order_total; $order_totals = $order_total_modules->process(); // load the before_process function from the payment modules $payment_modules->before_process(); $sql_data_array = array('customers_id' => $customer_id, 'customers_name' => $order->customer['firstname'] . ' ' . $order->customer['lastname'], 'customers_company' => $order->customer['company'], 'customers_street_address' => $order->customer['street_address'], 'customers_suburb' => $order->customer['suburb'], 'customers_city' => $order->customer['city'], 'customers_postcode' => $order->customer['postcode'], 'customers_state' => $order->customer['state'], 'customers_country' => $order->customer['country']['title'], 'customers_telephone' => $order->customer['telephone'], 'customers_email_address' => $order->customer['email_address'], 'customers_address_format_id' => $order->customer['format_id'], 'delivery_name' => trim($order->delivery['firstname'] . ' ' . $order->delivery['lastname']), 'delivery_company' => $order->delivery['company'], 'delivery_street_address' => $order->delivery['street_address'], 'delivery_suburb' => $order->delivery['suburb'], 'delivery_city' => $order->delivery['city'], 'delivery_postcode' => $order->delivery['postcode'], 'delivery_state' => $order->delivery['state'], 'delivery_country' => $order->delivery['country']['title'], 'delivery_address_format_id' => $order->delivery['format_id'], 'billing_name' => $order->billing['firstname'] . ' ' . $order->billing['lastname'], 'billing_company' => $order->billing['company'], 'billing_street_address' => $order->billing['street_address'], 'billing_suburb' => $order->billing['suburb'], 'billing_city' => $order->billing['city'], 'billing_postcode' => $order->billing['postcode'], 'billing_state' => $order->billing['state'], 'billing_country' => $order->billing['country']['title'], 'billing_address_format_id' => $order->billing['format_id'], 'payment_method' => $order->info['payment_method'], 'cc_type' => $order->info['cc_type'], 'cc_owner' => $order->info['cc_owner'], 'cc_number' => $order->info['cc_number'], 'cc_expires' => $order->info['cc_expires'], 'date_purchased' => 'now()', 'orders_status' => $order->info['order_status'], 'currency' => $order->info['currency'], 'currency_value' => $order->info['currency_value']); tep_db_perform(TABLE_ORDERS, $sql_data_array); $insert_id = tep_db_insert_id(); for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) { $sql_data_array = array('orders_id' => $insert_id, 'title' => $order_totals[$i]['title'], 'text' => $order_totals[$i]['text'], 'value' => $order_totals[$i]['value'], 'class' => $order_totals[$i]['code'], 'sort_order' => $order_totals[$i]['sort_order']); tep_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array); } $customer_notification = (SEND_EMAILS == 'true') ? '1' : '0'; $sql_data_array = array('orders_id' => $insert_id, 'orders_status_id' => $order->info['order_status'], 'date_added' => 'now()', 'customer_notified' => $customer_notification, 'comments' => $order->info['comments']); tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array); // initialized for the email confirmation $products_ordered = ''; for ($i=0, $n=sizeof($order->products); $i<$n; $i++) { // Stock Update - Joao Correia if (STOCK_LIMITED == 'true') { if (DOWNLOAD_ENABLED == 'true') { $stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename FROM " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa ON p.products_id=pa.products_id LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad ON pa.products_attributes_id=pad.products_attributes_id WHERE p.products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"; // Will work with only one option for downloadable products // otherwise, we have to build the query dynamically with a loop $products_attributes = (isset($order->products[$i]['attributes'])) ? $order->products[$i]['attributes'] : ''; if (is_array($products_attributes)) { $stock_query_raw .= " AND pa.options_id = '" . (int)$products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . (int)$products_attributes[0]['value_id'] . "'"; } $stock_query = tep_db_query($stock_query_raw); } else { $stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); } if (tep_db_num_rows($stock_query) > 0) { $stock_values = tep_db_fetch_array($stock_query); // do not decrement quantities if products_attributes_filename exists if ((DOWNLOAD_ENABLED != 'true') || (!$stock_values['products_attributes_filename'])) { $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty']; } else { $stock_left = $stock_values['products_quantity']; } tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . (int)$stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) { tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); } } } // Update products_ordered (for bestsellers list) tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); $sql_data_array = array('orders_id' => $insert_id, 'products_id' => tep_get_prid($order->products[$i]['id']), 'products_model' => $order->products[$i]['model'], 'products_name' => $order->products[$i]['name'], 'products_price' => $order->products[$i]['price'], 'final_price' => $order->products[$i]['final_price'], 'products_tax' => $order->products[$i]['tax'], 'products_quantity' => $order->products[$i]['qty']); // QTPro $OSCOM_Hooks->call('qtpro', 'StockUpdateProcess'); tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array); $order_products_id = tep_db_insert_id(); //------insert customer choosen option to order-------- $attributes_exist = '0'; $products_ordered_attributes = ''; if (isset($order->products[$i]['attributes'])) { $attributes_exist = '1'; for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) { if (DOWNLOAD_ENABLED == 'true') { $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad on pa.products_attributes_id=pad.products_attributes_id where pa.products_id = '" . (int)$order->products[$i]['id'] . "' and pa.options_id = '" . (int)$order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . (int)$order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . (int)$languages_id . "' and poval.language_id = '" . (int)$languages_id . "'"; $attributes = tep_db_query($attributes_query); } else { $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . (int)$order->products[$i]['id'] . "' and pa.options_id = '" . (int)$order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . (int)$order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . (int)$languages_id . "' and poval.language_id = '" . (int)$languages_id . "'"); } $attributes_values = tep_db_fetch_array($attributes); $sql_data_array = array('orders_id' => $insert_id, 'orders_products_id' => $order_products_id, 'products_options' => $attributes_values['products_options_name'], 'products_options_values' => $attributes_values['products_options_values_name'], 'options_values_price' => $attributes_values['options_values_price'], 'price_prefix' => $attributes_values['price_prefix']); tep_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array); if ((DOWNLOAD_ENABLED == 'true') && isset($attributes_values['products_attributes_filename']) && tep_not_null($attributes_values['products_attributes_filename'])) { $sql_data_array = array('orders_id' => $insert_id, 'orders_products_id' => $order_products_id, 'orders_products_filename' => $attributes_values['products_attributes_filename'], 'download_maxdays' => $attributes_values['products_attributes_maxdays'], 'download_count' => $attributes_values['products_attributes_maxcount']); tep_db_perform(TABLE_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array); } $products_ordered_attributes .= "\n\t" . $attributes_values['products_options_name'] . ' ' . $attributes_values['products_options_values_name']; } } //------insert customer choosen option eof ---- $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n"; } // lets start with the email confirmation //--- Beginning of addition: Ultimate HTML Emails ---// if (EMAIL_USE_HTML == 'true') { require(DIR_WS_MODULES . 'UHtmlEmails/Green/checkout_process.php'); $email_order = $html_email; }else{//Send text email //--- End of addition: Ultimate HTML Emails ---// $email_order = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n"; if ($order->info['comments']) { $email_order .= tep_db_output($order->info['comments']) . "\n\n"; } $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . EMAIL_SEPARATOR . "\n" . $products_ordered . EMAIL_SEPARATOR . "\n"; for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) { $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n"; } if ($order->content_type != 'virtual') { $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n"; } $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n"; if (is_object($$payment)) { $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n"; $payment_class = $$payment; $email_order .= $order->info['payment_method'] . "\n\n"; if (isset($payment_class->email_footer)) { $email_order .= $payment_class->email_footer . "\n\n"; } } //--- Beginning of addition: Ultimate HTML Emails ---// } if(ULTIMATE_HTML_EMAIL_DEVELOPMENT_MODE === 'true'){ //Save the contents of the generated html email to the harddrive in .htm file. This can be practical when developing a new layout. $TheFileName = 'Last_mail_from_checkout_process.php.htm'; $TheFileHandle = fopen($TheFileName, 'w') or die("can't open error log file"); fwrite($TheFileHandle, $email_order); fclose($TheFileHandle); } //--- End of addition: Ultimate HTML Emails ---// tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); // send emails to other people if (SEND_EXTRA_ORDER_EMAILS_TO != '') { tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); } // load the after_process function from the payment modules $payment_modules->after_process(); $cart->reset(true); // unregister session variables used during checkout tep_session_unregister('sendto'); tep_session_unregister('billto'); tep_session_unregister('shipping'); tep_session_unregister('payment'); tep_session_unregister('comments'); tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL')); require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> hooks is installed properly according to my understanding. Are there any way that I can do to check? I'll try to go through all modification tomorrow to see if i have missed something, but do you have any idea what I have to look particularly? Thanks once again.
  8. @raiwa Thanks for the contribution. After installation of QTPro, I ran into some problem with the checkout_process.php Shipping method chosen by customer is failing to appear (neither on orders.php at admin side, nor confirmation emails sent out.) with a particular payment method: cod.php (attached) Everything works fine under Paypal payment module. Do you have any idea where i should look to fix this? <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2014 osCommerce Released under the GNU General Public License */ class cod { var $code, $title, $description, $enabled; function cod() { global $order; $this->code = 'cod'; $this->title = MODULE_PAYMENT_COD_TEXT_TITLE; $this->description = MODULE_PAYMENT_COD_TEXT_DESCRIPTION; $this->sort_order = defined('MODULE_PAYMENT_COD_SORT_ORDER') ? MODULE_PAYMENT_COD_SORT_ORDER : 0; $this->enabled = defined('MODULE_PAYMENT_COD_STATUS') && (MODULE_PAYMENT_COD_STATUS == 'True') ? true : false; $this->order_status = defined('MODULE_PAYMENT_COD_ORDER_STATUS_ID') && ((int)MODULE_PAYMENT_COD_ORDER_STATUS_ID > 0) ? (int)MODULE_PAYMENT_COD_ORDER_STATUS_ID : 0; if ( $this->enabled === true ) { if ( isset($order) && is_object($order) ) { $this->update_status(); } } } function update_status() { global $order; if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_COD_ZONE > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_COD_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id"); while ($check = tep_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->delivery['zone_id']) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } // disable the module if the order only contains virtual products if ($this->enabled == true) { if ($order->content_type == 'virtual') { $this->enabled = false; } } } function javascript_validation() { return false; } function selection() { return array('id' => $this->code, 'module' => $this->title); } function pre_confirmation_check() { return false; } function confirmation() { return false; } function process_button() { return false; } function before_process() { return false; } function after_process() { return false; } function get_error() { return false; } function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_COD_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 Cash On Delivery Module', 'MODULE_PAYMENT_COD_STATUS', 'True', 'Do you want to accept Cash On Delevery payments?', '6', '1', '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 ('Payment Zone', 'MODULE_PAYMENT_COD_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_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 of display.', 'MODULE_PAYMENT_COD_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_COD_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_PAYMENT_COD_STATUS', 'MODULE_PAYMENT_COD_ZONE', 'MODULE_PAYMENT_COD_ORDER_STATUS_ID', 'MODULE_PAYMENT_COD_SORT_ORDER'); } } ?>
×
×
  • Create New...