Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Dr. Rolex

Pioneers
  • Posts

    321
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by Dr. Rolex

  1. Well, that looks like it's supposed to.. Okay, remove/change back the second block of code but keep the first block you changed in advanced_statistics.php and then do the following modification die( json_encode( $json_array ) ); Replace With /* TESTING - Remove BELOW when DONE *********************************************************/ if ( extension_loaded( 'xdebug' ) ) { var_dump($json_array); } else { function prettify( $message ) { echo "<pre style='background-color: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); border-radius: 4px; padding-bottom:8px; max-width:80%; word-wrap:break-word; font-size: 10px; margin: 0 0 10px; padding-left: 9.5px; display: block; font-family: monospace; overflow: auto; color: rgb(204, 0, 0); font-face:monospace; '>"; echo $message; echo "</pre>"; } // Dump Start & End Date prettify( print_r( $json_array, true ) ); } die; /* TESTING - Remove ABOVE when DONE *********************************************************/ die( json_encode( $json_array ) ); Now check if the data is correct, correct tax for tax rates etc.. It should look something like this and the dates should be in order. array (size=1) 'data' => array (size=25) 0 => array (size=12) 0 => string '' (length=0) // Empty 1 => string '2015' (length=4) // Year 2 => string 'January' (length=7) // Month 3 => string '01' (length=2) // Month number 4 => string '$1,132,636.24' (length=13) // Total Sales 5 => string '$28,030.00' (length=10) // Shipping 6 => string '$0.00' (length=5) // Sales excl. tax for Tax rate 1 7 => string '$0.00' (length=5) // Tax for Tax rate 1 8 => string '$560,600.00' (length=11) // Sales excl. tax for Tax rate 2 9 => string '$112,120.00' (length=11) // Tax for Tax rate 2 10 => string '$403,632.00' (length=11) // Sales excl. tax for Tax rate 3 11 => string '$28,254.24' (length=10) // Tax for Tax rate 3 (And so on..) 1 => array (size=12) 0 => string '' (length=0) 1 => string '2015' (length=4) 2 => string 'February' (length=8) 3 => string '02' (length=2) 4 => string '$1,428,165.20' (length=13) 5 => string '$35,040.00' (length=10) 6 => string '$9,900.00' (length=9) 7 => string '$2,970.00' (length=9) 8 => string '$700,600.00' (length=11) 9 => string '$140,120.00' (length=11) 10 => string '$504,504.00' (length=11) 11 => string '$35,315.28' (length=10) 2 => array (size=12) 0 => string '' (length=0) 1 => string '2015' (length=4) 2 => string 'March' (length=5) 3 => string '03' (length=2) 4 => string '$1,177,893.20' (length=13) 5 => string '$29,150.00' (length=10) 6 => string '$0.00' (length=5) 7 => string '$0.00' (length=5) 8 => string '$582,900.00' (length=11) 9 => string '$116,580.00' (length=11) 10 => string '$419,760.00' (length=11) 11 => string '$29,383.20' (length=10) hej
  2. Did you try clicking the red button like I suggested in my previous post? :- Do you know if you have done any structural changes to your MySQL database compared to a clean version of osC 2.3.4? Could you check & post your PHP and MySQL version numbers (You'll find them in your admin under 'Tools' => 'Server Info'). Don't post any more than up to the first decimal, i.e. PHP 5.4 and MySQL 5.5. It's probably better to omit the rest for security reasons. Like I wrote earlier, this is a very strange problem. From what you're telling me it sounds like your server handles dates different from my servers. To be able to determine if this is the case I need you to temporarily modify your ./admin/advanced_statistics.php and then copy-paste the output your getting and post it here. This modified code will output the date arrays that the module is using to create the tables, it should zero out any sensitive data but, just to be safe; make sure to check that the total keys on both the displayed arrays are 0 and not your actual sales. The output should look something like this string 'Start date: 2015-1-1' (length=20) string 'End date: 2016-11-1' (length=19) array (size=19) 0 => array (size=5) 'year' => string '2015' (length=4) 'month' => string '1' (length=1) 'day' => string '1' (length=1) 'hour' => string '10' (length=2) 'total' => int 0 1 => array (size=5) 'year' => string '2015' (length=4) 'month' => string '2' (length=1) 'day' => string '1' (length=1) 'hour' => string '10' (length=2) 'total' => int 0 2 => array (size=5) 'year' => string '2015' (length=4) 'month' => string '3' (length=1) 'day' => string '1' (length=1) 'hour' => string '7' (length=1) 'total' => int 0 3 => array (size=5) 'year' => string '2015' (length=4) 'month' => string '4' (length=1) 'day' => string '1' (length=1) 'hour' => string '7' (length=1) 'total' => int 0 4 => array (size=5) 'year' => string '2015' (length=4) 'month' => string '5' (length=1) 'day' => string '1' (length=1) 'hour' => string '7' (length=1) 'total' => int 0 5 => array (size=5) 'year' => string '2015' (length=4) 'month' => string '6' (length=1) 'day' => string '1' (length=1) 'hour' => string '10' (length=2) 'total' => int 0 6 => array (size=5) 'year' => string '2015' (length=4) 'month' => string '7' (length=1) 'day' => string '1' (length=1) 'hour' => string '10' (length=2) 'total' => int 0 7 => array (size=5) 'year' => string '2015' (length=4) 'month' => string '8' (length=1) 'day' => string '1' (length=1) 'hour' => string '10' (length=2) 'total' => int 0 8 => array (size=5) 'year' => string '2015' (length=4) 'month' => string '9' (length=1) 'day' => string '1' (length=1) 'hour' => string '10' (length=2) 'total' => int 0 9 => array (size=5) 'year' => string '2015' (length=4) 'month' => string '10' (length=2) 'day' => string '1' (length=1) 'hour' => string '10' (length=2) 'total' => int 0 10 => array (size=5) 'year' => string '2015' (length=4) 'month' => string '11' (length=2) 'day' => string '1' (length=1) 'hour' => string '10' (length=2) 'total' => int 0 11 => array (size=5) 'year' => string '2015' (length=4) 'month' => string '12' (length=2) 'day' => string '1' (length=1) 'hour' => string '10' (length=2) 'total' => int 0 12 => array (size=5) 'year' => string '2016' (length=4) 'month' => string '1' (length=1) 'day' => string '1' (length=1) 'hour' => string '10' (length=2) 'total' => int 0 13 => array (size=5) 'year' => string '2016' (length=4) 'month' => string '2' (length=1) 'day' => string '1' (length=1) 'hour' => string '10' (length=2) 'total' => int 0 14 => array (size=5) 'year' => string '2016' (length=4) 'month' => string '3' (length=1) 'day' => string '1' (length=1) 'hour' => string '10' (length=2) 'total' => int 0 15 => array (size=5) 'year' => string '2016' (length=4) 'month' => string '4' (length=1) 'day' => string '1' (length=1) 'hour' => string '10' (length=2) 'total' => int 0 16 => array (size=5) 'year' => string '2016' (length=4) 'month' => string '5' (length=1) 'day' => string '1' (length=1) 'hour' => string '10' (length=2) 'total' => int 0 17 => array (size=5) 'year' => string '2016' (length=4) 'month' => string '8' (length=1) 'day' => string '16' (length=2) 'hour' => string '10' (length=2) 'total' => int 0 18 => array (size=5) 'year' => string '2016' (length=4) 'month' => string '11' (length=2) 'day' => string '16' (length=2) 'hour' => string '10' (length=2) 'total' => int 0 array (size=23) '2015-01' => array (size=6) 'year' => string '2015' (length=4) 'month' => string '01' (length=2) 'day' => string '01' (length=2) 'hour' => string '00' (length=2) 'total' => int 0 'products_sold' => int 0 '2015-02' => array (size=6) 'year' => string '2015' (length=4) 'month' => string '02' (length=2) 'day' => string '01' (length=2) 'hour' => string '00' (length=2) 'total' => int 0 'products_sold' => int 0 '2015-03' => array (size=6) 'year' => string '2015' (length=4) 'month' => string '03' (length=2) 'day' => string '01' (length=2) 'hour' => string '00' (length=2) 'total' => int 0 'products_sold' => int 0 '2015-04' => array (size=6) 'year' => string '2015' (length=4) 'month' => string '04' (length=2) 'day' => string '01' (length=2) 'hour' => string '00' (length=2) 'total' => int 0 'products_sold' => int 0 '2015-05' => array (size=6) 'year' => string '2015' (length=4) 'month' => string '05' (length=2) 'day' => string '01' (length=2) 'hour' => string '00' (length=2) 'total' => int 0 'products_sold' => int 0 '2015-06' => array (size=6) 'year' => string '2015' (length=4) 'month' => string '06' (length=2) 'day' => string '01' (length=2) 'hour' => string '00' (length=2) 'total' => int 0 'products_sold' => int 0 '2015-07' => array (size=6) 'year' => string '2015' (length=4) 'month' => string '07' (length=2) 'day' => string '01' (length=2) 'hour' => string '00' (length=2) 'total' => int 0 'products_sold' => int 0 '2015-08' => array (size=6) 'year' => string '2015' (length=4) 'month' => string '08' (length=2) 'day' => string '01' (length=2) 'hour' => string '00' (length=2) 'total' => int 0 'products_sold' => int 0 '2015-09' => array (size=6) 'year' => string '2015' (length=4) 'month' => string '09' (length=2) 'day' => string '01' (length=2) 'hour' => string '00' (length=2) 'total' => int 0 'products_sold' => int 0 '2015-10' => array (size=6) 'year' => string '2015' (length=4) 'month' => string '10' (length=2) 'day' => string '01' (length=2) 'hour' => string '00' (length=2) 'total' => int 0 'products_sold' => int 0 '2015-11' => array (size=6) 'year' => string '2015' (length=4) 'month' => string '11' (length=2) 'day' => string '01' (length=2) 'hour' => string '00' (length=2) 'total' => int 0 'products_sold' => int 0 '2015-12' => array (size=6) 'year' => string '2015' (length=4) 'month' => string '12' (length=2) 'day' => string '01' (length=2) 'hour' => string '00' (length=2) 'total' => int 0 'products_sold' => int 0 '2016-01' => array (size=6) 'year' => string '2016' (length=4) 'month' => string '01' (length=2) 'day' => string '01' (length=2) 'hour' => string '00' (length=2) 'total' => int 0 'products_sold' => int 0 '2016-02' => array (size=6) 'year' => string '2016' (length=4) 'month' => string '02' (length=2) 'day' => string '01' (length=2) 'hour' => string '00' (length=2) 'total' => int 0 'products_sold' => int 0 '2016-03' => array (size=6) 'year' => string '2016' (length=4) 'month' => string '03' (length=2) 'day' => string '01' (length=2) 'hour' => string '00' (length=2) 'total' => int 0 'products_sold' => int 0 '2016-04' => array (size=6) 'year' => string '2016' (length=4) 'month' => string '04' (length=2) 'day' => string '01' (length=2) 'hour' => string '00' (length=2) 'total' => int 0 'products_sold' => int 0 '2016-05' => array (size=6) 'year' => string '2016' (length=4) 'month' => string '05' (length=2) 'day' => string '01' (length=2) 'hour' => string '00' (length=2) 'total' => int 0 'products_sold' => int 0 '2016-06' => array (size=6) 'year' => string '2016' (length=4) 'month' => string '06' (length=2) 'day' => string '01' (length=2) 'hour' => string '00' (length=2) 'total' => int 0 'products_sold' => int 0 '2016-07' => array (size=6) 'year' => string '2016' (length=4) 'month' => string '07' (length=2) 'day' => string '01' (length=2) 'hour' => string '00' (length=2) 'total' => int 0 'products_sold' => int 0 '2016-08' => array (size=6) 'year' => string '2016' (length=4) 'month' => string '08' (length=2) 'day' => string '01' (length=2) 'hour' => string '00' (length=2) 'total' => int 0 'products_sold' => int 0 '2016-09' => array (size=6) 'year' => string '2016' (length=4) 'month' => string '09' (length=2) 'day' => string '01' (length=2) 'hour' => string '00' (length=2) 'total' => int 0 'products_sold' => int 0 '2016-10' => array (size=6) 'year' => string '2016' (length=4) 'month' => string '10' (length=2) 'day' => string '01' (length=2) 'hour' => string '00' (length=2) 'total' => int 0 'products_sold' => int 0 '2016-11' => array (size=6) 'year' => string '2016' (length=4) 'month' => string '11' (length=2) 'day' => string '01' (length=2) 'hour' => string '00' (length=2) 'total' => int 0 'products_sold' => int 0 Alright, make a backup of your admin/advanced_statistics.php and then modify it with these changes Find this code if ( isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && $_SERVER['HTTP_X_REQUESTED_WITH'] == "XMLHttpRequest" && ! isset( $_GET['new_win'] ) ) { // AJAX Request Replace With /* TESTING - Remove BELOW when DONE *********************************************************/ $_GET = array(); $_SERVER['HTTP_X_REQUESTED_WITH'] = "XMLHttpRequest"; $_GET['action'] = "get_data"; /* TESTING - Remove ABOVE when DONE *********************************************************/ if ( isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && $_SERVER['HTTP_X_REQUESTED_WITH'] == "XMLHttpRequest" && ! isset( $_GET['new_win'] ) ) { // AJAX Request Find this code $shipping_month = getMonthArray( $start_date, $end_date ); Replace With $shipping_month = getMonthArray( $start_date, $end_date ); /* TESTING - Remove BELOW when DONE *********************************************************/ // Copy Total Sales array and zero out result except dates $temp_total_sales = $total_sales; for ( $i=0; $i < count( $temp_total_sales ); $i++ ) { $temp_total_sales[$i]['total'] = 0; } ini_set('html_errors', 1); if ( extension_loaded( 'xdebug' ) ) { // Dump Start & End Date var_dump( "Start date: " . $start_date ); var_dump( "End date: " . $end_date ); echo "<hr>"; // Dump Dates from Total Sales var_dump($temp_total_sales); echo "<hr>"; // Dump Constructed Date Array var_dump($total_sales_month); } else { function prettify( $message ) { echo "<pre style='background-color: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); border-radius: 4px; padding-bottom:8px; max-width:80%; word-wrap:break-word; font-size: 10px; margin: 0 0 10px; padding-left: 9.5px; display: block; font-family: monospace; overflow: auto; color: rgb(204, 0, 0); font-face:monospace; '>"; echo $message; echo "</pre>"; } // Dump Start & End Date prettify( print_r( "Start date: " . $start_date, true ) ); prettify( print_r( "End date: " . $end_date, true ) ); echo "<hr>"; // Dump Dates from Total Sales prettify( print_r( $temp_total_sales, true ) ); echo "<hr>"; // Dump Constructed Date Array prettify( print_r( $total_sales_month, true ) ); } die; /* TESTING - Remove ABOVE when DONE *********************************************************/ Go to advanced_statistics.php in your browser, check so that the total keys is 0, copy the output and paste it here.
  3. Well, this was indeed very strange.. Could you post the locale content of your admin/includes/languages/[your_language].php. Should look something like this: setlocale(LC_TIME, 'en_US.ISO_8859-1'); define('DATE_FORMAT_SHORT', '%m/%d/%Y'); // this is used for strftime() define('DATE_FORMAT_LONG', '%A %d %B, %Y'); // this is used for strftime() define('DATE_FORMAT', 'm/d/Y'); // this is used for date() define('PHP_DATE_TIME_FORMAT', 'm/d/Y H:i:s'); // this is used for date() define('DATE_TIME_FORMAT', DATE_FORMAT_SHORT . ' %H:%M:%S'); Also, could you check if you're getting the same errors after you press the "Clear all filters" button (Red button with recycle icon on top navbar).
  4. The number of products in your store shouldn't be an issue, performance-wise that is. Hm, is all statistics always shifted one month? Or does this only happen when you click the green + symbol to get detailed month stats? Can you see if the number are for the correct month and only the name of the month is wrong? I found some bugs in the last updated package which I have fixed for my store but haven't had time to upload yet. However, I'm not sure those were related to the problem you're having but I'm sure there's an easy fix for it though.
  5. It's actually a gzipped tar archive, not a zip archive. Try to extract the archive with a different app. If you already have the tep_db_fetch_all function in database.php, then replace it with the one from general_functions.php. I don't remember what the issue was, but this should solve some database issues that you might run into if you have e.g. the Advanced Order Handler Add-On installed. It's been a month now so hopefully you solved it yourself. :thumbsup:
  6. I found a bug that prevents categories & products filter to work. Comment or remove this line in ./admin/advanced_statistics.php $filter_orders_products = "";
  7. jQuery/Ajax Advanced Statistics Rev2 Download Add-On here: http://addons.oscommerce.com/info/9286 New Features and changes in Revision 2 Fixed so it's possible to display more than one table at a time Two levels of child tables - Months => Days => Hours jQuery DateRange Picker New Filter - Categories - Filter Statistics from selected categories (multiple selections possible) New Filter - Products - Filter Statistics from selected product(s) (multiple selections possible) New Filter - Customers - Filter Statistics from selected customer(s) (multiple selections possible) New Filter - Custom Filter - Filter anything you want from any column in the 'orders' table ( E.g. Name, Company, City, Postcode, State, Country, Telephone, Payment Method, Currency.. ) Group by week New Column - Display total # of products sold Tabletools - Export to CSV/XLS Settings AmCharts - Fixed charts with Pan/Zoom AmCharts - Export to PNG/JPG/SVG AmCharts - ChartCursor AmCharts - Separate Axis for Products Sold Settings - Your settings will now be saved with a Cookie and in the localStorage object aStat. So every time you get back to the Advanced Statistics page your previously selected filters and options will be selected.
  8. It looks like database.php wasn't updated until osC 2.3.3.2, so any store with an older version needs to upgrade their store before this Add-On will work...
  9. You need to modify more code in order to get the MVS Add-On to work with this one. For starters, you need to change this function in ./includes/functions/general.php function tep_count_shipping_modules() { return tep_count_modules(MODULE_SHIPPING_INSTALLED); } To this: function tep_count_shipping_modules() { // MVS Start if (SELECT_VENDOR_SHIPPING == 'true') { return tep_count_modules(MODULE_VENDOR_SHIPPING_INSTALLED_1); } else { return tep_count_modules(MODULE_SHIPPING_INSTALLED); } // MVS End } In ./ajax/classes/ajaxManagerTest.class.php, change this: <?php if (tep_count_shipping_modules() > 0) { ?> <div class="ui-widget infoBoxContainer"> <div class="ui-widget-header infoBoxHeading ui-corner-top"><strong><?php echo TABLE_HEADING_SHIPPING_METHOD; ?></strong></div> <div class="ui-widget-content infoBoxContents ui-corner-bottom" style="float:right;"> <div class="selectChoices"> <?php To this <?php if (tep_count_shipping_modules() > 0) { ?> <div class="ui-widget infoBoxContainer"> <div class="ui-widget-header infoBoxHeading ui-corner-top"><strong><?php echo TABLE_HEADING_SHIPPING_METHOD; ?></strong></div> <div class="ui-widget-content infoBoxContents ui-corner-bottom" style="float:right;"> <div class="selectChoices"> <?php // MVS Start if (SELECT_VENDOR_SHIPPING == 'true') { require(DIR_WS_MODULES . 'vendor_shipping.php'); } else { // MVS End Change this: <span><?php echo tep_draw_radio_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'], $checked, 'id="shipping_'.$radio_buttons.'"');?></span> To This: <span><?php echo tep_draw_radio_field('shipping_'.$radio_buttons, $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'], $checked, 'id="shipping_'.$radio_buttons.'"');?></span> Change this: <?php } } To This: <?php } } // MVS Start } // MVS End Change this: if (!ajaxSessionIsRegistered('shipping')) ajaxSessionRegister('shipping',$shipping); if ( (tep_count_shipping_modules() > 0) || ($free_shipping == true) ) { list($module, $method) = explode('_', $shipping); if (is_object($GLOBALS[$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[0]['error']) || isset($quote['error'])) { ajaxSessionUnregister('shipping'); $error = true; } 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']); } } } else { ajaxSessionUnregister('shipping'); $error = true; } } else { $shipping = false; $error = true; } $this->showShippingInfo($shipping); $this->showCommentInfo(); To This: if (!ajaxSessionIsRegistered('shipping')) ajaxSessionRegister('shipping',$shipping); // MVS Start 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); $this->getAndPrepare('shipping_' . $vendor_id, $get, $shipping); $shipping_modules = new shipping($shipping); $shipping_data = $_GET['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']; } //MVS $shipping = array('id' => $SESSION['shipping'], 'title' => $shipping_title, 'cost' => $total_shipping_cost, 'shipping_tax_total' => $total_ship_tax, 'vendor' => $output ); //tep_redirect (tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); } else { // MVS End if ( (tep_count_shipping_modules() > 0) || ($free_shipping == true) ) { list($module, $method) = explode('_', $shipping); if (is_object($GLOBALS[$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[0]['error']) || isset($quote['error'])) { ajaxSessionUnregister('shipping'); $error = true; } 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']); } } } else { ajaxSessionUnregister('shipping'); $error = true; } } else { $shipping = false; $error = true; } } $this->showShippingInfo($shipping); $this->showCommentInfo(); In ./ajax/javascript/ajaxManager.js, change this var shipping = getValue('shipping'); } ajaxSendRequest('ajaxAction=PerformShippingSelection&shipping='+shipping,ajaxUpdateContentMulti,true,'shipping_area'); return false; To this: //var shipping = getValue('shipping'); var shipping = $( ".selectChoices" ).find( "input[type=radio]:checked" ).val(); } ajaxSendRequest('ajaxAction=PerformShippingSelection&' + $( ".selectChoices" ).find( "input[type=radio]:checked" ).attr( "name" ) + '='+shipping,ajaxUpdateContentMulti,true,'shipping_area'); return false; This is however not enough to get it working. You need to modify the code in ajaxMangerTest.class.php so that the shipping module gets selected and registered. You'll find the code you need to modify in this function: function _PerformShippingSelection($get, &$error) Good luck! ;)
  10. I'm sorry, but then it seems like this Add-On will not work on OSC 2.3.1 without making modifications to it. :( I didn't think they changed that much from earlier 2.3 versions. If you want, you could always upgrade to a newer osC version. Download the upgrade packages from http://www.oscommerce.com/Products (you find them at the bottom of the page under "Release History".
  11. What version of osCommerce are you using? Your database.php file is really old. This Add-On was made for osCommerce 2.3 and I think that you're using an older version? You can try with replacing your database.php with the new file from 2.3.4 <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2013 osCommerce Released under the GNU General Public License */ function tep_db_connect($server = DB_SERVER, $username = DB_SERVER_USERNAME, $password = DB_SERVER_PASSWORD, $database = DB_DATABASE, $link = 'db_link') { global $$link; if (USE_PCONNECT == 'true') { $server = 'p:' . $server; } $$link = mysqli_connect($server, $username, $password, $database); if ( !mysqli_connect_errno() ) { mysqli_set_charset($$link, 'utf8'); } return $$link; } function tep_db_close($link = 'db_link') { global $$link; return mysqli_close($$link); } function tep_db_error($query, $errno, $error) { global $logger; if (defined('STORE_DB_TRANSACTIONS') && (STORE_DB_TRANSACTIONS == 'true')) { $logger->write('[' . $errno . '] ' . $error, 'ERROR'); } die('<font color="#000000"><strong>' . $errno . ' - ' . $error . '<br /><br />' . $query . '<br /><br /><small><font color="#ff0000">[TEP STOP]</font></small><br /><br /></strong></font>'); } function tep_db_query($query, $link = 'db_link') { global $$link, $logger; if (defined('STORE_DB_TRANSACTIONS') && (STORE_DB_TRANSACTIONS == 'true')) { if (!is_object($logger)) $logger = new logger; $logger->write($query, 'QUERY'); } $result = mysqli_query($$link, $query) or tep_db_error($query, mysqli_errno($$link), mysqli_error($$link)); return $result; } function tep_db_perform($table, $data, $action = 'insert', $parameters = '', $link = 'db_link') { reset($data); if ($action == 'insert') { $query = 'insert into ' . $table . ' ('; while (list($columns, ) = each($data)) { $query .= $columns . ', '; } $query = substr($query, 0, -2) . ') values ('; reset($data); while (list(, $value) = each($data)) { switch ((string)$value) { case 'now()': $query .= 'now(), '; break; case 'null': $query .= 'null, '; break; default: $query .= '\'' . tep_db_input($value) . '\', '; break; } } $query = substr($query, 0, -2) . ')'; } elseif ($action == 'update') { $query = 'update ' . $table . ' set '; while (list($columns, $value) = each($data)) { switch ((string)$value) { case 'now()': $query .= $columns . ' = now(), '; break; case 'null': $query .= $columns .= ' = null, '; break; default: $query .= $columns . ' = \'' . tep_db_input($value) . '\', '; break; } } $query = substr($query, 0, -2) . ' where ' . $parameters; } return tep_db_query($query, $link); } function tep_db_fetch_array($db_query) { return mysqli_fetch_array($db_query, MYSQLI_ASSOC); } function tep_db_result($result, $row, $field = '') { if ( $field === '' ) { $field = 0; } tep_db_data_seek($result, $row); $data = tep_db_fetch_array($result); return $data[$field]; } function tep_db_num_rows($db_query) { return mysqli_num_rows($db_query); } function tep_db_data_seek($db_query, $row_number) { return mysqli_data_seek($db_query, $row_number); } function tep_db_insert_id($link = 'db_link') { global $$link; return mysqli_insert_id($$link); } function tep_db_free_result($db_query) { return mysqli_free_result($db_query); } function tep_db_fetch_fields($db_query) { return mysqli_fetch_field($db_query); } function tep_db_output($string) { return htmlspecialchars($string); } function tep_db_input($string, $link = 'db_link') { global $$link; return mysqli_real_escape_string($$link, $string); } function tep_db_prepare_input($string) { if (is_string($string)) { return trim(stripslashes($string)); } elseif (is_array($string)) { reset($string); while (list($key, $value) = each($string)) { $string[$key] = tep_db_prepare_input($value); } return $string; } else { return $string; } } function tep_db_affected_rows($link = 'db_link') { global $$link; return mysqli_affected_rows($$link); } function tep_db_get_server_info($link = 'db_link') { global $$link; return mysqli_get_server_info($$link); } if ( !function_exists('mysqli_connect') ) { define('MYSQLI_ASSOC', MYSQL_ASSOC); function mysqli_connect($server, $username, $password, $database) { if ( substr($server, 0, 2) == 'p:' ) { $link = mysql_pconnect(substr($server, 2), $username, $password); } else { $link = mysql_connect($server, $username, $password); } if ( $link ) { mysql_select_db($database, $link); } return $link; } function mysqli_connect_errno($link = null) { if ( is_null($link) ) { return mysql_errno(); } return mysql_errno($link); } function mysqli_connect_error($link = null) { if ( is_null($link) ) { return mysql_error(); } return mysql_error($link); } function mysqli_set_charset($link, $charset) { if ( function_exists('mysql_set_charset') ) { return mysql_set_charset($charset, $link); } } function mysqli_close($link) { return mysql_close($link); } function mysqli_query($link, $query) { return mysql_query($query, $link); } function mysqli_errno($link = null) { if ( is_null($link) ) { return mysql_errno(); } return mysql_errno($link); } function mysqli_error($link = null) { if ( is_null($link) ) { return mysql_error(); } return mysql_error($link); } function mysqli_fetch_array($query, $type) { return mysql_fetch_array($query, $type); } function mysqli_num_rows($query) { return mysql_num_rows($query); } function mysqli_data_seek($query, $offset) { return mysql_data_seek($query, $offset); } function mysqli_insert_id($link) { return mysql_insert_id($link); } function mysqli_free_result($query) { return mysql_free_result($query); } function mysqli_fetch_field($query) { return mysql_fetch_field($query); } function mysqli_real_escape_string($link, $string) { if ( function_exists('mysql_real_escape_string') ) { return mysql_real_escape_string($string, $link); } elseif ( function_exists('mysql_escape_string') ) { return mysql_escape_string($string); } return addslashes($string); } function mysqli_affected_rows($link) { return mysql_affected_rows($link); } function mysqli_get_server_info($link) { return mysql_get_server_info($link); } } ?>
  12. Did you get a fatal error in your PHP log when this happened? You probably just forgot to comment a bracket, }, or something. But perhaps it's simpler to just replace the mysqli_prepared_query function in database.php. Replace it with the code below function mysqli_prepared_query( $sql, $typeDef = FALSE, $params = FALSE, $link = "db_link" ) { global $$link; if ( false === $typeDef || empty( $typeDef ) ) { return tep_db_fetch_all( $sql ); } # Kiss Error Debugger $start_time = microtime( true ); if ( $stmt = mysqli_prepare( $$link, $sql ) ) { if ( count( $params ) == count( $params, 1 ) ) { $params = array( $params ); $multiQuery = FALSE; } else { $multiQuery = TRUE; } if ( $typeDef ) { $bindParams = array(); $bindParamsReferences = array(); $bindParams = array_pad( $bindParams, ( count( $params, 1 )-count( $params ) )/count( $params ), "" ); foreach ( $bindParams as $key => $value ) { $bindParamsReferences[ $key ] = &$bindParams[ $key ]; } array_unshift( $bindParamsReferences, $typeDef ); $bindParamsMethod = new ReflectionMethod( 'mysqli_stmt', 'bind_param' ); $bindParamsMethod->invokeArgs( $stmt, $bindParamsReferences ); } $result = array(); foreach ( $params as $queryKey => $query ) { foreach ( $bindParams as $paramKey => $value ) { $bindParams[ $paramKey ] = $query[ $paramKey ]; } $queryResult = array(); if ( mysqli_stmt_execute( $stmt ) ) { $resultMetaData = mysqli_stmt_result_metadata( $stmt ); if ( $resultMetaData ) { $stmtRow = array(); $rowReferences = array(); while ( $field = mysqli_fetch_field( $resultMetaData ) ) { $rowReferences[] = &$stmtRow[ $field->name ]; } mysqli_free_result( $resultMetaData ); $bindResultMethod = new ReflectionMethod( 'mysqli_stmt', 'bind_result' ); $bindResultMethod->invokeArgs( $stmt, $rowReferences ); while ( mysqli_stmt_fetch( $stmt ) ) { $row = array(); foreach ( $stmtRow as $key => $value ) { $row[$key] = $value; } $queryResult[] = $row; } mysqli_stmt_free_result( $stmt ); } else { $queryResult[] = mysqli_stmt_affected_rows( $stmt ); } } else { $queryResult[] = FALSE; } $result[ $queryKey ] = $queryResult; } mysqli_stmt_close( $stmt ); } else { $result = FALSE; } # Kiss Error Debugger if ( class_exists( 'KissER' ) ) { $sql = interpolateQuery( $sql, $params[0] ); KissER::q( round( ( microtime( true ) - $start_time ), 4 ), $sql ); } if ( $multiQuery ) { return $result; } else { return $result[0]; } }
  13. You're welcome! :thumbsup: --- New features that I have just added is automatic saving of settings to Cookie and localStorage (just like in the Order Handler) and I have also added a custom search filter which can be used to filter statistics for anything from the orders table, e.g. filtering stats for order just from a specific city, from a specific customer, country, etc.. I will post updates/new features to the Add-On here rather than uploading a new package each time. I found out that I could clear my old images posted on the forum so now I was able to attach some of the screenshots from the Add-On Package.
  14. Did you try my suggestion in post #5? Look in your ./admin/includes/functions/database.php for mysqli_prepared_query and tep_db_fetch_all functions. If you can find them, try with commenting them out or removing them to see if it solves your problem.
  15. Check your ./admin/includes/functions/database.php, look for $link = 'db_link' Make sure if it's 'db_link', if it's something else, then you need to change the same string in ./admin/advanced_statistics/general_functions.php on two places to the one you have in database.php. Change Here: function tep_db_fetch_all( $query, $link = 'db_link' ) { And Here: function mysqli_prepared_query( $sql, $typeDef = FALSE, $params = FALSE, $link = "db_link" ) { This is the only reason I can come up with that produces that error..
  16. You should also check your PHP error log, if you can see the notice quoted below then the problem might be caused by you having one of my other Add-Ons installed: (you need to set error_reporting to E_ALL in admin/includes/application_top.php to see notices in the log) If so, then you can solve it this way: The problem can also be attributed to an old version of PHP or perhaps MySQL (most likely PHP).
  17. Good morning Peter, This is a bit strange, this problem shouldn't happen since date is always stored in the same format in MySQL. But this problem probably has to do with your locale settings and will have an easy fix. Could you post your locale settings in ./admin/includes/languages/[your_language].php Should be something like this setlocale(LC_ALL, array('en_US.UTF-8', 'en_US.UTF8', 'enu_usa')); define('DATE_FORMAT_SHORT', '%m/%d/%Y'); // this is used for strftime() define('DATE_FORMAT_LONG', '%A %d %B, %Y'); // this is used for strftime() define('DATE_FORMAT', 'm/d/Y'); // this is used for date() define('PHP_DATE_TIME_FORMAT', 'm/d/Y H:i:s'); // this is used for date()
  18. jQuery/Ajax Advanced Statistics Rev1 Download Add-On here: http://addons.oscommerce.com/info/9286 Apparently I have "exceeded your allotted disk space for attachments" so I can't attach any screenshots. :'(
  19. Advanced Statistics Rev1 for osCommerce 2.3 - Compatible Without mysqlnd - - Support thread - Having made another module for handling products/categories which utilize DataTables, I realized that my store needed a new reporting "engine" to produce statistics/sales data for me so that I don't have to make a new spreadsheet every time I want some statistics. As of Revision 1 there's still a lot to work on but the the module has come to a point of being useful so I thought I share it with the rest of the osC community as an Add-On. If you think you have a good idea on new features/stats that could be useful, please share them here on the support forum. DataTables DataTables requests the sales data from your server with Ajax and then builds you a table with a action bar and selectable rows. You can Drag & Drop Column Headers to reorder the table the way you like it. It’s also possible to toggle column visibility. Clicking on the columns will sort the column ascending/descending. Clicking on the leftmost plus (+) sign will expand the column to detailed day-by-day per month sales & tax data. Performance The former Reporting Add-On I used was very slow, it queried each row in table orders_products and the amount of queries done to calculate sales & tax for a period was massive! Data will be loaded from JSON source which also helps improve Performance, especially on slow connections. Make very sure if you are going to use this Add-On that it calculates your data correctly! You have to both double and triple check the reports with another reporting system so you know for sure that everything works. This is how the Advanced Statistics Add-On calculates your sales data, it’s quite simple: If you have a tax rate set to 20% and the summary for this tax for 1 day is $200 then it will calculate generated sales with 20% tax this way: [Total Tax] / [Tax Rate] * 100 = Sold Goods with 20% Tax 200 / 20 * 100 = 1000. So Sales 20% will be $1000. As of Rev1, order_totals classes that will be counted are ot_total, ot_tax & ot_shipping. TableTools The TableTools Extension comes with a swf (flash) file which helps e.g. to copy table data to clipboard. Unfortunately, flash is the only way to do this right now.. Copying Data and then Pasting it in your spreadsheet editor is a neat way to quickly create custom reports. TableTools also comes with buttons to automatically create CSV files. You might need to configure the CSV field separator in advanced_statistics.js. Search for the sFieldSeperator option and set correct separator if you can’t get the CSV to import correctly. Print View Using a CSS with media="print”, a print view is automatically created when you select to print the page. If you have selected to filter orders by status, then there will be an added heading with Status Information, as of Rev1 however, you need to reload the page to get it to display. I’ll fix this later.. You can also use the TableTools ”Print” Button which essentially makes the same thing. You can also have TableTools create a PDF for you, but it looks like sh*t if you ask me. Check DataTables homepage on how to configure the layout for this PDF, I will not work on this as I don’t need it (will use CMD/CTRL + P instead..). Note also that some of the themes probably needs some CSS styling fixes if you want to print e.g. background colors of header. Make sure to add these to advanced_statistics_print_view.css. Menus & Navigation I always wanted one of those Slide-In menus so I finally got one; jQuery mmenu. It’s still rather empty, but should fill up with more filtering options and other knobs, buttons & of course whistles soon enough. To open it; click on the top left icon on the top navigation, it will randomly pick one out of 37 icons on each load but shouldn’t be hard to find as long as you’re not completely ”challenged” by the world around you… :P There’s a couple of more buttons in the Bootstrap top navigation which will toggle the admin menu and header and also a button to clear all currently applied filters. To the right on the top navigation you’ll have two dropdowns which will switch theme and filter by orders status. Theming jQuery DataTables comes with some options to implement themes, so I fixed support for five different layouts: jTable - Looks a bit like the Advanced Order Handler and uses Bootstrap buttons for the seven leftmost buttons. Original - DataTables as it comes out of the box (more or less) Bootstrap - Like Original but with the DataTables Bootstrap css & js jQuery UI - Will adapt to your jQuery-UI Admin Theme (default is Redmond) jQuery UI Smoothness - Uses Smoothness theme instead of Redmond Screenshots of all Themes can be found at the bottom of the ReadMe file in the package. Theme-creator https://www.datatables.net/manual/styling/theme-creator Internationalization Both amCharts and DataTables comes with many language definitions which is included and should automatically load the same language as the one you have set in your admin (assuming the definition exist). amCharts I plan to make a lot of use of amCharts to get easy to interpret charts from store sales etc.. As of Revision 1, you can get a line, area, column, bar, step line, smoothed line, candlestick and OHLC graph for each of the visible columns and for either the specific rows that you have selected (OS style selection, shift/control/CMD click to select multiple rows) or for the entire table(s). The chart modal is movable (only one move per page load) and also resizable. Click on the Graph Names at the bottom of the modal to hide/show different line graphs. Security & Compatability All querying with parameters/input variables to your database will be made with MySQLi Prepared Statements. Preferably you should use the MySQL Native Driver (mysqlnd), but I have added support and tested the Add-On without mysqlnd and everything should work. Prepared Statements removes the threat of MySQL Injections. Not that it matters that much on the admin side of the shop since only authorized users have access, but you can never be too secure, right? ;) For simple installation I have not messed with more native osC files than necessary and instead included necessary functions in general_functions.php. If you have any of my previous Add-Ons installed then you might run into a problem under certain conditions when the mysqli_prepared_query and tep_db_fetch_all functions will fail. If so, then try with replacing the current database functions that you have in ./admin/includes/functions/database.php with the ones that you find in general_functions.php from this Add-on. Features for Revision 1 Sales/Tax Statistics/Report Generator for osC 2.3.x Only tested on osC 2.3.4 but should work on any version Simple five step Installation - Only three files needs to be modified! Automatically creates HTML table and loads orders from server using AJAX. Export Options: CSV, Copy/Paste, XLS, PDF "Automatic" Print View amCharts Graphs over sales & taxes Very Fast Operation, a shop with 30 000 orders loads in under 2 seconds. jQuery DataTables - https://datatables.net/ Drag & Drop Columns Automatic Column Sorting Toggle Column Visibility Detailed day-to-day sales Slide-In Menu with mmenu - http://mmenu.frebsite.nl/ Fixed Bootstrap Top Navigation Themes jTable Original Bootstrap jQuery UI jQuery UI Smoothness DataTables Internationalization - 63 Language Definitions Included amCharts Internationalization - 29 Language Definitions Included 100% MySQLi Prepared Statements Bootstrap Tooltips Toggleable Visibility of both your store header and Admin menu using CSS3 classes OS style selection, shift/control/CMD click to select multiple rows - Plenty of screenshots in package! -
  20. Hello Raz It's not empty, download the latest package from 16 Jul 2014. It contains a Gzip archive containing a xz archive. So, first extract the downloaded file with your default archiver and then e.g. use 7-Zip to decompress the .xz file to get the installation files. You can create orders manually by entering all the details by hand, duplicate old orders (and then edit them if necessary) and create orders for existing customers but I never added a function to add a new customer to the database.
  21. If you open the console in Chrome (Windows: Ctrl + Shift + J, Mac: Cmd + Opt + J) and then try to login, do you get any error messages? If you're not getting any errors, then go to the Network tab instead, Click on XHR and then try to login again. You should see a new request to ajaxManager.php?ajaxAction=PerformLogin&target=payment_area. Click on that request and go to the Response tab on the right half of the Developer Tools. You should see the html code that you want displayed, i.e. the same thing that would be displayed if you logged in the "normal" way and then went to the Fast Checkout. If there's something is wrong in the html code you're getting in the response, then the problem is server side, i.e. your PHP code. If the html looks right, then the problem is client side, i.e. your Javascript code. If you try reloading the page after you see the loading gif, are you still not logged in or does that log you in? Also, are you getting the same error on different browsers?
  22. Prologue ​I'm sure I had good intentions when I started this tutorial or whatever it was supposed to be. Half way through writing, anyway, I felt I just needed to end it but probably didn't know how (since I had forgot what started it). I have, halfheartedly, tried to sanitate it so that you can understand some of it, but I'm not in a condition anymore to keep "meddling" with it. Haha :P Tomorrow will likely be a most unlikable day and if I were smart I would go to bed any minute. But that's unlikely, though.. Can't quit now, so much fun to do, StIll! (w00t) :D :mellow: :- Anyway, just ask if you need help on something, but you should probably ask about one problem at a time so we don't risk having these (↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓) situations again. Enjoy your "tutorial" and try to stay sane while experiencing it's full glory! Edit: I now realize that I've accidentally removed the sanitized version of this tutorial which simply gives me no other choice then to give you the almost uncut version. Took me 2 fu-king hours cleaning that one up (since I have no way to see what characters that surrounds perhaps the current word I'm focusing on.. I now realize that this luckily isn't a permeant handicap because that would probably limit to do anything legal while moving without some kind of trained beast clearing my way in front of me. Enjoy! // Dr. R. Hmm.. Is it just my own filthy odor that's giving of that smell or do I sense a fellow workaholic? :- [i couldn't retrieve this part of the tutorial, sorry ] :blink: // Selecting Element By ID (distinct for this is the use of the # char before the ID_Name) $( "#body_content" ) // Okay, so say that you want some JS/jQuery code to run when the user e.g. clicks on an element $( "body" ).on( "click", "#body_content", function( event ) { // This will display various information on the event itself and also about the attributes of the element you have bound this event listener to. // This is usually the easiest way to give the jQuery code the vital information it need to process e.g deleting a product from the basket, adding, subtracting to it's quanity or any other process where the code needs to know which specific item/detail you want it to do any work on. /* Example: If you want to make sure that the shopping_cart.php FORM with the new product quantites the user has entered will be POSTED when clicking on the bootstrap button I suggested, then add this html right under the div that has the (-), product quanity and the (+) buttons: <div class="input-group input-group-sm" style="width:150px;text-align:center"> <input class="submit_form_button btn btn-default" id="submit-form-button" type="button" style="width:100%"> </div> Notice that I added the submit_form_button class which can be used as element selector. Also take note that if you ever want one event listnerer to handle multiple elements, then just add a custom class to that element and then change the jQuery code which in this example would originally look like this ( "#[Element-ID]", always # for IDS ) *_- Select Element by ID -_* $( "#submit-form-button" ); *_- Bind Event listener to Element by ID -_* $( "body").on( "click", "#submit-form-button", function( event ) {}); So to make it possible to bind the event listener to multiple elements we simply change the selector to a class name and we make sure all elements that should trigger this event has the chosen class name ( ".[Element-ID]", always . for Classes. Valid classnames can only use underscores (_) in their name, while IDs can have both underscores (_) and hyphens (-) ). Both the event and this objects inside the event listener will always relate to the element that was e.g. in this case, clicked on. So you can safely use the same event listener on multiple elements as long ass they are selected by class and not ID.22§§ *_- Select Element(s) by Class -_* $( ".submit_form_button" ) *_- Bind Event listener to Element(s) by Class -_*/ $( "body").on( "click", ".submit_form_button", function( event ) { console.log( "Here's the information stored in the $( this ) keyword when used inside this specific click event" + "\n\n" ); console.log( $( this ) ); console.log( "Here's the information stored in the this keyword when used inside this specific click event" + "\n\n" ); console.log( this ); console.log( "Here's the information stored in the event keyword when used inside this specific click event" + "\n\n" ); console.log( event ); }); /* GO Ahead and copy and paste the above 5 lines snippet to the console in you browsers console. Just make sure that you got some element with the selected class (submit_form_button) so you can try it out. Click on the element with the submit_form_button class and check your console what information each of the object has for you. Next thing you can try in your shopping_cart.php to further modify the clickable element, is to add a new property name which start with data-[some random name] and has the products_id as value. So e.g. add data-productID="' . $products[$i]['id'] . '" to your button which should work as the form submitter for changing the product quantitites "manually". Run the snippet that you used above again, click the elemnt and you should see that now you "magically" have the products_id to use in the jQuery event listener. This can of course be done with whatever value that PHP cab output on an element as a property value. The reason why you should use data-productID="100" instead of e.g. rel="100" is because it's a HTML5 thing specifically designed for this kind of use. So the complete jQuery code which will listen for clicks on all elements that has it's chosen selector on them and whos only job is to submit the form when clicked on should look like this*/ $( "body").on( "click", ".submit_form_button", function( event ) { // Submit the Outer Form which encapsules this element // this.form.submit(); // Submit the Outer Form which encapsules this element with AJAX (preventing all elements on the page from updating) $.ajax({ type: 'POST', url: encodeURI($('form[name=cart_quantity]').attr('action')) + '&ajax=1', data: $('form[name=cart_quantity]').serialize(), success: function(data) { $("#content-body").html(data); }, dataType: 'html' }); $.ajax( { type: 'POST', // Type of Request (GET/POST) url: encodeURI($('form[name=cart_quantity]').attr('action')) + '&ajax=1', // Element to get the form url from. data: $('form[name=cart_quantity]').serialize(), // Data/Parameters send with the Request, this command will simply calculate and add all the currently set form information that's available form switches, checkboxes, textarea etc.. dataType: 'html', // Expected response: html, json etc. } ).done( function( data, status, xhr ) { // Here you put the code that shoule PROCESS the returned data object from the request. This Request to shopping_cart.php should give you the new updated html for the shopping cart which you now want to replace the old cart. // So.. Select Element with ID content-body and replace it's content with what was returned to us in the data object. (now containing html) $( "#content-body" ).html( data ); } ); }); // Remember that if you want a button to be solely functional with jQuery to set the button type="button" and not to "submit". While set to "button" then you can click all you want without risking any unwanted Page reloads or FORM submits. // Well, when you get this basic understanding on how you can combine PHP and jQuery so they can work together then I think all the "other stuff" will be easy to solve by googling whatever whistlers you want to blow. // E.g. changing the html for a specific element (like updating ORDER $$$ inside it) you can do this with very little effort /* Let's say that you have one or two elements with the class="current_order_total" added to them and that inside this tag you have the Order Total showed as a number with whatever weird decimal and thousands your selected currency uses. Let's say you own a very classy shop that only accept old Gold Rubles that simply is way too classy to be divided in decimals or thousands, it will simply always be an integer value (which hopefully can be rounded down.). // Notice to whoever managed to read this far: the author are now starting to have "difficulties" with focusing eyes, in fact, most of the expected brain functions are becoming more of a blur right now, so I think it's better to end this "Lesson" (or whatever the original intent was) before it turns ugly.. /* I'll have another drink, I think, to cool the troubled mind and then write one of many possible solutions to get & calculate the new order total from the HTML and finally updating whatever elemets that you want to show the order totals in. // Okay, feeling better already (¡!¡☺☺☺¡!¡) // Like I said, there's hundreds of possible ways to accomplish this. One would be to put a e.g. <span id="latest_order_total" style="display:none"><?php echo $currencies->format($cart->show_total()); ?></span> Somewhere, perhaps preferably someplace inside the form on shopping_cart.php, so that it updates every time the user updates the cart. And then update the event listener to replace the order total, full event should look something like this if you're using this tehnique */ $( "body").on( "click", ".submit_form_button", function( event ) { // Submit the Outer Form which encapsules this element // this.form.submit(); // Submit the Outer Form which encapsules this element with AJAX (preventing all elements on the page from updating) $.ajax( { type: 'POST', // Type of Request (GET/POST) url: encodeURI($('form[name=cart_quantity]').attr('action')) + '&ajax=1', // Element to get the form url from. data: $('form[name=cart_quantity]').serialize(), // Data/Parameters send with the Request, this command will simply calculate and add all the currently set form information that's available form switches, checkboxes, textarea etc.. dataType: 'html', // Expected response: html, json etc. } ).done( function( data, status, xhr ) { // Here you put the code that shoule PROCESS the returned data object from the request. This Request to shopping_cart.php should give you the new updated html for the shopping cart which you now want to replace the old cart. // So.. Select Element with ID content-body and replace it's content with what was returned to us in the data object. (now containing html) $( "#content-body" ).html( data ); // All right Sweetheart, almost done now, two final code snípers to solve the riddle // Since the entire cart has been refreshed (but only that and nothing more) you now have the new order total in the <span> with ID latest_order_total that you placed in shopping_cart.php // 1. Get the order total string and save it to a variable var new_order_total = $( "#latest_order_total" ).html(); // 2. All right, Sweetheart, as a last & final step, we want the string in new_order_total to be displayed in whatever element(s) you for some reason feel the urge to put it up for display. // So assuming you have class="current_order_total" on those element that you please, pretty please & if possible, would like to get the new flashy and very reasonable price updated attached on. // Select Element(s) - and then - change their inner html to value in new_order_total $( ".current_order_total" ).html( new_order_total ); /*** ¡¡¡ konke kwenziwa !!! ***/ } ); });
  23. Which browser are you using? In Google Chrome > Right click on the element that has the "wrong" size > select "Inspect Element" (I don't have the correct English term but it should be one of the bottom selections). Now make sure that you're on the "Elements" tab on the left part of the debugger tools and click on the "Computed" tab on the right. Find the offending CSS attribute and when you do find it, then expand it (by clicking the triangle shaped figure sitting to the left of the attribute). Now you should be able to see what file and specifically which line that made the offending CSS modification.
  24. Which PHP MySQL Module are you using? Regular (php5-mysql) or Native Driver (php5-mysqlnd)? I'm guessing that you're using the older php5-mysql Module, so if this is true then you should start by installing php5-mysqlnd instead. Anyhow, I notice that there was some errors in two pages that are used in the "Compatible without mysqlnd" release of this Add-On. ​Replace those files with the code below and I think that should solve your problems. Replace admin/includes/modules/order_handler/general_functions.php With This: <?php /* Advanced Order Handler Rev3 for osCommerce 2.3.3 Copyright (C) 2014 Jonas [email protected] This file is part of Advanced Order Handler Rev3. Advanced Order Handler Rev3 is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Advanced Order Handler Rev3 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Advanced Order Handler Rev3. If not, see <http://www.gnu.org/licenses/>. */ //// // The HTML href link with Static Content function tep_static_link($script, $type, $catalog = false, $cookieless = '', $version = null, $connection = 'SSL') { if ($catalog == true) $script = tep_catalog_href_link($script, (is_numeric($version) ? $version : ''), $connection); else $script = (($cookieless == true) ? HTTP_COOKIELESS_DOMAIN : '') . $script; if ($type == 'script') return '<script src="' . (($cookieless == true) ? HTTP_COOKIELESS_DOMAIN : '') . $script . '"></script>'; if ($type == 'link') return '<link rel="stylesheet" href="' . (($cookieless == true) ? HTTP_COOKIELESS_DOMAIN : '') . $script . '" />'; return "No link found"; } function tep_address($address_format, $address, $html, $boln, $eoln, $skip_name = false) { $company = tep_output_string_protected($address['company']); if ( ! $skip_name ) { if (isset($address['firstname']) && tep_not_null($address['firstname'])) { $firstname = tep_output_string_protected($address['firstname']); $lastname = tep_output_string_protected($address['lastname']); } elseif (isset($address['name']) && tep_not_null($address['name'])) { $firstname = tep_output_string_protected($address['name']); $lastname = ''; } else { $firstname = ''; $lastname = ''; } } $street = tep_output_string_protected($address['street_address']); $suburb = tep_output_string_protected($address['suburb']); $city = tep_output_string_protected($address['city']); $state = tep_output_string_protected($address['state']); if (isset($address['country_id']) && tep_not_null($address['country_id'])) { $country = tep_get_country_name($address['country_id']); if (isset($address['zone_id']) && tep_not_null($address['zone_id'])) { $state = tep_get_zone_code($address['country_id'], $address['zone_id'], $state); } } elseif (isset($address['country']) && tep_not_null($address['country'])) { $country = tep_output_string_protected($address['country']); } else { $country = ''; } $postcode = tep_output_string_protected($address['postcode']); $zip = $postcode; if ($html) { // HTML Mode $HR = '<hr />'; $hr = '<hr />'; if ( ($boln == '') && ($eoln == "\n") ) { // Values not specified, use rational defaults $CR = '<br />'; $cr = '<br />'; $eoln = $cr; } else { // Use values supplied $CR = $eoln . $boln; $cr = $CR; } } else { // Text Mode $CR = $eoln; $cr = $CR; $HR = '----------------------------------------'; $hr = '----------------------------------------'; } $statecomma = ''; $streets = $street; if ($suburb != '') $streets = $street . $cr . $suburb; if ($country == '') $country = tep_output_string_protected($address['country']); if ($state != '') $statecomma = $state . ', '; $fmt = $address_format; eval("\$address = \"$fmt\";"); if ( (ACCOUNT_COMPANY == 'true') && (tep_not_null($company)) ) { $address = $company . $cr . $address; } return $address; } //// // Returns AJAX Editable Address // TABLES: address_format function tep_editable_address( $address_format_id, $address, $html, $boln = '', $eoln = '', $ajax = '' ) { $tablename_af = TABLE_ADDRESS_FORMAT; $address_format = mysqli_prepared_query( "SELECT address_format AS format FROM $tablename_af WHERE address_format_id = ?", "i", array( $address_format_id ) ); $company = ( ( isset( $address['company'] ) && $address['company'] != '' ) ? ( ( $ajax != '' ) ? '<span id="company" data-table="orders" data-field="'.$ajax.'company" class="ajaxLink">' : '' ) . tep_output_htmlspecialchars( $address['company'] ) . ( ( $ajax != '' ) ? '</span>' : '' ) : '' ); if ( isset( $address['firstname'] ) && tep_not_null( $address['firstname'] ) ) { $firstname = tep_output_htmlspecialchars( $address['firstname'] ); $lastname = tep_output_htmlspecialchars( $address['lastname'] ); } elseif ( isset( $address['name'] ) && tep_not_null( $address['name'] ) ) { $firstname = ( ( $ajax != '' ) ? '<span id="delivery_name" data-table="orders" data-field="'.$ajax.'name" class="ajaxLink">' : '' ) . tep_output_htmlspecialchars( $address['name'] ) . ( ( $ajax != '' ) ? '</span>' : '' ); $lastname = ''; } else { $firstname = ''; $lastname = ''; } $street = ( ( $ajax != '' ) ? '<span id="street_address" data-table="orders" data-field="'.$ajax.'street_address" class="ajaxLink">' : '' ) . tep_output_htmlspecialchars( $address['street_address'] ) . ( ( $ajax != '' ) ? '</span>' : '' ); //Suburb $suburb = ! empty( $ajax ) ? '<span id="suburb" data-table="orders" data-field="'.$ajax.'suburb" class="ajaxLink">' : ''; if ( isset( $address['suburb'] ) && ! empty( $address['suburb'] ) ) { $suburb .= tep_output_htmlspecialchars( $address['suburb'] ) . ( ! empty( $ajax ) ? '</span>' : '' ); } elseif ( ! empty( $ajax ) ) { $suburb .= '___</span>'; } $city = ( ( $ajax != '' ) ? '<span id="city" data-table="orders" data-field="'.$ajax.'city" class="ajaxLink">' : '' ) . ( isset( $address['city'] ) ? tep_output_htmlspecialchars( $address['city'] ) : '' ) . ( ( $ajax != '' ) ? '</span>' : '' ); $state = ( ( $ajax != '' ) ? '<span id="state" data-table="orders" data-field="'.$ajax.'state" class="ajaxLink">' : '' ) . ( isset( $address['state'] ) ? tep_output_htmlspecialchars( $address['state'] ) : '' ) . ( ( $ajax != '' ) ? '</span>' : '' ); if ( isset( $address['country_id'] ) && tep_not_null( $address['country_id'] ) ) { $country = tep_get_country_name( $address['country_id'] ); if ( isset( $address['zone_id'] ) && tep_not_null( $address['zone_id'] ) ) { $state = tep_get_zone_code( $address['country_id'], $address['zone_id'], $state ); } } elseif ( isset( $address['country'] ) && tep_not_null( $address['country'] ) ) { $country_name = ( is_array( $address['country'] ) ? $address['country']['title'] : $address['country'] ); $country = ( ( $ajax != '' ) ? '<span id="country" data-table="orders" data-field="'.$ajax.'country" class="ajaxLink">' : '' ) . tep_output_htmlspecialchars( $country_name ) . ( ( $ajax != '' ) ? '</span>' : '' ); } else { $country = ''; } $postcode = ( ( $ajax != '' ) ? '<span id="postcode" data-table="orders" data-field="'.$ajax.'postcode" class="ajaxLink">' : '' ) . tep_output_htmlspecialchars( $address['postcode'] ) . ( ( $ajax != '' ) ? '</span>' : '' ); $zip = $postcode; if ( $html ) { // HTML Mode $HR = '<hr />'; $hr = '<hr />'; if ( ( $boln == '' ) && ( $eoln == "\n" ) ) { // Values not specified, use rational defaults $CR = '<br />'; $cr = '<br />'; $eoln = $cr; } else { // Use values supplied $CR = $eoln . $boln; $cr = $CR; } } else { // Text Mode $CR = $eoln; $cr = $CR; $HR = '----------------------------------------'; $hr = '----------------------------------------'; } $statecomma = ''; $streets = $street; if ( isset( $suburb ) && $suburb != '' ) $streets = $street . $cr . $suburb; if ( $country == '' ) $country = tep_output_htmlspecialchars( $address['country'] ); if ( isset( $address['state'] ) && $address['state'] != '' ) $statecomma = $state . ', '; $fmt = $address_format[0]['format']; eval( "\$address = \"$fmt\";" ); if ( ( ACCOUNT_COMPANY == 'true' ) && ( tep_not_null( $company ) ) ) { $address = $company . $cr . $address; } return $address; } //// // Returns an array with countries // TABLES: countries function tep_get_countries_jtable( $link = 'db_link' ) { global $$link; $countries_array = ''; $tablename_c = TABLE_COUNTRIES; $var = array(); $countries_query = tep_db_fetch_all( "SELECT countries_name FROM $tablename_c ORDER BY countries_name" ); $sql="SELECT countries_name AS Value, countries_name AS DisplayText FROM $tablename_c ORDER BY countries_name"; $rs=$$link->query( $sql ); if ( $rs === false ) { trigger_error( 'Wrong SQL: ' . $sql . ' Error: ' . $$link->error, E_USER_ERROR ); } $rs->data_seek( 0 ); while ( $row = $rs->fetch_assoc() ) { $var[] = $row; } return substr( json_encode( $var ), 1, -1 ); } //// // Returns a jTable formatted pull down menu with payment methods function tep_cfg_pull_down_payment( $selected_payment_module = '', $parameters = '', $custom = false, $required = false ) { global $language; if ( defined( 'MODULE_PAYMENT_INSTALLED' ) && tep_not_null( MODULE_PAYMENT_INSTALLED ) ) { $installed_modules = explode( ';', MODULE_PAYMENT_INSTALLED ); $include_modules = array(); $modules = array(); reset( $modules ); while ( list( , $value ) = each( $installed_modules ) ) { $class = substr( $value, 0, strrpos( $value, '.' ) ); $include_modules[] = array( 'class' => $class, 'file' => $value ); } for ( $i=0, $n=sizeof( $include_modules ); $i<$n; $i++ ) { include_once DIR_FS_CATALOG . DIR_WS_LANGUAGES . $language . '/modules/payment/' . $include_modules[$i]['file']; include_once DIR_FS_CATALOG . DIR_WS_MODULES . 'payment/' . $include_modules[$i]['file']; $modules[] = new $include_modules[$i]['class']; } } $payment_array = array(); $default = ''; $manual_default = ''; if ( true === $custom ) { $payment_array[] = array( 'id' => json_encode( array( "_custom", $selected_payment_module ) ), 'text' => $selected_payment_module, ); } foreach ( $modules as $value ) { $payment_array[] = array( 'id' => json_encode( array( $value->code, $value->title ) ), 'text' => $value->title, ); if ( $selected_payment_module == $value->title ) { $default = json_encode( array( $value->code, $selected_payment_module ) ); $manual_default = $selected_payment_module; } } array_push( $payment_array, array( 'id' => json_encode( array( '_manual', $manual_default ) ), 'text' => 'Manual Input', ) ); return tep_draw_pull_down_menu( 'payment_method_selection', $payment_array, $default, $parameters, $required ); } //// // Returns a pull down menu with payment methods function tep_cfg_pull_down_payment_methods( $payment_module = null ) { require DIR_WS_CLASSES . 'payment.php'; $payment_modules = new payment; $selection = $payment_modules->selection(); if ( sizeof( $selection ) > 1 ) { $SelectPaymentBox = '<select name="payment" style="max-width: 300px;">' . "\n"; for ( $i=0, $n=sizeof( $selection ); $i<$n; $i++ ) { $SelectPaymentBox .= '<option value="' . $selection[$i]['id'] .'">' . $selection[$i]['module']; } $SelectPaymentBox .= "</select>\n"; } else { $SelectPaymentBox = tep_draw_hidden_field( 'payment', $selection[$i]['id'] ) . '<span id="payment_module_selected">' . $selection[$i]['id'] . '</span>'; } return $SelectPaymentBox; } //// // Function used by Shopping Cart Class function tep_create_random_value( $length, $type = 'mixed' ) { if ( ( $type != 'mixed' ) && ( $type != 'chars' ) && ( $type != 'digits' ) ) $type = 'mixed'; $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $digits = '0123456789'; $base = ''; if ( ( $type == 'mixed' ) || ( $type == 'chars' ) ) { $base .= $chars; } if ( ( $type == 'mixed' ) || ( $type == 'digits' ) ) { $base .= $digits; } $value = ''; if ( !class_exists( 'PasswordHash' ) ) { include DIR_WS_CLASSES . 'passwordhash.php'; } $hasher = new PasswordHash( 10, true ); do { $random = base64_encode( $hasher->get_random_bytes( $length ) ); for ( $i = 0, $n = strlen( $random ); $i < $n; $i++ ) { $char = substr( $random, $i, 1 ); if ( strpos( $base, $char ) !== false ) { $value .= $char; } } } while ( strlen( $value ) < $length ); if ( strlen( $value ) > $length ) { $value = substr( $value, 0, $length ); } return $value; } //// // Return the tax description for a zone / class // TABLES: tax_rates; function tep_get_tax_description( $class_id, $country_id, $zone_id = 0 ) { static $tax_rates = array(); if ( !isset( $tax_rates[$class_id][$country_id][$zone_id]['description'] ) ) { $tax_query = tep_db_query( "select tax_description from " . TABLE_TAX_RATES . " tr left join " . TABLE_ZONES_TO_GEO_ZONES . " za on (tr.tax_zone_id = za.geo_zone_id) left join " . TABLE_GEO_ZONES . " tz on (tz.geo_zone_id = tr.tax_zone_id) where (za.zone_country_id is null or za.zone_country_id = '0' or za.zone_country_id = '" . (int)$country_id . "') and (za.zone_id is null or za.zone_id = '0' or za.zone_id = '" . (int)$zone_id . "') and tr.tax_class_id = '" . (int)$class_id . "' order by tr.tax_priority" ); if ( tep_db_num_rows( $tax_query ) ) { $tax_description = ''; while ( $tax = tep_db_fetch_array( $tax_query ) ) { $tax_description .= $tax['tax_description'] . ' + '; } $tax_description = substr( $tax_description, 0, -3 ); $tax_rates[$class_id][$country_id][$zone_id]['description'] = $tax_description; } else { $tax_rates[$class_id][$country_id][$zone_id]['description'] = TEXT_UNKNOWN_TAX_RATE; } } return $tax_rates[$class_id][$country_id][$zone_id]['description']; } function tep_count_modules($modules = '') { $count = 0; if (empty($modules)) return $count; $modules_array = explode(';', $modules); for ($i=0, $n=sizeof($modules_array); $i<$n; $i++) { $class = substr($modules_array[$i], 0, strrpos($modules_array[$i], '.')); if (isset($GLOBALS[$class]) && is_object($GLOBALS[$class])) { if ($GLOBALS[$class]->enabled) { $count++; } } } return $count; } function tep_count_payment_modules() { return tep_count_modules(MODULE_PAYMENT_INSTALLED); } function tep_count_shipping_modules() { return tep_count_modules(MODULE_SHIPPING_INSTALLED); } //// // Make a variable javascript compatible - ish1301 at gmail doooot com function tep_jsspecialchars( $string = '' ) { $string = preg_replace( "/\r*\n/", "\\n", $string ); $string = preg_replace( "/\//", "\\\/", $string ); $string = preg_replace( "/\"/", "\\\"", $string ); $string = preg_replace( "/'/", " ", $string ); return $string; } //// // Convert special characters to HTML entities // Will convert both double and single quotes. // Since the "charset" argument IS case sensitive, CONSTANT CHARSET is avoided function tep_output_htmlspecialchars( $string ) { return htmlspecialchars( $string, ENT_QUOTES, ( true === mb_http_output() ? mb_http_output() : 'UTF-8' ) ); } //// // Invoke Preload Scripts function tep_preload_scripts( $countries_iso_code_2, $minimized = false ) { if ( $minimized ) { echo tep_static_link( DIR_WS_MODULES . 'order_handler/js/01_order_handler_rev3.min.js', 'script', false, false, '0928' ); if ( file_exists( DIR_WS_MODULES . "order_handler/jTable/localization/jquery.jtable.$countries_iso_code_2.js" ) ) echo tep_static_link( DIR_WS_MODULES . "order_handler/jTable/localization/jquery.jtable.$countries_iso_code_2.js", 'script', false, false, '0928' ); return; } echo tep_static_link( DIR_WS_MODULES . 'order_handler/js/01_01_bootstrap-3.1.1.min.js', 'script', false, false, '0928' ); echo tep_static_link( DIR_WS_MODULES . 'order_handler/js/01_02_jquery.jtable.js', 'script', false, false, '0928' ); if ( file_exists( DIR_WS_MODULES . "order_handler/jTable/localization/jquery.jtable.$countries_iso_code_2.js" ) ) echo tep_static_link( DIR_WS_MODULES . "order_handler/jTable/localization/jquery.jtable.$countries_iso_code_2.js", 'script', false, false, '0928' ); echo tep_static_link( DIR_WS_MODULES . 'order_handler/js/01_03_order_handler_rev3_module.js', 'script', false, false, '0928' ); echo tep_static_link( DIR_WS_MODULES . 'order_handler/js/01_04_jquery.cookie.js', 'script', false, false, '0928' ); } //// // Invoke Preload Scripts function tep_afterload_scripts( $minimized = false ) { if ( $minimized ) { echo tep_static_link( DIR_WS_MODULES . 'order_handler/js/02_order_handler_rev3.min.js', 'script', false, false, '0928' ); return; } echo tep_static_link( DIR_WS_MODULES . 'order_handler/js/02_01_jquery.gritter.js', 'script', false, false, '0928' ); echo tep_static_link( DIR_WS_MODULES . 'order_handler/js/02_02_jquery.contextMenu.js', 'script', false, false, '0928' ); // Bootstrap MultiSelect // echo tep_static_link( DIR_WS_MODULES . 'order_handler/js/02_03_bootstrap-3.1.1.min.js', 'script', false, false, '0928' ); echo tep_static_link( DIR_WS_MODULES . 'order_handler/js/02_04_bootstrap-multiselect-3.1.1.js', 'script', false, false, '0928' ); // Qtip echo tep_static_link( DIR_WS_MODULES . 'order_handler/js/02_05_jquery.qtip.js', 'script', false, false, '0928' ); echo tep_static_link( DIR_WS_MODULES . 'order_handler/js/02_06_select2.rev3.js', 'script', false, false, '0928' ); echo tep_static_link( DIR_WS_MODULES . 'order_handler/js/02_07_icheck.js', 'script', false, false, '0928' ); echo tep_static_link( DIR_WS_MODULES . 'order_handler/js/02_08_switchery.js', 'script', false, false, '0928' ); echo tep_static_link( DIR_WS_MODULES . 'order_handler/js/02_09_tikslusdialog.js', 'script', false, false, '0928' ); echo tep_static_link( DIR_WS_MODULES . 'order_handler/js/02_10_history.js', 'script', false, false, '0928' ); echo tep_static_link( DIR_WS_MODULES . 'order_handler/js/02_11_jquery.simplemodal.js', 'script', false, false, '0928' ); echo tep_static_link( DIR_WS_MODULES . 'order_handler/js/02_12_amcharts.js', 'script', false, false, '0928' ); echo tep_static_link( DIR_WS_MODULES . 'order_handler/js/02_13_serial.js', 'script', false, false, '0928' ); } //// // Invoke CSS function tep_load_css( $minimized = false ) { if ( $minimized ) { echo tep_static_link( DIR_WS_MODULES . 'order_handler/css/01_order_handler_rev3.min.css', 'link', false, false, '0928' ); return; } echo tep_static_link( DIR_WS_MODULES . 'order_handler/css/01_01_font-awesome.css', 'link', false, false, '0928' ); echo tep_static_link( DIR_WS_MODULES . 'order_handler/css/01_02_bootstrap-3.1.1.min.css', 'link', false, false, '0928' ); echo tep_static_link( DIR_WS_MODULES . 'order_handler/css/01_03_bootstrap-multiselect-3.1.1.css', 'link', false, false, '0928' ); echo tep_static_link( DIR_WS_MODULES . 'order_handler/css/01_04_bootstrap-theme-custom.css', 'link', false, false, '0928' ); echo tep_static_link( DIR_WS_MODULES . 'order_handler/css/01_05_tikslusdialog.css', 'link', false, false, '0928' ); echo tep_static_link( DIR_WS_MODULES . 'order_handler/css/01_06_select2.css', 'link', false, false, '0928' ); echo tep_static_link( DIR_WS_MODULES . 'order_handler/css/01_07_red.css', 'link', false, false, '0928' ); echo tep_static_link( DIR_WS_MODULES . 'order_handler/css/01_08_jquery.contextMenu.css', 'link', false, false, '0928' ); echo tep_static_link( DIR_WS_MODULES . 'order_handler/css/01_09_orange.css', 'link', false, false, '0928' ); echo tep_static_link( DIR_WS_MODULES . 'order_handler/css/01_10_jtable-custom.css', 'link', false, false, '0928' ); echo tep_static_link( DIR_WS_MODULES . 'order_handler/css/01_11_contact.css', 'link', false, false, '0928' ); echo tep_static_link( DIR_WS_MODULES . 'order_handler/css/01_12_jquery.qtip.css', 'link', false, false, '0928' ); echo tep_static_link( DIR_WS_MODULES . 'order_handler/css/01_13_order_handler.css', 'link', false, false, '0928' ); } //// //Error Handling function error_message( $title, $message ) { $error_message = '<script> window.opener.oHandler.gritter( "' . $title . '", "' . $message . '", "fa-warning" ); self.close(); $( ".progress" ).show(); </script>'; die( $error_message ); } Replace ./admin/print_batch_process_3.php With This: <?php /* Advanced Order Handler Rev3 for osCommerce 2.3.3 Copyright (C) 2014 Jonas [email protected] This file is part of Advanced Order Handler Rev3. Advanced Order Handler Rev3 is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Advanced Order Handler Rev3 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Advanced Order Handler Rev3. If not, see <http://www.gnu.org/licenses/>. */ require 'includes/application_top.php'; require_once DIR_WS_MODULES . 'order_handler/general_functions.php'; require DIR_WS_CLASSES . 'currencies.php'; $currencies = new currencies(); //Define Tables to Variables $tablename_o = TABLE_ORDERS; $tablename_ot = TABLE_ORDERS_TOTAL; $tablename_c = TABLE_COUNTRIES; $tablename_osh = TABLE_ORDERS_STATUS_HISTORY; unset( $batch_order_numbers ); if ( $_POST['batch_order_numbers'] ) { foreach ( $_POST['batch_order_numbers'] as $order_number => $print_order ) { $batch_order_numbers[] = $order_number; } } // Uncomment this if you always want your orders sorted by order number //sort( $batch_order_numbers ); if ( !( is_array( $batch_order_numbers ) ) && !isset( $_POST['order_nums'] ) ) { error_message( "404: Not Found", "Error: no orders selected!" ); } else if ( isset( $_POST['batch_delete_x'] ) || isset( $_POST['batch_delete_y'] ) ) { include DIR_WS_LANGUAGES . $language . '/order_handler.php'; if ( isset( $_POST['batch_confirm_x'] ) || isset( $_POST['batch_confirm_y'] ) ) { die( include DIR_WS_MODULES . 'order_handler/oc_batch_delete.php' ); } else { die( include DIR_WS_MODULES . 'order_handler/oc_batch_delete_confirm.php' ); } } include DIR_WS_MODULES . 'order_handler/order_prepared.php'; $order = new order; if ( 'envelope' == $_POST['target_file'] ) { require DIR_WS_MODULES . 'order_handler/print_batch_envelope.php'; } elseif( 'export' == $_POST['target_file'] ) { #Export to XML header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); header('Content-Type: text/xml'); header('Content-Disposition: attachment; filename="'.date('Ymdhis').'.xml"'); $buffer[] = '<?xml version="1.0" encoding="utf-8"?>'."\r\n"; $buffer[] = '<your_shipping_here>'."\r\n"; foreach ($batch_order_numbers as $order_id) { if($order_id != "null") { $db_get = "SELECT o.orders_id,o.customers_id,o.customers_name,o.payment_method,o.delivery_name,o.delivery_company,o.delivery_street_address,o.delivery_suburb,o.delivery_city,o.delivery_postcode,o.delivery_state,o.delivery_country,o.customers_telephone,o.customers_email_address,ot.value,c.countries_iso_code_2 FROM $tablename_o o, $tablename_ot ot, $tablename_c c WHERE (o.orders_id = ot.orders_id AND ot.class = 'ot_total') AND (o.orders_id = ? AND o.delivery_country = c.countries_name) ORDER BY orders_id DESC LIMIT 1"; $db_res = mysqli_prepared_query($db_get, "i", array($order_id)); $db_ary = $db_res[0]; $buffer[] = "\t".'<receiver rcvid="'.$db_ary['orders_id'].'">'."\r\n"; $buffer[] = "\t\t".'<val n="name">'.$db_ary['delivery_name'].'</val>'."\r\n"; $buffer[] = "\t\t".'<val n="address1">'.$db_ary['delivery_street_address'].'</val>'."\r\n"; $buffer[] = "\t\t".'<val n="address2">'.$db_ary['delivery_suburb'].'</val>'."\r\n"; $buffer[] = "\t\t".'<val n="zipcode">'.$db_ary['delivery_postcode'].'</val>'."\r\n"; $buffer[] = "\t\t".'<val n="city">'.$db_ary['delivery_city'].'</val>'."\r\n"; $buffer[] = "\t\t".'<val n="country">'.$db_ary['countries_iso_code_2'].'</val>'."\r\n"; $buffer[] = "\t\t".'<val n="contact">'.$db_ary['customers_name'].'</val>'."\r\n"; $buffer[] = "\t\t".'<val n="phone">'.$db_ary['customers_telephone'].'</val>'."\r\n"; $buffer[] = "\t\t".'<val n="email">'.$db_ary['customers_email_address'].'</val>'."\r\n"; $buffer[] = "\t\t".'<val n="sms">'.$db_ary['customers_telephone'].'</val>'."\r\n"; $buffer[] = '</val>'."\r\n"; $buffer[] = "\t\t".'</container>'."\r\n"; $buffer[] = "\t".'</shipment>'."\r\n"; } } $buffer[] = '</your_shipping_here>'."\r\n"; die( implode('',$buffer) ); } elseif ( $_POST['target_file'] == 'labels' ) { //Create CSV for Envelope header( 'Content-type: application/csv' ); header( 'Content-Disposition: inline; filename="'.date( "ymd" ).'.csv"' ); echo "Name;Street address;Postcode;City;Country\n"; $order->prepare_query(); foreach ( $batch_order_numbers as $order_id ) { $order->query( $order_id ); echo "" . $order->delivery['name'] . ";" . $order->delivery['street_address'] . ";" . $order->delivery['postcode'] . ";" . $order->delivery['city'] . ";" . $order->delivery['country'] . "\n"; } $order->close_query(); exit; } $total_invoices = count( $batch_order_numbers ); ?> <!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; ?>"> <meta name="robots" content="noindex,nofollow"> <title><?php echo 'Invoices (' . $total_invoices . ')'; ?></title> <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> <script src="<?php echo tep_catalog_href_link( 'ext/jquery/jquery-2.1.0.min.js' ); ?>"></script> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF"> <div id="ajax_loader" style="display:block;"> <div id="loader_content"> <div class="circle"></div> <div class="circle1"></div> <div class="progress progress-striped active"> <div class="progress-bar" id="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%"> <span class="" style="color: rgb(255, 255, 255);font-weight: 400;">0 Updated</span> </div> </div> </div> </div> <script> $( ".progress" ).show(); </script> <?php $firstinvoice=1; $invoice = 0; $order->prepare_query(); //Let's iterate the Invoices foreach ( $batch_order_numbers as $order_id ) { $order->query( $order_id ); if ( $firstinvoice ) { $firstinvoice = 0; } else { echo '<br style="">'; } $invoice++; include DIR_WS_MODULES . 'order_handler/print_batch_invoice.php'; } $order->close_query(); ?> <script> $(function(){ $( "#ajax_loader" ).remove(); // Required for Print Page to work in Chrome <?php if ( "true" == $_POST['print'] ) { ?> setTimeout( function(){ window.print(); /*window.close();*/ }, 1 ); <?php } ?> }); </script> </body> </html> <?php //} // //Close open connections // $stmt_se->close(); // $stmt_o->close(); // $stmt_ot->close(); // $stmt_op->close(); // $stmt_opa->close(); require DIR_WS_INCLUDES . 'application_bottom.php';
×
×
  • Create New...