Jump to content
Sign in to follow this  
djmonkey1

Orders at-a-glance

Recommended Posts

I have just installed the contribution "Orders at-a-glance", available at

 

http://www.oscommerce.com/community/contributions,3454

 

However I would like to also include product attributes in the pop-up bubble.

 

Product attributes, as you may know, are my favorite topic.

 

In any case, the code that I believe needs to be modified is here:

 

<?php // ====> BOF: ORDERS AT-A-GLANCE <==== ?>
			 <td class="dataTableContent" align="center"><b><?php echo $orders['orders_id']; 

$artikel = "";
$num = 1;
$result_artikels = tep_db_query("select products_name, products_quantity from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . tep_db_input($orders['orders_id']) . "' ");
while($row_artikels = tep_db_fetch_array($result_artikels))
{
$artikel .= ($row_artikels["products_quantity"]) . "x " . ($row_artikels["products_name"]) . "<br>";
$num++;
}
 { 
 $parsedComment = explode("\r", $artikel);
 $cleanComment = "";
 $i=0;
 while($i < count($parsedComment)) {
 $cleanComment .= trim($parsedComment[$i]);
 $i++;
 if ($i < count($parsedComment)) $cleanComment .= '<br \> ';
}
 ?>	
				 <script language="javascript"><!--
					   document.write('<?php echo '<a href="javascript:void(0);" onmouseover="return overlib(\\\'' . $cleanComment . '\\\');" onmouseout="return nd();"><img src="images/icons/comment2.gif" align="top" border=0></a> '; ?>');
				   --></script>

<?php } ?></b></a>   

			 <?php // ====> EOF: ORDERS AT-A-GLANCE <==== ?>

 

I've modified the middle of it slightly to look like this:

 

$artikel = "";
$num = 1;
$result_artikels = tep_db_query("select products_name, products_quantity from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . tep_db_input($orders['orders_id']) . "' ");
$result_attributes = tep_db_query("select products_options, products_options_values from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$oID . "' and orders_products_id = '" . (int)$vendor_orders_products['orders_products_id'] . "'");
while($row_artikels = tep_db_fetch_array($result_artikels))
{
$artikel .= ($row_artikels["products_quantity"]) . "x " . ($row_artikels["products_name"]) . "<br>";
$attributes .= ($row_attributes["products_options"]) . ": " . ($row_attributes["products_options_values"]) . "<br>";
$num++;
}

 

But of course this doesn't work as it's far too simple and $row_attributes is not defined.

 

So, I'm looking for someone smarter than me to crack this one.


Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Share this post


Link to post
Share on other sites

i am not sure and did not test but i thought maybe you should put the attribute querry to be in the loop so it happends for each products it is probably not going to work but it might give you a diffrent point of view

<?php // ====> BOF: ORDERS AT-A-GLANCE <==== ?>
<td class="dataTableContent" align="center"><b><?php echo $orders['orders_id'];

$artikel = "";
$num = 1;
$result_artikels = tep_db_query("select products_name, products_quantity,products_id  from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . tep_db_input($orders['orders_id']) . "' ");
while($row_artikels = tep_db_fetch_array($result_artikels))
{
$artikel .= ($row_artikels["products_quantity"]) . "x " . ($row_artikels["products_name"]) . "<br>";
///here for your code
$result_attributes = tep_db_query("select products_options, products_options_values from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . tep_db_input($orders['orders_id']. "' and orders_products_id = '" . $row_artikels["products_id"] . "'");
while($row_attributes = tep_db_fetch_array($result_attributes ))
{
$artikel .=($row_attributes["products_options"]) . ": " . ($row_attributes["products_options_values"]) . "<br>";
}
//here is the end
$num++;
}
{
$parsedComment = explode("\r", $artikel);
$cleanComment = "";
$i=0;
while($i < count($parsedComment)) {
$cleanComment .= trim($parsedComment[$i]);
$i++;
if ($i < count($parsedComment)) $cleanComment .= '<br \> ';
}
?>
<script language="javascript"><!--
document.write('<?php echo '<a href="javascript:void(0);" onmouseover="return overlib(\\\'' . $cleanComment . '\\\');" onmouseout="return nd();"><img src="images/icons/comment2.gif" align="top" border=0></a> '; ?>');
--></script>

<?php } ?></b></a>

<?php // ====> EOF: ORDERS AT-A-GLANCE <==== ?>

Share this post


Link to post
Share on other sites

Not quite. I get

 

[b]Parse error[/b]:  parse error, unexpected ';' in [b]admin/orders.php[/b] on line [b]609[/b]

 

with this code.

 

I'm just not quite getting this.

 

 

Wait, found it, there was a missing ")" in there.

 

But, unfortunately, it doesn't work. It isn't broken, but it doesn't display product attributes.


Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Share this post


Link to post
Share on other sites

what is line 609

i thought to put the search for the attributes right after each product is written

so it searches for the attribute of each product

this way you will have both order_id and product_id

Share this post


Link to post
Share on other sites

Line 609 is

 

$result_attributes = tep_db_query("select products_options, products_options_values from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . tep_db_input($orders['orders_id']). "' and orders_products_id = '" . $row_artikels["products_id"] . "'");

 

It had a missing ")", but I took care of that.


Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Share this post


Link to post
Share on other sites

may be it has something to do (int)$vendor_orders_products['orders_products_id'] . "'");

i just tried to get the products_id from table_orders_product

here

$result_artikels = tep_db_query("select products_name, products_quantity,products_id from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . tep_db_input($orders['orders_id']) . "' ");

while($row_artikels = tep_db_fetch_array($result_artikels))

{

is it still available in this table

Edited by nana

Share this post


Link to post
Share on other sites

here i search for the attributes where products_id =$row_artikels["products_id"]

 $result_attributes = tep_db_query("select products_options, products_options_values from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . tep_db_input($orders['orders_id']). "' and orders_products_id = '" . $row_artikels["products_id"] . "'");

here i search for $row_artikels["products_id"]

$result_artikels = tep_db_query("select products_name, products_quantity,products_id from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . tep_db_input($orders['orders_id']) . "' ");
while($row_artikels = tep_db_fetch_array($result_artikels))
{

here you search for attributes

 $result_attributes = tep_db_query("select products_options, products_options_values from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$oID . "' and orders_products_id = '" . (int)$vendor_orders_products['orders_products_id'] . "'");

you use (int)$vendor_orders_products['orders_products_id'] while i used $row_artikels["products_id"]

this could be the problem

if i do not get the value

Share this post


Link to post
Share on other sites

Hmmm.... but I was just making things up. I took

(int)$vendor_orders_products['orders_products_id'] . "'");

from a section of code that works with Multi Vendor Shipping, hence the use of vendor, but it isn't necessary. The way the applicable data exists in the database is not changed by MVS.

Edited by djmonkey1

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Share this post


Link to post
Share on other sites

I noticed that orders with products containing apostrophes or accentuated characters do not show up in the at-a-glance rollover. What would be he file to look to escape the characters?

 

Thanks!

Edited by pixclinic

Share this post


Link to post
Share on other sites
I noticed that orders with products containing apostrophes or accentuated characters do not show up in the at-a-glance rollover. What would be he file to look to escape the characters?

 

Thanks!

 

This is what I did:

 

In admin/includes/functions/general.php added this:

 

// Function	: tep_html_noquote
 // Arguments   : string	any string
 // Return	  : strips apostrophes from strings
 //Used with "Orders at a glance" to workaround problem with apostrophes
 function tep_html_noquote($string) {
return str_replace("'", "", $string);
 }

 

and in admin/orders.php change

$artikel .= ($row_artikels["products_quantity"]) . "x " . ($row_artikels["products_name"]) . "<br>";

to

$artikel .= ($row_artikels["products_quantity"]) . "x " . (tep_html_noquote($row_artikels["products_name"])) . "<br>";

 

Note that this completely removes apostrophes from the product name as displayed.

 

This is a tad bit of overkill but it gives you a handy function to use elsewhere if you start using the overlib function in different places and have similar problems. If you don't want to bother with the new function you could you use

$artikel .= ($row_artikels["products_quantity"]) . "x " . (str_replace("'", "", $row_artikels["products_name"])) . "<br>";

in admin/orders.php instead.


Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Share this post


Link to post
Share on other sites
This is what I did:

 

In admin/includes/functions/general.php added this:

 

// Function	: tep_html_noquote
 // Arguments   : string	any string
 // Return	  : strips apostrophes from strings
 //Used with "Orders at a glance" to workaround problem with apostrophes
 function tep_html_noquote($string) {
return str_replace("'", "", $string);
 }

 

and in admin/orders.php change

$artikel .= ($row_artikels["products_quantity"]) . "x " . ($row_artikels["products_name"]) . "<br>";

to

$artikel .= ($row_artikels["products_quantity"]) . "x " . (tep_html_noquote($row_artikels["products_name"])) . "<br>";

 

Note that this completely removes apostrophes from the product name as displayed.

 

This is a tad bit of overkill but it gives you a handy function to use elsewhere if you start using the overlib function in different places and have similar problems. If you don't want to bother with the new function you could you use

$artikel .= ($row_artikels["products_quantity"]) . "x " . (str_replace("'", "", $row_artikels["products_name"])) . "<br>";

in admin/orders.php instead.

 

Thanks, I will give it a try!

Share this post


Link to post
Share on other sites

I finally got products attributes to work!

 

Here is what I used:

 

<?php // ====> BOF: ORDERS AT-A-GLANCE <==== ?>
			<td class="dataTableContent" align="center"><b><?php echo $orders['orders_id']; 

$artikel = "";
$num = 1;
$result_artikels = tep_db_query("select orders_products_id, products_name, products_quantity, products_id from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . tep_db_input($orders['orders_id']) . "' ");
while($row_artikels = tep_db_fetch_array($result_artikels))
{
$artikel .= ($row_artikels["products_quantity"]) . "x " . (tep_html_noquote($row_artikels["products_name"])) . "<br>";
///here for your code
$result_attributes = tep_db_query("select products_options, products_options_values from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . tep_db_input($orders['orders_id']). "' and orders_products_id = '" . $row_artikels["orders_products_id"] . "'");
while($row_attributes = tep_db_fetch_array($result_attributes))
{
$artikel .=" - " . ($row_attributes["products_options"]) . ": " . ($row_attributes["products_options_values"]) . "<br>";
}
//here is the end
$num++;
}


Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Share this post


Link to post
Share on other sites

Hi DJmonkey,

 

I've just tried to install the latest version of this contribution and I'm getting a bit of problems.

 

I'm on step 3 (I haven't got the previous versions installed at all) and am trying to find the code:

 

<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CUSTOMERS; ?></td>

 

but I cannot find it in the file admin/includes/functions/general.php.

 

I also cannot find the next "step 3" code in that file. I have a hunch that it is supposed to be in another file? I cannot find these in either the 051113 or in the 060817 updates. Could you please check the install.txt file and double check the two "Step 3" instances. This is also a bit confusing as there are really two instances of "step 3" . It gives the impression that there are supposed to be two changes on the admin/includes/functions/general.php file.

 

Any help?

Share this post


Link to post
Share on other sites

Sorry about that, the install instructions are a little flaky. From the second step 3 down install.txt should look like this:

=========

STEP 4 ->

=========

 

FIND this CODE in admin/orders.php:

 

---------------------------------------------

 

<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CUSTOMERS; ?></td>

 

---------------------------------------------

 

REPLACE with THIS:

 

---------------------------------------------

 

<?php // ====> BOF: ORDERS AT-A-GLANCE <==== ?>

<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_ORDERNUM; ?></td>

<?php // ====> BEOF: ORDERS AT-A-GLANCE <==== ?>

<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CUSTOMERS; ?></td>

 

---------------------------------------------

 

 

=========

STEP 5 ->

=========

 

FIND this CODE in admin/orders.php:

 

---------------------------------------------

 

<td class="dataTableContent"><?php echo '<a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $orders['orders_id'] . '&action=edit') . '">' . tep_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW) . '</a> ' . $orders['customers_name']; ?></td>

 

---------------------------------------------

 

JUST ABOVE THAT ADD THIS:

 

---------------------------------------------

 

<?php // ====> BOF: ORDERS AND COMMENTS AT-A-GLANCE <==== ?>

<td class="dataTableContent" align="left"><?php echo '<b>' . $orders['orders_id'] . '</b>';

 

$products = "";

$products_query = tep_db_query("SELECT orders_products_id, products_name, products_quantity FROM " . TABLE_ORDERS_PRODUCTS . " WHERE orders_id = '" . tep_db_input($orders['orders_id']) . "' ");

while($products_rows = tep_db_fetch_array($products_query))

{

$products .= ($products_rows["products_quantity"]) . "x " . (tep_html_noquote($products_rows["products_name"])) . "<br>";

$result_attributes = tep_db_query("SELECT products_options, products_options_values FROM " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " WHERE orders_id = '" . tep_db_input($orders['orders_id']). "' AND orders_products_id = '" . $products_rows["orders_products_id"] . "' ORDER BY products_options");

while($row_attributes = tep_db_fetch_array($result_attributes))

{

$products .=" - " . (tep_html_noquote($row_attributes["products_options"])) . ": "

. (tep_html_noquote($row_attributes["products_options_values"])) . "<br>";

}

}

?>

<img src="images/icons/comment2.gif" onmouseover="ddrivetip('<?php echo '' . $products . ''; ?>', 'white', 300);" onmouseout="hideddrivetip();" align="top" border="0">

</td>

<?php // ====> EOF: ORDERS AT-A-GLANCE <==== ?>

 

---------------------------------------------

 

=========

STEP 6 ->

=========

 

 

FIND this CODE in admin/includes/languages/english/orders.php :

 

---------------------------------------------

 

define('TABLE_HEADING_CUSTOMERS', 'Customers');

 

---------------------------------------------

 

JUST ABOVE THAT ADD THIS:

 

---------------------------------------------

 

define('TABLE_HEADING_ORDERNUM', 'Order-Id');

 

---------------------------------------------

---------------------------------------------

 

DO THE SAME FOR OTHER LANGUAGES

 

---------------------------------------------

 

 

=========

STEP 7 ->

=========

(This step is not necessary if you have already installed "Comments at a Glance" v2x)

 

ADD FILE: Talk bubble icon "comment2.gif" to admin/images/icons directory

 

 

=========

 

That's it! Quick and easy, and now you will be able to see the orders_id and the Orders At-A-Glance

in the Admin Order's Page (the "Orders" page is under the "Customers" menu).

 

- Enjoy


Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Share this post


Link to post
Share on other sites

Thanks very much. That worked.

 

Could you help with one more thing, btw? I need the popup box to be a bit wider. How would I increase the width of that box?

 

Thanks for an excellent hack.

Firestar

Share this post


Link to post
Share on other sites

In admin/orders.php find in the new code

('<?php echo '' . $products . ''; ?>', 'white', 300);"

and change the 300 to whatever length you desire.


Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Share this post


Link to post
Share on other sites
Thanks very much. That worked.

 

Could you help with one more thing, btw? I need the popup box to be a bit wider. How would I increase the width of that box?

 

Thanks for an excellent hack.

Firestar

 

everything you need to know about how to tweak it can be found at:

 

www.bosrup.com/web/overlib

Share this post


Link to post
Share on other sites

Hi Dj

 

I just installed ORDERS AT-A-GLANCE 4.1

It works fine - but it gives me java script errors on edit_orders.php which also have tool tips ?

 

Can this be fixed?

 

Helle :-)

 

PS: I've renamed dhtmltooltip to dhtmltooltip2 on the edit_orders.php page - is that a good way to solve this?

Edited by HelleM

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×