Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

A bug


Alexandero

Recommended Posts

Hi everyone,

 

I was trying with the help of a friend to add a file that counts the ordered products in multiple packing slips.

 

He helped me install in one site and it is working but now i am trying to install it in another site, but i got a bug.

 

Normally there shouldn't be any bugs because I have installed it by myself in another site and it is working.

 

Please anyone tell me the meaning of this:

 

Warning: array_count_values() [function.array-count-values]: Can only count STRING and INTEGER values! in /home/public_html/admin/packing_show1.php on line 86

 

This is the line 86 in red

 

$orderprodid = substr($orderprodid, 0 , -1);

$val = array_count_values($pid);

 

while(list($pid, ) = each($val)){

 

 

Please tell me what's wrong with it?

(My friend is not here)

 

Best regards,

Link to comment
Share on other sites

  • Replies 56
  • Created
  • Last Reply
Warning: array_count_values() [function.array-count-values]: Can only count STRING and INTEGER values! in /home/public_html/admin/packing_show1.php on line 86

 

This is the line 86 in red

 

$orderprodid = substr($orderprodid, 0 , -1);

$val = array_count_values($pid);

 

while(list($pid, ) = each($val)){

 

Cheers, I figured out why, but I still need your help.

 

Well, it says that it can only count STRING and INTEGER values because $pid (which is products id) in my store the products' ids have a symbole (a hyphen -)

 

 

 

'pid' => $orders_products['products_id']

 

 

Anyone can tell me how to fix it please?

Link to comment
Share on other sites

try this code:

 

$orderprodid = substr($orderprodid, 0 , -1);
$pid= str_replace("-", "", $pid);
$val = array_count_values($pid);

while(list($pid, ) = each($val)){

Please read this line: Do you want to find all the answers to your questions? click here. As for contribution database it's located here!

8 people out of 10 don't bother to read installation manuals. I can recommend: if you can't read the installation manual, don't bother to install any contribution yourself.

Before installing contribution or editing/updating/deleting any files, do the full backup, it will save to you & everyone here on the forum time to fix your issues.

Any issues with oscommerce, I am here to help you.

Link to comment
Share on other sites

Cheers, I figured out why, but I still need your help.

 

Well, it says that it can only count STRING and INTEGER values because $pid (which is products id) in my store the products' ids have a symbole (a hyphen -)

'pid' => $orders_products['products_id']

Anyone can tell me how to fix it please?

 

$pid is not set or empty that is why you are getting this error;

Link to comment
Share on other sites

Hi Alex You almost resolved the problem, as i no longer see that bug, but the output of the file is not what was expected.

 

I mean normally paking_show1.php would have showed me images of the ordered items.

 

Well the code of my friend was based on this kind of product id format: aproduct abc0124#

 

But on the store I am trying to install this file the product id format is this: aproduct 0124-M

 

The names of the images also are the same as the product model format, maybe that's why i can't see them, actually i can see only one frame for an image. Normally there should be many. here is the main part of packing_show1.php

 

 <?php
for($j=0; $j<=$_POST['k']; $j++){	
if($_POST['chk'][$j]){
	$orderstausid .= $_POST['chk'][$j].',';
}
}
$orderstausid = substr($orderstausid, 0 , -1);

$pending_order_query = tep_db_query("select orders_id from orders where orders_status in(".$orderstausid.") and orders_id >= '".$_POST['toinvoice']."' and orders_id <= '".$_POST['frominvoice']."' order by orders_id");
$rows = tep_db_num_rows($pending_order_query);
$r = 0;

while($pending_order_data = tep_db_fetch_array($pending_order_query)){
$oid[] = $pending_order_data['orders_id'];
$order = new order($pending_order_data['orders_id']);
$customer_number_query = tep_db_query("select customers_id from " . TABLE_ORDERS . " where orders_id = '". tep_db_input(tep_db_prepare_input($pending_order_data['orders_id'])) . "'");
$customer_number = tep_db_fetch_array($customer_number_query);

$payment_info_query = tep_db_query("select * from " . TABLE_ORDERS . " where orders_id = '". tep_db_input(tep_db_prepare_input($pending_order_data['orders_id'])) . "'");
$payment_info = tep_db_fetch_array($payment_info_query);
$payment_info = $payment_info['orders_id'];

$oID = tep_db_prepare_input($pending_order_data['orders_id']);
$orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where orders_id = '" . tep_db_input($oID) . "'");

for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
	$opid[] = $order->products[$i]['opid'];
	$pid[] = $order->products[$i]['pid'];
}
}
?>
<tr><td valign="top"><table align="center" style="width:600px;" border="0"><tr><td>
<?php
for($o=0; $o<sizeof($opid);$o++){
$orderprodid .= $opid[$o].',';
}
$orderprodid = substr($orderprodid, 0 , -1);
$pid= str_replace("-", "", $pid);
$val = array_count_values($pid);

while(list($pid, ) = each($val)){

$showimg = tep_db_fetch_array(tep_db_query("select p.products_id, p.products_image,p.products_model,pd.products_name from products p, products_description pd where  p.products_id='".$pid."' and p.products_id = pd.products_id and pd.language_id = '". (int)$languages_id ."'"));
//tep_image(DIR_WS_IMAGES . $categories['categories_image']
//if($showimg['products_name'] != ''){
$imagelocation = "images/";
$imagelocation.=$showimg["products_image"];
//echo $imagelocation;
//tep_image(DIR_WS_IMAGES . $categories['categories_image'], $categories['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT)
// echo '				<td align="center" class="smallText" width="' . $width . '" valign="top"><a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . tep_image(DIR_WS_IMAGES . $categories['categories_image'], $categories['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '<br>' . $categories['categories_name'] . '</a></td>'
echo '<table border="0" width="100%" style="border-bottom:1px solid #000000;"><tr>				<td valign="top"><table border="0" width="100%" align="center"><tr class="dataTableRow"><td class="dataTableContent" valign="top" align="center" height="135px;" width="80%">' . tep_image('images/' . $showimg['products_image'], $showimg['products_name'], 135, 100) . '<br>' . $showimg['products_name'] . '</td></tr><tr><td align="center">';



	//echo '<table border="0" width="100%" style="border-bottom:1px solid #000000;"><tr><td valign="top"><table border="0" width="100%" align="center"><tr class="dataTableRow"><td class="dataTableContent" valign="top" align="center" height="135px;" width="80%"><img height="135px" width="115px" src='.$imagelocation. ' alt='.$showimg['products_name'].'><br><br>Product Name: '.$showimg['products_name'].'<br></td></tr><tr><td align="center">';
//	echo '<table border="0" width="100%" style="border-bottom:1px solid #000000;"><tr><td valign="top"><table border="0" width="100%" align="center"><tr class="dataTableRow"><td class="dataTableContent" valign="top" align="center" height="135px;" width="80%"><img height="135px" width="115px" src='.$imagelocation.' alt='.$showimg['products_name'].'><br><br>Product Name: '.$showimg['products_name'].'<br></td></tr><tr><td align="center">';

	$prodattribquery = tep_db_query("select opa.products_options, opa.products_options_values, op.products_quantity from orders_products_attributes opa, orders_products op where opa.orders_products_id in(".$orderprodid.") and opa.orders_products_id = op.orders_products_id and op.products_id = '".$pid."'");
	while($prodattribdata = tep_db_fetch_array($prodattribquery)){
		echo '<table><tr class="dataTableRow"><td class="dataTableContent" valign="top" align="center"> <small>'.$prodattribdata['products_quantity'] .' x '.$prodattribdata['products_options'].' :-  '.$prodattribdata['products_options_values'].'</small></td></tr></table>';
	}
	echo '</td></tr></table></td></tr></table>';
//}
}
?>
  </td></tr></table>
</table>
<!-- body_text_eof //-->
</body>
</html>

 

 

Thank you so much

Link to comment
Share on other sites

Well to be honest the file is a bit of a mess, very amateurish.

 

How many queries on that page to generate this? thoroughly unnecessary.

 

Having made comments like that I'd better offer something.

 

I don't understand the comments you make about product_ids with hyphens etc, and i make no promises about it working but the following file uses one query and if nothing else may give you some ideas: -

 

<?php
define('OBI_NO_ATTRIBUTES', 'standard product no attributes');
for($j=0; $j<=$_POST['k']; $j++){
if($_POST['chk'][$j]){
	$orderstausid .= $_POST['chk'][$j].',';
}
}
$orderstausid = substr($orderstausid, 0 , -1);
$obi_query = tep_db_query("
SELECT ord.orders_id, op.products_id, p.products_image, op.products_name, op.products_quantity, opa.products_options, opa.products_options_values
FROM orders as ord, products_description as pd, orders_products as op, products as p
LEFT JOIN orders_products_attributes as opa
ON op.orders_products_id = opa.orders_products_id
WHERE orders_status in(" . $orderstausid . ") and ord.orders_id >= '" . tep_db_input($_POST['toinvoice']) . "' and ord.orders_id <= '" . tep_db_input($_POST['frominvoice']) . "'
AND ord.orders_id = op.orders_id
AND pd.products_id = op.products_id
AND p.products_id = op.products_id
ORDER BY orders_id DESC");


echo '
<table width="100%" cellspacing="0" cellpadding="0">
 <tr>
<td valign="top">
  <table align="center" style="width:600px;" border="0">
	<tr>
	  <td>';
while (list($order_id, $products_id, $products_image, $products_name, $products_quantity, $products_options, $products_options_values) = mysql_fetch_row($obi_query)) {
$imagelocation = DIR_WS_IMAGES . $showimg["products_image"];
echo '
		<table border="0" width="100%" style="border-bottom:1px solid #000000;">
		  <tr>
			<td valign="top">
			  <table border="0" width="100%" align="center">
				<tr class="dataTableRow">
				  <td class="dataTableContent" valign="top" align="center" height="135px;" width="80%">' . tep_image(DIR_WS_IMAGES . $products_image, $products_name, 135, 100) . '<br />' . $products_name . '</td>
				</tr><tr>
				  <td align="center">
					<table>
					  <tr class="dataTableRow">
						<td class="dataTableContent" valign="top" align="center"> <small>' . $products_quantity . ' x ';
					  if ($products_options == '')
					  echo OBI_NO_ATTRIBUTES;
					  else echo $products_options . ' :-  ' . $products_options_values;
echo '
						</small>
						</td>
					  </tr>
					</table>
				  </td>
				</tr>
			  </table>
			</td>
		  </tr>
		</table>';
}
?>
	  </td>
	</tr>
  </table>
</td>
 </tr>
</table>
<!-- body_text_eof //-->
</body>
</html>

Link to comment
Share on other sites

Oh I forgot.

 

If you do use the above query create an index on orders_products_id in table orders_products_attributes.

Link to comment
Share on other sites

I took a longer look and saw that extra attributes were acting as new products so revised version below: -

 

<?php
define('OBI_NO_ATTRIBUTES', 'standard product no attributes');

for($j=0; $j<=$_POST['k']; $j++){
if($_POST['chk'][$j]){
	$orderstausid .= $_POST['chk'][$j].',';
}
}

$orderstausid = substr($orderstausid, 0 , -1);
$obi_query = tep_db_query("
SELECT ord.orders_id, opa.orders_products_id, op.products_id, p.products_image, op.products_name, op.products_quantity, opa.products_options, opa.products_options_values
FROM orders as ord, products_description as pd, orders_products as op, products as p
LEFT JOIN orders_products_attributes as opa
ON op.orders_products_id = opa.orders_products_id
WHERE orders_status in(" . $orderstausid . ") and ord.orders_id >= '" . tep_db_input($_POST['toinvoice']) . "' and ord.orders_id <= '" . tep_db_input($_POST['frominvoice']) . "'
AND ord.orders_id = op.orders_id
AND pd.products_id = op.products_id
AND p.products_id = op.products_id
ORDER BY orders_id DESC");


echo '
<table width="100%" cellspacing="0" cellpadding="0">
 <tr>
<td valign="top">
  <table align="center" style="width:600px;" border="0">
	<tr>
	  <td>';
while (list($order_id, $orders_products_id, $products_id, $products_image, $products_name, $products_quantity, $products_options, $products_options_values) = mysql_fetch_row($obi_query)) {
if (isset($orders_products_id))
$attributes[$order_id][$orders_products_id][] = array('option' => $products_options, 'option_value' => $products_options_values);
$products_array[$order_id][$products_id] = array(
											 'order_id' => $order_id,
											 'orders_products_id' => $orders_products_id,
											 'products_id' => $products_id,
											 'products_image' => $products_image,
											 'products_name' => $products_name,
											 'products_quantity' => $products_quantity,
											 'products_attributes' => $attributes[$order_id][$orders_products_id]);
}
unset($attributes, $orderstausid); // Housekeeping
tep_db_free_result($obi_query); // Housekeeping
foreach ($products_array as $key => $value) {
 foreach ($value as $key2 => $obi_value) {
echo '
		<table border="0" width="100%" style="border-bottom:1px solid #000000;">
		  <tr>
			<td valign="top">
			  <table border="0" width="100%" align="center">
				<tr class="dataTableRow">
				  <td class="dataTableContent" valign="top" align="center" height="135px;" width="80%">Order id = ' . $obi_value['order_id'] . '<br />Order Products id = ' . $obi_value['orders_products_id'] . '<br />' . tep_image(DIR_WS_IMAGES . $obi_value['products_image'], $obi_value['products_name'], 135, 100) . '<br />' . $obi_value['products_name'] . '</td>
				</tr><tr>
				  <td align="center">
					<table>
					  <tr class="dataTableRow">
						<td class="dataTableContent" valign="top" align="center"> <small>' . $obi_value['products_quantity'] . ' x ';
						   if (is_array($obi_value['products_attributes'])) {
							$count_attribs = count($obi_value['products_attributes']);
							for($i=0; $i<$count_attribs; $i++) {
							  echo $obi_value['products_attributes'][$i]['option'] . ' :-  ' . $obi_value['products_attributes'][$i]['option_value'] . '<br />';
							}
						  } else echo OBI_NO_ATTRIBUTES;
echo '
						</small>
						</td>
					  </tr>
					</table>
				  </td>
				</tr>
			  </table>
			</td>
		  </tr>
		</table>';
 }
}
?>
	  </td>
	</tr>
  </table>
</td>
 </tr>
</table>
<!-- body_text_eof //-->
</body>
</html>

Link to comment
Share on other sites

Hi Robert, i don't know how to thank you for your assistance.. but i really don't know how to create index. :(

 

If you do use the above query create an index on orders_products_id in table orders_products_attributes.

 

Could you or anyone please tell me how to create index on orders_products_id in table orders_products_attributes?

Link to comment
Share on other sites

Hi Robert, i don't know how to thank you for your assistance.. but i really don't know how to create index. :(

Could you or anyone please tell me how to create index on orders_products_id in table orders_products_attributes?

 

Well firstly you haven't said if it worked! I spent quite a while rewriting that whole script.

 

Secondly . .

 

phpmyadmin>choose your database>click on the SQL tab

 

In the box put ..

 

alter orders_products_attributes add index idx_opa_orders_products_id (orders_products_id);

 

Press go

Link to comment
Share on other sites

Hi Robert, I haven't tested it yet because I thought I should first create an index, once i create the index i will test it and let you know :)

 

Well i have tried the sql query but i got an error

Error

SQL query:

ALTER orders_products_attributes ADD INDEX idx_opa_orders_products_id( orders_products_id )

MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'orders_products_attributes add index idx_opa_orders_products_id (orders_products' at line 1

Link to comment
Share on other sites

Hi Robert, I haven't tested it yet because I thought I should first create an index, once i create the index i will test it and let you know :)

 

Well i have tried the sql query but i got an error

Error

SQL query:

ALTER orders_products_attributes ADD INDEX idx_opa_orders_products_id( orders_products_id )

MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'orders_products_attributes add index idx_opa_orders_products_id (orders_products' at line 1

 

Try the script first .. the index just speeds things up. and you left the semi colon ; off

Link to comment
Share on other sites

Ooops, sorry

 

 

ALTER TABLE orders_products_attributes ADD INDEX idx_opa_orders_products_id (orders_products_id);

Link to comment
Share on other sites

I tried the script I got this error

 

1054 - Unknown column 'op.orders_products_id' in 'on clause'

SELECT ord.orders_id, opa.orders_products_id, op.products_id, p.products_image, op.products_name, op.products_quantity, opa.products_options, opa.products_options_values FROM orders as ord, products_description as pd, orders_products as op, products as p LEFT JOIN orders_products_attributes as opa ON op.orders_products_id = opa.orders_products_id WHERE orders_status in(2) and ord.orders_id >= '1148' and ord.orders_id <= '1200' AND ord.orders_id = op.orders_id AND pd.products_id = op.products_id AND p.products_id = op.products_id ORDER BY orders_id DESC

[TEP STOP]

Link to comment
Share on other sites

I tried the script I got this error

 

1054 - Unknown column 'op.orders_products_id' in 'on clause'

SELECT ord.orders_id, opa.orders_products_id, op.products_id, p.products_image, op.products_name, op.products_quantity, opa.products_options, opa.products_options_values FROM orders as ord, products_description as pd, orders_products as op, products as p LEFT JOIN orders_products_attributes as opa ON op.orders_products_id = opa.orders_products_id WHERE orders_status in(2) and ord.orders_id >= '1148' and ord.orders_id <= '1200' AND ord.orders_id = op.orders_id AND pd.products_id = op.products_id AND p.products_id = op.products_id ORDER BY orders_id DESC

[TEP STOP]

 

Odd look in your database, in table orders_products is there a column orders_products_id?

Link to comment
Share on other sites

Errrm thanks oslover (I think)

 

Try changing

 

ON op.orders_products_id = opa.orders_products_id

to ..

 

ON (op.orders_products_id = opa.orders_products_id)

 

I was testing on MySQL 4 as opposed to 5 (as I don't have any orders on my dev site)

Link to comment
Share on other sites

Yes i can see this column, i copy past the whole table here

 

	Field	Type	Collation	Attributes	Null	Default	Extra	Action						
orders_products_id	int(11)			No		auto_increment							
orders_id	int(11)			No	0								
products_id	int(11)			No	0								
products_model	varchar(12)	latin1_swedish_ci		Yes	NULL								
products_name	varchar(64)	latin1_swedish_ci		No									
products_price	decimal(15,4)			No	0.0000								
final_price	decimal(15,4)			No	0.0000								
products_tax	decimal(7,4)			No	0.0000								
products_quantity	int(2)			No	0

Link to comment
Share on other sites

Nope .. just tested on MySQL5 the following will work: -

 

SELECT ord.orders_id, opa.orders_products_id, op.products_id, p.products_image, op.products_name, op.products_quantity, opa.products_options, opa.products_options_values
FROM (orders as ord, products_description as pd, orders_products as op, products as p)
LEFT JOIN orders_products_attributes as opa
ON op.orders_products_id = opa.orders_products_id
WHERE orders_status in(" . $orderstausid . ") and ord.orders_id >= '" . tep_db_input($_POST['toinvoice']) . "' and ord.orders_id <= '" . tep_db_input($_POST['frominvoice']) . "'
AND ord.orders_id = op.orders_id
AND pd.products_id = op.products_id
AND p.products_id = op.products_id
ORDER BY orders_id DESC");

Link to comment
Share on other sites

I replaced it but i still see the same error.

 

I should tell you that I call this script using another script which lets me choose the a range of orders.

 

..../admin/packing_print1.php

 

here is its code:

 

 
<?php
/*
 $Id: manufacturers.php,v 1.55 2003/06/29 22:50:52 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');
?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
 <tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td>
  <form name="frmprofile" action = "packing_show1.php" method = "post">
	<table border="0" width="40%" align="center" cellspacing="2" cellpadding="2">
	  <tr>
		<td class="main">From : </td>
		<td>
		  <input type="text" name="toinvoice">
		</td>
	  </tr>
	  <tr>
		<td class="main">To : </td>
		<td>
		  <input type="text" name="frominvoice">
		</td>
   	  </tr>

	  <?php $orders_status_query = tep_db_query("select * from " . TABLE_ORDERS_STATUS . " where language_id = '". (int)$languages_id ."' order by orders_status_id"); 
	  $k = 0;
	  while($orders_status = tep_db_fetch_array($orders_status_query)){
		  echo '<tr><td class="main" colspan="2"><input type="checkbox" value="'.$orders_status['orders_status_id'].'" name="chk['.$k.']"> '.$orders_status['orders_status_name'].'</td></tr>';
		  echo '<input type="hidden" value="'.$k.'" name="k">';
		  $k++;
	  }
	  ?>

   	  <tr bgcolor="#ffffff">
		<td colspan="2" align="right" height="35"><input class="para" type="Submit" value="Submit"></td>
	  </tr>
	</table>
  </form>
</td>
<!-- body_text_eof //-->
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

 

 

 

 

 

 

and this is the upper part of the first code that I posted (/admin/packing_show1.php)

 

<?php
require('includes/application_top.php');
require(DIR_WS_LANGUAGES . $language . '/' . 'invoice.php');
require(DIR_WS_CLASSES . 'currencies.php');
$currencies = new currencies();
include(DIR_WS_CLASSES . 'order.php');
define("TITLE_PRINT_ORDER", 'Order Id:');
define("IMAGE_BUTTON_PRINT", '<b>Print</b>');
?>
<style>
BR.page { page-break-before: always;}

.titleHeading{
	font-family: Verdana, Arial, sans-serif;
	font-size: 14px;
}
.dataTableHeadingRow,dataTableHeadingContent{
	font-family: Verdana, Arial, sans-serif;
	font-size: 12px;
}
.dataTableRow,dataTableContent{
	font-family: Verdana, Arial, sans-serif;
	font-size: 11px;
}
</style>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE . ' - ' . TITLE_PRINT_ORDER . $oID; ?></title>
<base href="<?php echo (getenv('HTTPS') == 'on' ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="print.css">
</head>
<body marginwidth="10" marginheight="10" topmargin="50" bottommargin="10" leftmargin="10" rightmargin="10">
<!-- body_text //-->
<table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
 <tr>
<td align="center" class="main"><table align="center" width="100%" border="0" cellspacing="0" cellpadding="2">
  <tr>
	<td valign="top" align="left" class="main"><script language="JavaScript">
 if (window.print) {
document.write('<a href="java script:;" onClick="java script:window.print()" onMouseOut=document.imprim.src="<?php echo (DIR_WS_IMAGES . 'printimage.gif'); ?>" onMouseOver=document.imprim.src="<?php echo (DIR_WS_IMAGES . 'printimage_over.gif'); ?>"><img src="<?php echo (DIR_WS_IMAGES . 'printimage.gif'); ?>" width="43" height="28" align="abstop" border="0" name="imprim">' + '<?php echo IMAGE_BUTTON_PRINT; ?></a></center>');
 }
 else document.write ('<h2><?php echo IMAGE_BUTTON_PRINT; ?></h2>')
	</script></td>
  </tr>
</table></td>
 </tr>
<?php
define('OBI_NO_ATTRIBUTES', 'standard product no attributes');

 

and in my /admin/includes/classes/orders.php my friend added this code (in bold letters)

 

	  while ($orders_products = tep_db_fetch_array($orders_products_query)) {
	$this->products[$index] = array('qty' => $orders_products['products_quantity'],
							[b]		'pid' => $orders_products['products_id'],
									'opid' => $orders_products['orders_products_id'],[/b]
									'name' => $orders_products['products_name'],
									'model' => $orders_products['products_model'],
		 'tax' => $orders_products['products_tax'],
									'price' => $orders_products['products_price'],
		 'final_price' => $orders_products['final_price']);

 

 

that's all, just to make it more clear for you.

Link to comment
Share on other sites

You may have missed my post before this where I posted a mysql5 query replacement.

Link to comment
Share on other sites

yes sorry i missed that post, i have installed it thank you, there are no bugs and i can see images but the results (counting) is wrong.

 

Normally, the first script counts how many times a product was ordered in a range of orders (of course taking into consideration its attributes)

 

Thus, the output is sent to the supplier.

Link to comment
Share on other sites

Well I was waiting around to support this but have to move on.

 

Good luck.

Link to comment
Share on other sites

Aaah I see so the way it is meant to work is not to show individual orders but how many of a particular product(with attribute differences) there were between the invoice dates.

 

Is that correct?

 

If you are around for an hour I'll have a bash at changing it to meet those needs.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...