Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

jQuery/Ajax Advanced Order Handler for osCommerce 2.3.3


Recommended Posts

Hi!

 

I did a fresh install of OSC v2.3.3.4 and everything seems to work, except the create_order.php page which open totally blank.

 

I search in the previous posts but I couldn't find anything related. If anyone can help I appreciate!

 

Thanks

 

Hello Alex,

 

Can you check your PHP error log and reply with whatever warning/error messages you get.

 

I need to get some sleep now (again), but I'll check on it tomorrow.

Link to comment
Share on other sites

Hello Alex,

 

Can you check your PHP error log and reply with whatever warning/error messages you get.

 

I need to get some sleep now (again), but I'll check on it tomorrow.

 

This is the error log I got:

 

[02-Jun-2014 19:45:30 America/New_York] PHP Fatal error: Call to undefined method mysqli_result::fetch_all() in /home//public_html/osc/admin/create_order.php on line 89

 

I don't have any order or customer on the shop yet, I'm not if this implicate somehow...

 

Thank you for sharing such a great tool, it's so far one my favorites add ons.

Link to comment
Share on other sites

This is the error log I got:

 

[02-Jun-2014 19:45:30 America/New_York] PHP Fatal error: Call to undefined method mysqli_result::fetch_all() in /home//public_html/osc/admin/create_order.php on line 89

 

I don't have any order or customer on the shop yet, I'm not if this implicate somehow...

 

Thank you for sharing such a great tool, it's so far one my favorites add ons.

 

mysqli_stmt::get_result and mysqli_result::fetch_all requires that you have PHP version 5.3.0 or above and that you use the MySQL Native Driver

http://www.php.net/manual/en/intro.mysqlnd.php

 

 

If you, or someone else, for some reason can't use newer versions of PHP or mysqlnd. Then add this function to ./admin/includes/functions/database.php

 

 # Resembles mysqli_stmt::get_result
 # Compatability for PHP < 5.3.0 and without MySQL Native Driver support
 function mysqli_get_res( $stmt ) {
   $fields = $stmt->field_count;
   $meta = $stmt->result_metadata();

   for ( $i=0, $n = $fields; $i<$n; $i++ ) {
  $field = $meta->fetch_field();
  $params[ $field->name ] = &$row[ $field->name ];
   }

   call_user_func_array( array( $stmt, 'bind_result' ), $params );

   while( $stmt->fetch() )
  $result[] = $params;

   return $result;
 }

 

Then search your code in e.g. create_order.php for instances of get_result which should look something like this:

 

   $rs = $stmt_ad->get_result();
   $arr = $rs->fetch_all(MYSQLI_ASSOC);

 

Then modify and replace them with code that looks like this:

 

   $arr = mysqli_get_res( $stmt_ad );

 

Remember to replace the variable names.

 

In create_order.php around line 132, you will find code that looks like this:

 

   #Get the customers info
   $res = $stmt_se->get_result();
   while (($row = $res->fetch_assoc()))
    $order_query[] = $row;

 

This can also be replace with this:

 

   #Get the customers info
   $order_query = mysqli_get_res( $stmt_se );

 

There's probably more files from this Add-On where you need to do the same thing.

Link to comment
Share on other sites

mysqli_stmt::get_result and mysqli_result::fetch_all requires that you have PHP version 5.3.0 or above and that you use the MySQL Native Driver

http://www.php.net/manual/en/intro.mysqlnd.php

 

 

If you, or someone else, for some reason can't use newer versions of PHP or mysqlnd. Then add this function to ./admin/includes/functions/database.php

 

# Resembles mysqli_stmt::get_result
# Compatability for PHP < 5.3.0 and without MySQL Native Driver support
function mysqli_get_res( $stmt ) {
$fields = $stmt->field_count;
$meta = $stmt->result_metadata();

for ( $i=0, $n = $fields; $i<$n; $i++ ) {
 $field = $meta->fetch_field();
 $params[ $field->name ] = &$row[ $field->name ];
}

call_user_func_array( array( $stmt, 'bind_result' ), $params );

while( $stmt->fetch() )
 $result[] = $params;

return $result;
}

 

Then search your code in e.g. create_order.php for instances of get_result which should look something like this:

 

$rs = $stmt_ad->get_result();
$arr = $rs->fetch_all(MYSQLI_ASSOC);

 

Then modify and replace them with code that looks like this:

 

$arr = mysqli_get_res( $stmt_ad );

 

Remember to replace the variable names.

 

In create_order.php around line 132, you will find code that looks like this:

 

#Get the customers info
$res = $stmt_se->get_result();
while (($row = $res->fetch_assoc()))
 $order_query[] = $row;

 

This can also be replace with this:

 

#Get the customers info
$order_query = mysqli_get_res( $stmt_se );

 

There's probably more files from this Add-On where you need to do the same thing.

 

I checked with my cpanel and I do have the php 5.3 version running and mysql,mysqli, pdo, pdo_mysql, pdo_sqlite as active.

 

I'll try this mod.

Link to comment
Share on other sites

I checked with my cpanel and I do have the php 5.3 version running and mysql,mysqli, pdo, pdo_mysql, pdo_sqlite as active.

 

I'll try this mod.

 

You also need mysqlnd (MySQL Native Driver).

 

If you check phpinfo() or go to Tools => Server Info in you osC Admin Panel, there should be a section called mysqlnd.

Check the link I posted for information on how to enable it. If possible on your server, you should use mysqlnd.

Link to comment
Share on other sites

It did not work for me, I did the fresh install of oscommerce and this contribution, but only create_order doesn't work (blank). I checked the version of php and the mysql info below:

Database:

MySQL 5.1.73-cll PHP Version: 5.3.28 (Zend: 2.3.0)

mysql

MySQL Support enabled Active Persistent Links 0 Active Links 0 Client API version 5.1.73 MYSQL_MODULE_TYPE no value MYSQL_SOCKET /var/lib/mysql/mysql.sock MYSQL_INCLUDE no value MYSQL_LIBS no value

Directive Local Value Master Value mysql.allow_local_infile On On mysql.allow_persistent On On mysql.connect_timeout 60 60 mysql.default_host no value no value mysql.default_password no value no value mysql.default_port no value no value mysql.default_socket /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock mysql.default_user no value no value mysql.max_links Unlimited Unlimited mysql.max_persistent Unlimited Unlimited mysql.trace_mode Off Off

 

mysqli

MysqlI Support enabled Client API library version 5.1.73 Active Persistent Links 0 Inactive Persistent Links 0 Active Links 1 Client API header version 5.1.72 MYSQLI_SOCKET /var/lib/mysql/mysql.sock

Directive Local Value Master Value mysqli.allow_local_infile On On mysqli.allow_persistent On On mysqli.default_host no value no value mysqli.default_port 3306 3306 mysqli.default_pw no value no value mysqli.default_socket no value no value mysqli.default_user no value no value mysqli.max_links Unlimited Unlimited mysqli.max_persistent Unlimited Unlimited mysqli.reconnect Off Off

Link to comment
Share on other sites

You also need mysqlnd (MySQL Native Driver).

 

If you check phpinfo() or go to Tools => Server Info in you osC Admin Panel, there should be a section called mysqlnd.

Check the link I posted for information on how to enable it. If possible on your server, you should use mysqlnd.

 

I didn't find anything related to mysqlnd at the Server Info in osC Admin Panel, then I contacted my host, and they replied as follows:

 

Mysql native driver is already enabled in the server. Please see the details given below.

 

---

[~]# php -m | grep mysqlnd

mysqlnd

---

Now I don't know what exactly to do. I might wait for the newer version of this contribution.

Link to comment
Share on other sites

I didn't find anything related to mysqlnd at the Server Info in osC Admin Panel, then I contacted my host, and they replied as follows:

 

Mysql native driver is already enabled in the server. Please see the details given below.

 

---

[~]# php -m | grep mysqlnd

mysqlnd

---

Now I don't know what exactly to do. I might wait for the newer version of this contribution.

 

You should find the marked section in the attached image in your server info / phpinfo().

 

Another easy way to test for loaded extensions is to create a file in your admin, like ./admin/test.php, put this in it and then run it:

<?php
require 'includes/application_top.php';
var_dump(get_loaded_extensions());
die;
?>

 

In the output from that script you should find 'mysqlnd' somewhere.

 

If you can't find it, you might just have to enable it first in your php.ini file. Check if you can find the php.ini file and look for mysqlnd.

According to the cPanel wiki you should be able to find a php.ini at /usr/local/cpanel/3rdparty/etc or /var/cpanel/3rdparty/etc

 

I haven't used cPanel for years so you have to ask your host on how to use it. I found an old post which stated that if you have a file called /var/cpanel/easy/apache/rawopts/all_php5 then you could try to add this to that file:

--with-mysqli=mysqlnd

 

 

 

The next version of this Add-On will probably not work at all if you don't have those functions, so ask your host what you need to do to enable it.

 

 

 

The function I posted earlier should work, you could try with replacing your create_order.php with the one I used before when creating the function.

 

First, make sure you have this function in ./admin/includes/functions/database.php

 

 # Resembles mysqli_stmt::get_result
 # Compatability for PHP < 5.3.0 and without MySQL Native Driver support
 function mysqli_get_res( $stmt ) {
   $fields = $stmt->field_count;
   $meta = $stmt->result_metadata();

   for ( $i=0, $n = $fields; $i<$n; $i++ ) {
  $field = $meta->fetch_field();
  $params[ $field->name ] = &$row[ $field->name ];
   }

   call_user_func_array( array( $stmt, 'bind_result' ), $params );

   while( $stmt->fetch() )
  $result[] = $params;

   return $result;
 }

 

Then replace create_order.php with this:

 

<?php
/*
 $Id: create_order.php,v 1 2003/08/17 23:21:34 frankl Exp $

 Updated 2014/05/09 - Dr. Rolex

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

 #Connect
 $link = "db_link";
 global $$link;


 #Define Tables to Variables
 $tablename_c = TABLE_CUSTOMERS;
 $tablename_ab = TABLE_ADDRESS_BOOK;
 $tablename_z = TABLE_ZONES;
 $tablename_cs = TABLE_CURRENCIES;

 #Customer Search from jQuery Autocomplete
 if ( isset($_GET['term']) && !empty($_GET['term']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == "XMLHttpRequest" ) {

   #Get Available Customers
     $customers_name_test = preg_match_all('/([^\s]+)/', $_GET['term'], $customers_name);

   if ( count($customers_name[1]) > 1 ) {
  $params = array('ss', '%'.$customers_name[1][0].'%', '%'.$customers_name[1][1].'%');
  $typeDef = "ss";
  $search_query = " AND (customers_firstname like ? AND customers_lastname like ?) ";
   } else {
  $params = array('s', '%'.$customers_name[1][0].'%');
  $typeDef = "s";
  $search_query = " AND customers_firstname like ? ";
   }

   $sql_se = "select a.customers_id, a.customers_firstname, a.customers_lastname, CONCAT(a.customers_firstname, ' ', a.customers_lastname) as customers_name, CONCAT(ab.entry_street_address, ', ', ab.entry_postcode, ', ', ab.entry_city) as custeroms_address, ab.entry_company, ab.entry_city, z.zone_code from $tablename_c a, $tablename_ab ab LEFT JOIN $tablename_z z ON (ab.entry_zone_id = z.zone_id) WHERE a.customers_default_address_id = ab.address_book_id" . $search_query . "ORDER BY entry_company,customers_lastname";

   $stmt_se = $$link->stmt_init();

   #Create the prepared statement
   if(!$stmt_se->prepare($sql_se))
  die( json_encode( array( 'status' => 'error', 'message' => 'Preparing the SELECT statement failed: ' . htmlspecialchars($$link->error) ) ) );

   #Bind parameters to the query
   $ref = new ReflectionClass('mysqli_stmt');
   $method = $ref->getMethod("bind_param");
   $method->invokeArgs($stmt_se, $params);

   #Run the prepared statement
   if(!$stmt_se->execute())
  die( json_encode( array( 'status' => 'error', 'message' => 'Executing ORDERS failed: ' . htmlspecialchars($stmt_se->error) ) ) );

   #Get the customers info
   $order_query = mysqli_get_res( $stmt_se );

   #Close open connections
   $stmt_se->close();

  $return_arr = array();
  foreach ($order_query as $row) {
    $row_array['id'] = tep_href_link(FILENAME_CREATE_ORDER, 'Customer=' . (int)$row['customers_id']);
    $row_array['value'] = $row['customers_name'] . ': ' . $row['custeroms_address'];

    array_push($return_arr, $row_array);
  }

  echo json_encode($return_arr);
  tep_exit();
   }

   if (isset($_GET['Customer_nr'])) $_GET['Customer'] = $_GET['Customer_nr'];

   $sql_se = "SELECT c.customers_id, c.customers_firstname, c.customers_lastname, ab.entry_company, ab.entry_city, z.zone_code FROM $tablename_c c, $tablename_ab ab LEFT JOIN $tablename_z z ON (ab.entry_zone_id = z.zone_id) WHERE c.customers_default_address_id = ab.address_book_id  ORDER BY entry_company, customers_lastname LIMIT 100";

   //$stmt_se = $$link->stmt_init();

   #Execute Query
   $rs = $$link->query($sql_se);
   if ($rs === false)
  die( json_encode( array( 'status' => 'error', 'message' => 'Preparing the SELECT statement failed: ' . htmlspecialchars($$link->error) ) ) );

   #Store all values to Array & Get Customer Count
   //$result = $rs->fetch_all(MYSQLI_ASSOC);
   //$result = $rs->fetch_array(MYSQLI_ASSOC);
   while ($res = $rs->fetch_array(MYSQLI_ASSOC))
  $result[] = $res;

   $customer_count = $rs->num_rows;

   if (count($result)) {
   #Create Selection Drop Down
   $SelectCustomerBox = "<select name=\"Customer\" id=\"Customer\"><option value=\"\">" . TEXT_SELECT_CUST . "</option>\n";

   foreach ($result as $db_Row) {

  $SelectCustomerBox .= "<option value=\"" . $db_Row['customers_id'] . "\"";

  if( isset($_GET['Customer']) && $db_Row['customers_id'] == $_GET['Customer'] ){
    $SelectCustomerBox .= " SELECTED ";
    $SelectCustomerBox .= ">" . (empty($db_Row['entry_company']) ? "": strtoupper($db_Row['entry_company']) . " - " ) . $db_Row['customers_lastname'] . " , " . $db_Row['customers_firstname'] . " - " . $db_Row['entry_city'] . ", " . $db_Row['zone_code'] . "</option>\n";
  }else{
    $SelectCustomerBox .= ">" . (empty($db_Row['entry_company']) ? "": strtoupper($db_Row['entry_company']) . " - " ) . $db_Row['customers_lastname'] . " , " . $db_Row['customers_firstname'] . " - " . $db_Row['entry_city'] . ", " . $db_Row['zone_code'] . "</option>\n";
  }
   }

   $SelectCustomerBox .= "</select>\n";
 }

   $sql = "SELECT code, value FROM $tablename_cs ORDER BY code";
 $rs = $$link->query($sql);

 if($rs === false)
   die( json_encode( array( 'status' => 'error', 'message' => 'Preparing the SELECT statement failed: ' . htmlspecialchars($$link->error) ) ) );

 $rs->data_seek(0);

   if (count($rs)){
     // Query Successful
     $SelectCurrencyBox = "<select name=\"Currency\"><option value=\"\">" . TEXT_SELECT_CURRENCY . "</option>\n";
     while($db_Row = $rs->fetch_assoc()){
  	 $SelectCurrencyBox .= "<option value='" . $db_Row["code"] . "," . $db_Row["value"] . "'";

  	 if ($db_Row["code"] == DEFAULT_CURRENCY){
  	   $SelectCurrencyBox .= " SELECTED ";
  	 }

  	 $SelectCurrencyBox .= ">" . $db_Row["code"] . "</option>\n";
     }
     $SelectCurrencyBox .= "</select>\n";
   }

 $rs->free();

// load all enabled payment modules
 $dir = getcwd();
 chdir("../");
 require(DIR_WS_CLASSES . 'payment.php');
 $payment_modules = new payment;
 $selection = $payment_modules->selection();  

 if (sizeof($selection) > 1) {
   $SelectPaymentBox = '<select name="payment">' . "\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']);
 }

 require(DIR_WS_CLASSES . 'shipping.php');
 $shipping_modules = new shipping;

// get all available shipping quotes
 $quotes = $shipping_modules->quote();

 if (sizeof($selection) > 1) {
   $SelectShippingBox = '<select name="shipping">' . "\n";
   for ($i=0, $n=sizeof($quotes); $i<$n; $i++) {
  $SelectShippingBox .= '<option value="' . $quotes[$i]['id'] .'">' . $quotes[$i]['module'];
   }
   $SelectShippingBox .= "</select>\n";
 } else {
   $SelectShippingBox = tep_draw_hidden_field('shipping', $quotes[$i]['id']);
 }
 chdir($dir);


   if(isset($_GET['Customer'])){
   #SQL Query
   $sql_account = "SELECT * FROM $tablename_c WHERE customers_id = ?";
   $sql_address = "SELECT * FROM $tablename_ab WHERE customers_id = ?";

   #Prepare statements
   $stmt_ac = $$link->prepare($sql_account);
   if($stmt_ac === false)
  die( json_encode( array( 'status' => 'error', 'message' => 'Preparing '.$sql_account.' failed: ' . htmlspecialchars($$link->error) ) ) );
   $stmt_ad = $$link->prepare($sql_address);
   if($stmt_ad === false)
  die( json_encode( array( 'status' => 'error', 'message' => 'Preparing '.$sql_address.' failed: ' . htmlspecialchars($$link->error) ) ) );

   #Bind parameters. Types: s = string, i = integer, d = double,  b = binary
   $stmt_ac->bind_param('i', $_GET['Customer']);
   $stmt_ad->bind_param('i', $_GET['Customer']);

   #Execute statement
   $stmt_ac->execute();

   $arr = mysqli_get_res($stmt_ac);

   $account = $arr[0];
   $customers_id = $arr[0]['customers_id'];
   $stmt_ac->close();

   #Execute statement
   $stmt_ad->execute();

   $arr = mysqli_get_res($stmt_ad);
   $address = $arr[0];
   $stmt_ad->close();

   } elseif (isset($_GET['Customer_email'])) {
   #SQL Query
   $sql_account = "SELECT * FROM $tablename_c WHERE customers_email_address = ?";
   $sql_address = "SELECT * FROM $tablename_ab WHERE customers_id = ?";

   #Prepare statements
   $stmt_ac = $$link->prepare($sql_account);
   if($stmt_ac === false)
  die( json_encode( array( 'status' => 'error', 'message' => 'Preparing '.$sql_account.' failed: ' . htmlspecialchars($$link->error) ) ) );
   $stmt_ad = $$link->prepare($sql_address);
   if($stmt_ad === false)
  die( json_encode( array( 'status' => 'error', 'message' => 'Preparing '.$sql_address.' failed: ' . htmlspecialchars($$link->error) ) ) );

   #Bind parameters. Types: s = string, i = integer, d = double,  b = binary
   $stmt_ac->bind_param('s', $_GET['Customer_email']);
   $stmt_ad->bind_param('i', $customers_id);

   #Execute statement
   $stmt_ac->execute();

   $arr = mysqli_get_res($stmt_ac);
   $account = $arr[0];
   $customers_id = $arr[0]['customers_id'];
   $stmt_ac->close();

   #Execute statement
   $stmt_ad->execute();

   $arr = mysqli_get_res($stmt_ad);
   $address = $arr[0];
   $stmt_ad->close();

   }

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CREATE_ORDER_PROCESS);

 if (!isset($_GET['ajax'])) {
   require(DIR_WS_INCLUDES . 'template_top.php');
 } else {
 echo '
 <div class="ajaxCreateOrder">
   <div id="ajax_cart_top"><button type="button" class="closeWindow close">×</button></div>';
 }

 require('includes/form_check.js.php');
 $JQUERY_DATEPICKER_FORMAT = JQUERY_DATEPICKER_FORMAT;
 echo <<<EOD
 <script type="text/javascript">
   JQUERY_DATEPICKER_FORMAT = '$JQUERY_DATEPICKER_FORMAT';
 </script>
EOD;
 ?>

<script language="javascript" type="text/javascript"><!--
$(function() {
 var cache = {};
 $("#cust_select_name_field").autocomplete({
 // source: "autocomplete.php",
  minLength: 2,
  select: function(event, ui) {
    window.location  = (ui.item.id);
  },
  source: function( request, response ) {
    var term = request.term;
    if ( term in cache ) {
	  response( cache[ term ] );
	  return;
    }

    $.getJSON( "create_order.php", request, function( data, status, xhr ) {
	  cache[ term ] = data;
	  response( data );
    });
  }
 }).data("ui-autocomplete")._renderItem = function( ul, item ) {
  return $( "" )
  .data( "item.autocomplete", item )
  .append( "<a href='" + item.id + "' onclick='return false;'>"+ item.value + "</a>" )
  .appendTo( ul );
 };

 $('#customers_dob').datepicker({dateFormat: '<?php echo JQUERY_DATEPICKER_FORMAT; ?>'
, changeMonth: true, changeYear: true, yearRange: '-100:-18', defaultDate: "-30y"});

 $( "body" ).on('change', '#Customer', function( event ) {
   $( this ).closest( "form" ).submit();
 });

 $( "body" ).on( "click", ".create_and_send", function( event ) {
   var form = this.form,
    input = '<input type="hidden" name="email_customer" value="true">';

   if ( check_form( form ) === false ) return false;

   $( form ).append( input );
   return form.submit();
 });

});

function selectExisting() {
 document.create_order.customers_create_type.value = 'existing';
 selectorsStatus(false);
 selectorsExtras(true);
}
function selectNew() {
 document.create_order.customers_create_type.value = 'new';
 selectorsStatus(true);
 selectorsExtras(false);
}
function selectNone() {
 document.create_order.customers_create_type.value = 'none';
 selectorsStatus(true);
 selectorsExtras(true);
}
function selectorsStatus(status) {
 document.cust_select.Customer.disabled = status;
 $( "#cust_select_id_field" ).prop( 'disabled', status );
 $( "#cust_select_id_button" ).prop( 'disabled', status );
 $( "#cust_select_email_field" ).prop( 'disabled', status );
 $( "#cust_select_email_button" ).prop( 'disabled', status );
 $( "#cust_select_name_field" ).prop( 'disabled', status );
 $( "#cust_select_name_button" ).prop( 'disabled', status );
}
function selectorsExtras(status) {
 $( "#customers_password" ).prop( 'disabled', status );
 $( "#customers_newsletter" ).prop( 'disabled', status );
<?php if (ACCOUNT_DOB == 'true') { ?>
 $( "#customers_dob" ).prop( 'disabled', status );
<?php } ?>
<?php if (ACCOUNT_GENDER == 'true') { ?>
 document.create_order.customers_gender[0].disabled = status;
 document.create_order.customers_gender[1].disabled = status;
<?php } ?>
}
//--></script>

<div id="createOrderTable" class="contentContainer" onload="selectorsExtras(true)" style="text-align:left;float:left;width:500px;">

   <h2 class="pageHeading" style="text-align:center;"><?php echo HEADING_TITLE; ?></h2>

   <table border="0" width="100%" class="dataTableHeadingRow">
  <tr>
    <td class="dataTableHeadingContent"><?php echo TEXT_STEP_1; ?></td>
  </tr>
   </table>
   <table width="100%" border="0" cellpadding="0" cellspacing="0" id="boxcart-content-table">
  <tr>
    <td class="main" valign="top">

	    <table border="0" cellpadding="0" cellspacing="0" width="100%" class="formArea">
		  <tr>
		    <td class="main" valign="top">

		    <table width="100%" border="0" cellpadding="3" cellspacing="0">
			  <tr>
			    <td class="main" valign="top"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
			    <td class="main" valign="top"></td>
			  </tr>
		    <?php if ($customer_count > 0){ ?>
			  <tr>
			    <td class="main" valign="top"><input name="handle_customer" id="existing_customer" value="existing" type="radio" checked="checked" onclick="selectExisting();" /></td>
			    <td class="main" valign="top"><label for="existing_customer" style="cursor:pointer;"><?php echo CREATE_ORDER_TEXT_EXISTING_CUST; ?></label></td>
			  </tr>
			  <tr>
			    <td class="main" valign="top"></td>
			    <td class="main" valign="top">
			    <?php
			    echo "<form action='".tep_href_link(FILENAME_CREATE_ORDER)."' method=\"GET\" name=\"cust_select\" id=\"cust_select\">\n";
			    echo tep_hide_session_id();
			    echo "<table width='100%' border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
			    echo "<tr>\n";
			    echo "<td>$SelectCustomerBox</td>\n";
			   // echo "<td width='20%'><input type=\"submit\" value=\"" . BUTTON_SUBMIT . "\" name=\"cust_select_button\" id=\"cust_select_button\"></td>\n";
			    echo "</tr>\n";
			    echo "</table>\n";
			    echo "</form>\n";
			    ?>
			    </td>
			  </tr>
			  <tr>
			    <td class="main" valign="top"></td>
			    <td class="main" valign="top"></td>
			  </tr>
			  <tr>
			    <td class="main" valign="top"></td>
			    <td class="main" valign="top">
			    <?php
			    echo "<form action='".tep_href_link(FILENAME_CREATE_ORDER)."' method=\"GET\" name=\"cust_select_id\" id=\"cust_select_id\">\n";
			    echo tep_hide_session_id();
			    echo "<table width='100%' border=\"0\" cellspacing=\"0\" cellpadding=\"4\">\n";
			    echo "<tr>\n";
			    echo "<td width='75%'>" . TEXT_OR_BY_ID . "<font class=main><input type=text name=\"Customer_nr\" name=\"cust_select_id_field\" id=\"cust_select_id_field\"></td>\n";
			    echo "<td width='10%'><input type=\"submit\" value=\"" . BUTTON_SUBMIT . "\" name=\"cust_select_id_button\" id=\"cust_select_id_button\"></td>\n";
			    echo "</tr>\n";
			    echo "</table>\n";
			    echo "</form>\n";
			    ?>
			    </td>
			  </tr>
			  <tr>
			    <td class="main" valign="top"></td>
			    <td class="main" valign="top">
			    <?php
			    echo "<form action='".tep_href_link(FILENAME_CREATE_ORDER)."' method=\"GET\" name=\"cust_select_email\" id=\"cust_select_email\">\n";
			    echo tep_hide_session_id();
			    echo "<table width='100%' border=\"0\" cellspacing=\"0\" cellpadding=\"4\">\n";
			    echo "<tr>\n";
			    echo "<td width='75%'>" . TEXT_OR_BY_EMAIL . tep_draw_input_field('Customer_email', '', 'id="cust_select_email_field"') . "</td>\n";
			    echo "<td width='10%'><input type=\"submit\" value=\"" . BUTTON_SUBMIT . "\" name=\"cust_select_email_button\" id=\"cust_select_email_button\"></td>\n";
			    echo "</tr>\n";
			    echo "</table>\n";
			    echo "</form>\n";
			    ?>
			    </td>
			  </tr>
			  <tr>
			    <td class="main" valign="top"></td>
			    <td class="main" valign="top">
			    <?php
			    echo "<form action='".tep_href_link(FILENAME_CREATE_ORDER)."' method=\"GET\" name=\"cust_select_name\" id=\"cust_select_name\">\n";
			    echo tep_hide_session_id();
			    echo "<table width='100%' border=\"0\" cellspacing=\"0\" cellpadding=\"4\">\n";
			    echo "<tr>\n";
			    echo "<td width='75%'>" . TEXT_OR_BY_NAME . tep_draw_input_field('Customer_name', '', 'id="cust_select_name_field"') . "</td>\n";
			    echo "<td width='10%'><input type=\"submit\" value=\"" . BUTTON_SUBMIT . "\" name=\"cust_select_name_button\" id=\"cust_select_name_button\"></td>\n";
			    echo "</tr>\n";
			    echo "</table>\n";
			    echo "</form>\n";
			    ?>
			    </td>
			  </tr>
			  <tr>
			    <td class="main" valign="top"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
			    <td class="main" valign="top"></td>
			  </tr>
		   <?php } ?>
			  <tr>
			    <td class="main" valign="top"><input name="handle_customer" id="new_customer" value="new" type="radio" onclick="selectNew();"></td>
			    <td class="main" valign="top"><label for="new_customer" style="cursor:pointer;"><?php echo CREATE_ORDER_TEXT_NEW_CUST; ?></label></td>
			  </tr>
			  <tr>
			    <td class="main" valign="top"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
			    <td class="main" valign="top"></td>
			  </tr>
			  <tr>
			    <td class="main" valign="top"><input name="handle_customer" id="no_customer" value="none" type="radio" onclick="selectNone();"></td>
			    <td class="main" valign="top"><label for="no_customer" style="cursor:pointer;"><?php echo CREATE_ORDER_TEXT_NO_CUST; ?></label></td>
			  </tr>
			  <tr>
			    <td class="main" valign="top"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
			    <td class="main" valign="top"></td>
			  </tr>
		    </table>

		    </td>
		  </tr>
	    </table>

    </td>
  </tr>
   </table>
   <?php if (!empty($_GET['message'])) { ?>
   <br>
   <table border="0" width="100%" style=" background-color:#FF0000; height:40px;">
  <tr>
    <td class="dataTableHeadingContent"><?php echo $_GET['message']; ?></td>
  </tr>
   </table>
   <?php } ?>
   <br>
   <table border="0" width="100%" class="dataTableHeadingRow">
  <tr>
    <td class="dataTableHeadingContent"><?php echo TEXT_STEP_2; ?></td>
  </tr>
   </table>

   <?php echo tep_draw_form('create_order', FILENAME_CREATE_ORDER_PROCESS, '', 'post', (!isset($_GET['ajax']) ? 'onsubmit="return check_form(this);" id="create_order"' : 'id="create_order"')) . tep_draw_hidden_field('customers_create_type', 'existing', 'id="customers_create_type"') . tep_hide_session_id(); ?>
   <table width="100%" border="0" cellpadding="0" cellspacing="0">
   <tr>
  <td><?php
	  require(DIR_WS_MODULES . 'create_order_details.php');
    ?>
  </td>
   </tr>
   <tr>
  <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
   </tr>
   <tr>
  <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
    <tr>
	  <td class="main" align="left">
           <?php echo (isset($_GET['ajax']) ? tep_draw_button(IMAGE_BACK, 'triangle-1-w', null, 'secondary', array('params' => 'class="closeWindow"')) : ''); ?></td>
	  <td class="main" align="right"><?php echo tep_draw_button(IMAGE_SEND_EMAIL . ' & '.IMAGE_SAVE, null, null, 'secondary', array('type' => 'button', 'params' => 'class="create_and_send"')); ?></td>
	  <td class="main" align="right"><?php echo tep_draw_button(IMAGE_SAVE, null, null, 'primary'); ?></td>
    </tr>
  </table></td>
   </tr>
 </table></form></td>
<!-- body_text_eof //-->
 </tr>
</table>
<?php
if (isset($_GET['ajax'])) {
 echo <<<EOD
 <script type="text/javascript">
 $(function(){
   var width = $('#boxcart-content-table').width();
   var height = $('#boxcart-content-table').height();

   $('.ajax_cart')
  .css("width", width);
   $( "#ajax_cart_dialog" ).dialog( "option", "position", { my: "center", at: "center" } );
 });
 selectorsExtras(true);
 </script>
EOD;
 echo '</div></div>';
 tep_exit();
} ?>

<script language="javascript" type="text/javascript"><!--
selectorsExtras(true);
//--></script>

</div>
<?php
require(DIR_WS_INCLUDES . 'template_bottom.php');
require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

 

If it doesn't work, check the PHP error log again.

Edited by Dr. Rolex
Link to comment
Share on other sites

You should find the marked section in the attached image in your server info / phpinfo().

 

Another easy way to test for loaded extensions is to create a file in your admin, like ./admin/test.php, put this in it and then run it:

<?php
require 'includes/application_top.php';
var_dump(get_loaded_extensions());
die;
?>

 

In the output from that script you should find 'mysqlnd' somewhere.

 

If you can't find it, you might just have to enable it first in your php.ini file. Check if you can find the php.ini file and look for mysqlnd.

According to the cPanel wiki you should be able to find a php.ini at /usr/local/cpanel/3rdparty/etc or /var/cpanel/3rdparty/etc

 

I haven't used cPanel for years so you have to ask your host on how to use it. I found an old post which stated that if you have a file called /var/cpanel/easy/apache/rawopts/all_php5 then you could try to add this to that file:

--with-mysqli=mysqlnd

 

If it doesn't work, check the PHP error log again.

 

I contacted my host, and got this answer:

 

"Mysqlnd cannot be enabled in shared server accounts. You can install it on cloud or a dedicated servers. Please see the URL given below for purchasing cloud or dedicated servers."

 

I'm not sure if this is correct...

 

I changed the database.php and create_order.php, now it does show the page, but it's functionality not. I get this erro message if I choose an existing customer for example:

 

2014 - Commands out of sync; you can't run this command now

 

select count(*) as total from sessions where sesskey = 'aqp2bl8icqem8hpmva69p5hh31'

 

[TEP STOP]

 

This is new error log:

 

[03-Jun-2014 15:07:48 America/New_York] PHP Fatal error: Call to undefined function mysqli_get_res() in /home//public_html/catalog/admin/create_order.php on line 192

Edited by alsomean
Link to comment
Share on other sites

I contacted my host, and got this answer:

 

"Mysqlnd cannot be enabled in shared server accounts. You can install it on cloud or a dedicated servers. Please see the URL given below for purchasing cloud or dedicated servers."

 

I'm not sure if this is correct...

 

I changed the database.php and create_order.php, now it does show the page, but it's functionality not. I get this erro message if I choose an existing customer for example:

 

2014 - Commands out of sync; you can't run this command now

 

select count(*) as total from sessions where sesskey = 'aqp2bl8icqem8hpmva69p5hh31'

 

[TEP STOP]

 

This is new error log:

 

[03-Jun-2014 15:07:48 America/New_York] PHP Fatal error: Call to undefined function mysqli_get_res() in /home//public_html/catalog/admin/create_order.php on line 192

 

 

If I were you Alex, I would consider another service provider.

 

You shouldn't have to get a dedicated server just to get a reasonable PHP version with mysqlnd support. I wouldn't recommend to start with a dedicated server if you're not familiar with basic Linux terminal syntax.

 

 

PHP 5.3.0 was released on 30 Jun 2009, almost 5 years ago.

 

Get a web hosting provider with at least PHP 5.4.X and MySQL 5.5.X.

 

A dedicated server is of course preferable, perhaps you could install a Linux distro like Ubuntu on a virtual machine on your computer and try it first?

Or are you're perhaps already a skilled Linux geek? ;=)

 

I only use shared hosting on some minor test projects, so I don't have a lot of experience from them, but among the international ones, Hostgator is a reputable one which will probably offer everything you need.

Link to the technologies they offer: https://support.hostgator.com/articles/hosting-guide/hardware-software/compatible-technologies

 

Some other modules I can think of that can be of value for most is a opcode caching module like php_apc, mod_security, mod_headers or something to set Cache-Control (I would guess that most web host providers have this since they benefit from the reduced bandwidth) and of course SSL support.

 

It looks like you get most of this for a bit over 100 USD a year. I don't know if that is considered a high or low price, but at least they're reputable.

 

 

This is new error log:

 

[03-Jun-2014 15:07:48 America/New_York] PHP Fatal error: Call to undefined function mysqli_get_res() in /home//public_html/catalog/admin/create_order.php on line 192

 

It looks like you either didn't put the new function in database.php or for some reason it isn't registered.

 

You could try with removing the mysqli_get_res from database.php and instead put it at the top of create_order.php, e.g. under:

 require('includes/application_top.php');

 

Link to comment
Share on other sites

Sorry, just noticed your post, I have been sick in bed for 2 days - and now a little trouble sleeping ...

 

At first glance the LEFT in the join is not needed, I believe you will have records in each of the other tables joined.

But that doesn't really make a difference

 

There is something about index selectivity, which means that if an index contains mostly the same values, the database engine figures it might as wel do a table scan.

Some background for mysql is here

http://dev.mysql.com/doc/refman/5.5/en/myisam-index-statistics.html

 

I'll have a closer look tomorrow ie later today, it is now 5AM here, time to try sleeping again ...

 

This is where I'm now.

 

SELECT
   o.orders_id,
   o.customers_id,
   o.customers_name,
   o.customers_company,
   o.delivery_street_address,
   o.delivery_suburb,
   o.delivery_city,
   o.delivery_postcode,
   o.delivery_state,
   o.delivery_state,
   o.delivery_country,
   o.customers_telephone,
   o.customers_email_address,
   o.date_purchased,
   o.orders_id,
   o.payment_method,
   osh.comments,
   ot.text AS order_total,
   (SELECT
	    orders_status_name
    FROM
	    orders_status
    WHERE
	    orders_status_id = o.orders_status
		    AND language_id = 1) as orders_status_name,
   (SELECT
	    sum(products_quantity)
    FROM
	    orders_products
    WHERE
	    orders_id = o.orders_id
    GROUP BY orders_id) as products_quantity
FROM
   orders o
    JOIN
   orders_status_history osh USING (orders_id)
    JOIN
   orders_total ot USING (orders_id)
WHERE
   ot.class = 'ot_total'
    AND o.orders_status = 1
    AND osh.date_added = o.date_purchased
ORDER BY orders_id DESC
LIMIT 0 , 100;

 

Now it's using an index from all tables and execution time is down to 0.045 sec. :)

Link to comment
Share on other sites

I was just looking at this again, looking up your original query to see how to rewrite it.

my orders table for testing has about 10000 records with 10 in status 1. execution time is 0.999 seconds.

 

the query looks a bit unorthodox, but if it works and is fast, why not.

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

I was just looking at this again, looking up your original query to see how to rewrite it.

my orders table for testing has about 10000 records with 10 in status 1. execution time is 0.999 seconds.

 

the query looks a bit unorthodox, but if it works and is fast, why not.

 

Yeah, it's pretty messy. But this is (so far) the only way I can do it without doing a full table/index scan. If doing it without the subqueries, the best I could get was a full index scan on orders_status_history.

 

I tried resetting the indexes to osc default and with those I got a full index scan on orders, 15 rows returned of total 50000 records (in orders), execution time 0.17 seconds and this was done on localhost.

 

After adding index to orders.orders_status

 

ALTER TABLE `orders` ADD INDEX `idx_orders_orders_status` USING BTREE (orders_status);

 

I got "Non-Unique Key Lookup" on all tables and execution time 0.042 seconds.

Link to comment
Share on other sites

@@alsomean & @@Dr. Rolex

 

Let me say firstly, this is an awesome module!

 

However, I had the same problem as alsomean with installing this module.  I have my own server, it's all working 100% right at the moment apart from this one module, also I have CentOS 6 with Parallels Plesk Panel 11.5 (yeah, I didn't know till it was bought by my company and they bought a year up front.... :P) which doesn't have mysqlnd installed as standard.

 

Instead of attempting to rewrite your code  ;)  i went to the previous version that you based yours on.  I took the create_order.php and create_order_process.php (changed the very last line of create_order_process.php to use Dr. Rolex's order_handler.php also included the sql statement putting an extra line into orders) and this all works fine now.

 

I do however have an issue with the order_handler.php, as far as TAX is concerned.  If I make an order with the order creater then it doesn't look for or put tax into the equation. :P  You'll probably say it's the OLD create_order.php page I'm now using. But this seems to be the only issue I have now.   I have got something to work, putting a tax query in, and then copying it with a ($order->products[$i]['tax'] = round($tax_class['tax_rate'], 2)) statement and then putting it back into the database.

 

Any ideas what this issue could be?

Link to comment
Share on other sites

@@alsomean & @@Dr. Rolex

 

Let me say firstly, this is an awesome module!

 

However, I had the same problem as alsomean with installing this module.  I have my own server, it's all working 100% right at the moment apart from this one module, also I have CentOS 6 with Parallels Plesk Panel 11.5 (yeah, I didn't know till it was bought by my company and they bought a year up front.... :P) which doesn't have mysqlnd installed as standard.

 

Instead of attempting to rewrite your code  ;)  i went to the previous version that you based yours on.  I took the create_order.php and create_order_process.php (changed the very last line of create_order_process.php to use Dr. Rolex's order_handler.php also included the sql statement putting an extra line into orders) and this all works fine now.

 

I do however have an issue with the order_handler.php, as far as TAX is concerned.  If I make an order with the order creater then it doesn't look for or put tax into the equation. :P  You'll probably say it's the OLD create_order.php page I'm now using. But this seems to be the only issue I have now.   I have got something to work, putting a tax query in, and then copying it with a ($order->products[$i]['tax'] = round($tax_class['tax_rate'], 2)) statement and then putting it back into the database.

 

Any ideas what this issue could be?

 

Isn't it possible to install mysqlnd on your version of CentOS?

 

http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/

wget http://rpms.famillecollet.com/enterprise/remi.repo -O /etc/yum.repos.d/remi.repo

yum --enablerepo=remi-test install php-mysqlnd

Found it on stackoverflow, no idea if it works.  :P 

 

 

 

I do however have an issue with the order_handler.php, as far as TAX is concerned.  If I make an order with the order creater then it doesn't look for or put tax into the equation. :P  You'll probably say it's the OLD create_order.php page I'm now using. But this seems to be the only issue I have now.   I have got something to work, putting a tax query in, and then copying it with a ($order->products[$i]['tax'] = round($tax_class['tax_rate'], 2)) statement and then putting it back into the database.

 

No no, it's not because of the create_order.php, the code that calculates the tax doesn't care about what the current order totals are, it recalculates them (or at least, it should).

 

You can find the code that calculates tax in the tep_db_update_totals function in orders_ajax.php.

 

I have tested it with two different tax classes with many products without any problems but since the world is full of ugly and confusing tax classes, it's kind of hard to test every scenario.

Can you check if this behavior always happens, try with updating a products quantity, add a new product, remove a product, if you have more than one tax rate then try to add a product with a different tax rate. Test all this with both a newly created order and on an existing order. Check if the tax updates at any of these operations.

 

Also check if any fields are created in database table orders_total for the order when you create it. Perhaps it only creates fields in orders and orders_status_history?

I don't know if this will be a problem or not but maybe it can be..

 

I have modified much of the tax calculation function for the next revision, but it will most likely be hard to use without mysqlnd. (w00t) 

At least it will require a lot of modification to the code, I estimate that there's almost 100 statements/queries that require mysqlnd and this is only in the orders_ajax class.

 

Also check the Network Tab in your Developer Tools in the browser. E.g. when updating a products quantity, you should find these parameters (this is when updating a product without attributes):

Query String Parameters:

 

action:update_product

pID:637

order:513

field:products_quantity

new_value:3

 

 

And lastly, check the orders_ajax.php file for a function called mysqli_prepared_query, those most probably require mysqlnd, so if you find any, then you need to convert them to osCommerce tep_db_query and tep_db_fetch_array.

This is my best bet on what's wrong, but I thought those would throw an Error, but I'm not sure. Check your PHP error_log when updating the order and look for both errors, warnings and notices..   

Link to comment
Share on other sites

And lastly, check the orders_ajax.php file for a function called mysqli_prepared_query, those most probably require mysqlnd, so if you find any, then you need to convert them to osCommerce tep_db_query and tep_db_fetch_array.

This is my best bet on what's wrong, but I thought those would throw an Error, but I'm not sure. Check your PHP error_log when updating the order and look for both errors, warnings and notices..   

 

I think this is where my problems are. It is the library, I had looked at this yesterday night and changed one statement which worked perfectly after this (TAX statement.)  I shall change all the mysqlnd functions around to the oscommerce ones for now and see if that works. Considering the difference just the one change made I think this is definite. 

 

Yes, unfortunately my Operating system on the server doesn't come with the Mysqlnd libraries as standard. Thanks for the link, I'll take a look.  I think this is probably the way to go in the long run and when I install your update.

 

I'll tell you what happens.

Edited by Nefandous
Link to comment
Share on other sites

I think this is where my problems are. It is the library, I had looked at this yesterday night and changed one statement which worked perfectly after this (TAX statement.)  I shall change all the mysqlnd functions around to the oscommerce ones for now and see if that works. Considering the difference just the one change made I think this is definite. 

 

Yes, unfortunately my Operating system on the server doesn't come with the Mysqlnd libraries as standard. Thanks for the link, I'll take a look.  I think this is probably the way to go in the long run and when I install your update.

 

I'll tell you what happens.

 

I have never used CentOS, so I can't help you much but it should come with a package manager, right?

 

Easiest way should be to just do an update with the package manager.

But I can understand your reluctance, installing new package versions can introduce new ugly problems to deal with.  :x

 

If you do happen to convert the files/files to use MySQL functions instead, I'm sure many would appreciate if you would upload them when you're done.  :thumbsup: 

I'll try to help you if you run into any problems. 

Link to comment
Share on other sites

I have never used CentOS, so I can't help you much but it should come with a package manager, right?

 

Easiest way should be to just do an update with the package manager.

But I can understand your reluctance, installing new package versions can introduce new ugly problems to deal with.  :x

 

If you do happen to convert the files/files to use MySQL functions instead, I'm sure many would appreciate if you would upload them when you're done.  :thumbsup: 

I'll try to help you if you run into any problems. 

 

lol  Well this package uses plesk which is annoying a best.  Really hate it and much prefer cpanel or whm, but this is what I have to work with.  Everything about it is difficult. Thick it was bought for price rather than useability. If it was using conventional CPanel, then installation wouldn't be an issue.

 

I just tried to install a couple of version of the Mysqlnd but need other dependancies installed to get either to work. So I've got a list of installs now to go through.

 

You're right about my reluctance. The container, php/mysql and rest of modules are running correctly and website is working fast and well.  If I change the php library, and it goes wrong it could be catastrophic. I may be picking pieces up for weeks :P  Obviously I've made copies of both the site and the database...

 

I've scanned through all 3 files that handle the order.

 

ajax_handler.php

orders_ajax.php

order_handler.php

 

Strangely it seems the mysqli_prepared_query "select" database queries work for the most part. Don't understand that, but as soon as they're changed to the oscommerce tep_db_query an error occurs with the query. So I tried only changing the "update" and "insert" queries only and it still doesn't work lol.

 

Ironically I've installed this module on my own server and it works perfectly.

 

So, I'll go back to the working settings and I'll take a look at the $order->totals which is the only part that doesn't work right now. Am assuming that there's a mysqli_prepared_query writing to the database that I'll need to alter so it actually does.

 

Will give it another attempt now, and see if I can't get this library working.

Link to comment
Share on other sites

lol  Well this package uses plesk which is annoying a best.  Really hate it and much prefer cpanel or whm, but this is what I have to work with.  Everything about it is difficult. Thick it was bought for price rather than useability. If it was using conventional CPanel, then installation wouldn't be an issue.

 

I just tried to install a couple of version of the Mysqlnd but need other dependancies installed to get either to work. So I've got a list of installs now to go through.

 

You're right about my reluctance. The container, php/mysql and rest of modules are running correctly and website is working fast and well.  If I change the php library, and it goes wrong it could be catastrophic. I may be picking pieces up for weeks :P  Obviously I've made copies of both the site and the database...

 

I've scanned through all 3 files that handle the order.

 

ajax_handler.php

orders_ajax.php

order_handler.php

 

Strangely it seems the mysqli_prepared_query "select" database queries work for the most part. Don't understand that, but as soon as they're changed to the oscommerce tep_db_query an error occurs with the query. So I tried only changing the "update" and "insert" queries only and it still doesn't work lol.

 

Ironically I've installed this module on my own server and it works perfectly.

 

So, I'll go back to the working settings and I'll take a look at the $order->totals which is the only part that doesn't work right now. Am assuming that there's a mysqli_prepared_query writing to the database that I'll need to alter so it actually does.

 

Will give it another attempt now, and see if I can't get this library working.

 

 

You do have mysqli installed, I presume?

 

The functions you're going to have problem with is mysqli_stmt_get_result and mysqli_fetch_all.

 

https://gist.github.com/markbao/4975385

http://www.php.net/manual/en/book.mysqlnd.php

 

I can take a look at it later today, I didn't create the function so I don't know what part of it that becomes a problem.

Link to comment
Share on other sites

Yes, mysqli is installed. Centos 6.5 final. php 5.3.3 which actually with EVERY other version 5.3 and higher comes with the mysqlnd library, but not this one.  :P As standard it's not included.

 

So at the moment, my best course is to try to sort out the mysqlnd issues within the code.  When I replaced the two files with the two you'd based your system on the create_order.php and create_order_process.php, the mysqli_fetch_all() query was a reason it didn't work right. As you discussed with Alsomean earlier.

 

More than likely I will have to install a newer version of php in the end I'm sure. Or install all the little dependant programs and the library.

Edited by Nefandous
Link to comment
Share on other sites

Yes, mysqli is installed. Centos 6.5 final. php 5.3.3 which actually with EVERY other version 5.3 and higher comes with the mysqlnd library, but not this one.  :P As standard it's not included.

 

So at the moment, my best course is to try to sort out the mysqlnd issues within the code.  When I replaced the two files with the two you'd based your system on the create_order.php and create_order_process.php, the mysqli_fetch_all() query was a reason it didn't work right. As you discussed with Alsomean earlier.

 

More than likely I will have to install a newer version of php in the end I'm sure. Or install all the little dependant programs and the library.

 

I don't think you actually need to replace the mysqli_prepared_query function, it should work without mysqlnd.

 

Instead, look for places where you can find this code:

->get_result()
  • admin/includes/classes/order_prepared.php (4 matches)
  • admin/includes/functions/database.php (skip these)
  • admin/print_batch_invoice.php (1 match)
  • admin/ajax_handler.php (1 match)

 

And this:

->fetch_all
  • admin/includes/classes/order_prepared.php (1 match)
  • admin/create_order.php (1 match)

 

Replace those and it should work. At least as long as there aren't other functions that aren't compatible.

 

What did the error_log say when you tried to update the order?

Edited by Dr. Rolex
Link to comment
Share on other sites

Create Order - create_order.php in v2

PHP Fatal error: Call to undefined method mysqli_result::fetch_all() in /admin/create_order.php on line 89

 

 

I too am having this problem and with PHP 5.3.28 any idea on how to fix this?

"The doorstep to the temple of wisdom is a knowledge of our own ignorance."

Link to comment
Share on other sites

@@Dr. Rolex  I've got to hand it to you  :thumbsup:   - you sure as hell did one heck of a job on this module - it is fantastic. I love it. Its been a while since I've seen such a wonderful module that works well and that is also so visually appealing. 

"The doorstep to the temple of wisdom is a knowledge of our own ignorance."

Link to comment
Share on other sites

Not sure if anyone else has picked up this bug but  get error message when creating a new order

Parse error: syntax error, unexpected '[' in /home/xxx/public_html/xxx/xxxxx/create_order_process.php on line 56

 Line 56 and line 61 have errors

$payment_method = $payment_modules->selection()[0]['module'];

// load the selected shipping module
  require(DIR_WS_CLASSES . 'shipping.php');
  $shipping_modules = new shipping($shipping_method);
  $shipping_cost = $shipping_modules->quote($shipping_method)[0]['methods'][0]['cost'];

"The doorstep to the temple of wisdom is a knowledge of our own ignorance."

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...