Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Export orders shows blank page


Recommended Posts

can anyone help me? I have a heavily mod OSC and for some reason export oders dosnt work

 

the one part of the install I had trouble with is the orders.php modifications below

 

please help thanks

 

 

 

<?php
/*
 $Id: order.php 1739 2007-12-20 00:52:16Z hpdl $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 class order {
var $info, $totals, $products, $customer, $delivery;

function order($order_id) {
  $this->info = array();
  $this->totals = array();
  $this->products = array();
  $this->customer = array();
  $this->delivery = array();

  $this->query($order_id);
}

function query($order_id) {
  // PWA BOF
  // added customers_dummy_account
  $order_query = tep_db_query("select customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, customers_dummy_account, customers_id, customers_fax, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value, date_purchased, orders_status, last_modified from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'");
  // PWA EOF
  $order = tep_db_fetch_array($order_query);

  $totals_query = tep_db_query("select title, text from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "' order by sort_order");
$order_total_query = tep_db_query("select text from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "' and class = 'ot_total'");
  $order_total = tep_db_fetch_array($order_total_query);

  $shipping_method_query = tep_db_query("select title,value from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "' and class = 'ot_shipping'");
  $shipping_method = tep_db_fetch_array($shipping_method_query);

  while ($totals = tep_db_fetch_array($totals_query)) {
	$this->totals[] = array('title' => $totals['title'],
							'text' => $totals['text']);
  }

  $this->info = array('order_id' => $order_id,
				  'currency' => $order['currency'],
								'currency_value' => $order['currency_value'],
					  'payment_method' => $order['payment_method'],
					  'cc_type' => $order['cc_type'],
					  'cc_owner' => $order['cc_owner'],
					  'cc_number' => $order['cc_number'],
					  'cc_expires' => $order['cc_expires'],
					  'date_purchased' => $order['date_purchased'],
					  'orders_status' => $order['orders_status'],
					  'last_modified' => $order['last_modified']);
					   'total' => strip_tags($order_total['text']),
					  'shipping_method' => ((substr($shipping_method['title'], -1) == ':') ? substr(strip_tags($shipping_method['title']), 0, -1) : strip_tags($shipping_method['title'])),
					  'shipping_cost' => strip_tags($shipping_method['value']));

  $this->customer = array('id'	=> $order['customers_id'],
						  'name' => $order['customers_name'],
						  'company' => $order['customers_company'],
						  'street_address' => $order['customers_street_address'],
						  'suburb' => $order['customers_suburb'],
						  'city' => $order['customers_city'],
						  'postcode' => $order['customers_postcode'],
						  'state' => $order['customers_state'],
						  'country' => $order['customers_country'],
						  'format_id' => $order['customers_address_format_id'],
						  'telephone' => $order['customers_telephone'],
						  'email_address' => $order['customers_email_address'],
						  'fax' => $order['customers_fax'])
  // PWA BOF
						  'is_dummy_account' => $order['customers_dummy_account']);
  // PWA EOF

  $this->delivery = array('name' => $order['delivery_name'],
						  'company' => $order['delivery_company'],
						  'street_address' => $order['delivery_street_address'],
						  'suburb' => $order['delivery_suburb'],
						  'city' => $order['delivery_city'],
						  'postcode' => $order['delivery_postcode'],
						  'state' => $order['delivery_state'],
						  'country' => $order['delivery_country'],
						  'format_id' => $order['delivery_address_format_id']);

  $this->billing = array('name' => $order['billing_name'],
						 'company' => $order['billing_company'],
						 'street_address' => $order['billing_street_address'],
						 'suburb' => $order['billing_suburb'],
						 'city' => $order['billing_city'],
						 'postcode' => $order['billing_postcode'],
						 'state' => $order['billing_state'],
						 'country' => $order['billing_country'],
						 'format_id' => $order['billing_address_format_id']);

  $index = 0;
  $orders_products_query = tep_db_query("select orders_products_id, products_name, products_warehouse_location , products_model, products_price, products_tax, products_quantity, final_price, products_returned, products_id from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'");

  while ($orders_products = tep_db_fetch_array($orders_products_query)) {
				$this->products[$index] = array('qty' => $orders_products['products_quantity'],
									'name' => $orders_products['products_name'],
									'id' => $orders_products['products_id'],
									  'return' => $orders_products['products_returned'],
									'model' => $orders_products['products_model'],
									'tax' => $orders_products['products_tax'],
									'price' => $orders_products['products_price'],
									'final_price' => $orders_products['final_price']);
									'products_warehouse_location' =>   $orders_products['products_warehouse_location']);
	$subindex = 0;
	$attributes_query = tep_db_query("select products_options, products_options_values, options_values_price, price_prefix from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$order_id . "' and orders_products_id = '" . (int)$orders_products['orders_products_id'] . "'");
	if (tep_db_num_rows($attributes_query)) {
	  while ($attributes = tep_db_fetch_array($attributes_query)) {
		$this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'],
																 'value' => $attributes['products_options_values'],
																 'prefix' => $attributes['price_prefix'],
																 'price' => $attributes['options_values_price']);

		$subindex++;
	  }
	}
	$index++;
  }
}
 }
?>

Link to comment
Share on other sites

I have the page loading but now I get this database error

1054 - Unknown column 'customers_fax' in 'field list'

 

select customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, customers_dummy_account, customers_id, customers_fax, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value, date_purchased, orders_status, last_modified from orders where orders_id = '1'

please help thanks

 

 

 

<?php

/*

$Id: order.php 1739 2007-12-20 00:52:16Z hpdl $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

class order {

var $info, $totals, $products, $customer, $delivery;

 

function order($order_id) {

$this->info = array();

$this->totals = array();

$this->products = array();

$this->customer = array();

$this->delivery = array();

 

$this->query($order_id);

}

 

function query($order_id) {

// PWA BOF

// added customers_dummy_account

$order_query = tep_db_query("select customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, customers_dummy_account, customers_id, customers_fax, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value, date_purchased, orders_status, last_modified from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'");

// PWA EOF

$order = tep_db_fetch_array($order_query);

 

$totals_query = tep_db_query("select title, text from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "' order by sort_order");

$order_total_query = tep_db_query("select text from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "' and class = 'ot_total'");

$order_total = tep_db_fetch_array($order_total_query);

 

$shipping_method_query = tep_db_query("select title,value from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "' and class = 'ot_shipping'");

$shipping_method = tep_db_fetch_array($shipping_method_query);

while ($totals = tep_db_fetch_array($totals_query)) {

$this->totals[] = array('title' => $totals['title'],

'text' => $totals['text']);

}

 

$this->info = array('order_id' => $order_id,

'currency' => $order['currency'],

'currency_value' => $order['currency_value'],

'payment_method' => $order['payment_method'],

'cc_type' => $order['cc_type'],

'cc_owner' => $order['cc_owner'],

'cc_number' => $order['cc_number'],

'cc_expires' => $order['cc_expires'],

'date_purchased' => $order['date_purchased'],

'orders_status' => $order['orders_status'],

'last_modified' => $order['last_modified'],

'total' => strip_tags($order_total['text']),

'shipping_method' => ((substr($shipping_method['title'], -1) == ':') ? substr(strip_tags($shipping_method['title']), 0, -1) : strip_tags($shipping_method['title'])),

'shipping_cost' => strip_tags($shipping_method['value']));

 

$this->customer = array('id' => $order['customers_id'],

'name' => $order['customers_name'],

'company' => $order['customers_company'],

'street_address' => $order['customers_street_address'],

'suburb' => $order['customers_suburb'],

'city' => $order['customers_city'],

'postcode' => $order['customers_postcode'],

'state' => $order['customers_state'],

'country' => $order['customers_country'],

'format_id' => $order['customers_address_format_id'],

'telephone' => $order['customers_telephone'],

'email_address' => $order['customers_email_address'],

'fax' => $order['customers_fax'],

// PWA BOF

'is_dummy_account' => $order['customers_dummy_account']);

// PWA EOF

 

$this->delivery = array('name' => $order['delivery_name'],

'company' => $order['delivery_company'],

'street_address' => $order['delivery_street_address'],

'suburb' => $order['delivery_suburb'],

'city' => $order['delivery_city'],

'postcode' => $order['delivery_postcode'],

'state' => $order['delivery_state'],

'country' => $order['delivery_country'],

'format_id' => $order['delivery_address_format_id']);

 

$this->billing = array('name' => $order['billing_name'],

'company' => $order['billing_company'],

'street_address' => $order['billing_street_address'],

'suburb' => $order['billing_suburb'],

'city' => $order['billing_city'],

'postcode' => $order['billing_postcode'],

'state' => $order['billing_state'],

'country' => $order['billing_country'],

'format_id' => $order['billing_address_format_id']);

 

$index = 0;

$orders_products_query = tep_db_query("select orders_products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price, products_returned, products_id from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'");

while ($orders_products = tep_db_fetch_array($orders_products_query)) {

$this->products[$index] = array('qty' => $orders_products['products_quantity'],

'name' => $orders_products['products_name'],

'id' => $orders_products['products_id'],

'return' => $orders_products['products_returned'],

'model' => $orders_products['products_model'],

'tax' => $orders_products['products_tax'],

'price' => $orders_products['products_price'],

'final_price' => $orders_products['final_price']);

 

$subindex = 0;

$attributes_query = tep_db_query("select products_options, products_options_values, options_values_price, price_prefix from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$order_id . "' and orders_products_id = '" . (int)$orders_products['orders_products_id'] . "'");

if (tep_db_num_rows($attributes_query)) {

while ($attributes = tep_db_fetch_array($attributes_query)) {

$this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'],

'value' => $attributes['products_options_values'],

'prefix' => $attributes['price_prefix'],

'price' => $attributes['options_values_price']);

 

$subindex++;

}

}

$index++;

}

}

}

?>

[code]

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...