Jump to content
Jack_mcs

Additional Orders Info

Recommended Posts

I use this in my own shops and have installed it into quite a few others and such a problem doesn't exist in any of them so I don't have any ideas as to what the problem might be. Maybe it is somethng specific to your code. You could try the included files to see if it works or not. If it does, then you've made some mistake in the installation or there is something in your code that is conflicting with this contributions code.

Share this post


Link to post
Share on other sites

Hi

 

i only want to add order id on the orders screen, can you explain me what all things i need to use from the package

Share this post


Link to post
Share on other sites

No, the instructions would take too much time. You'll need to figure it out yourself.

Share this post


Link to post
Share on other sites

I haven't tried it but the changes are to existing files so I can't think of any reason why it won't.

Share this post


Link to post
Share on other sites

A new version has been uploaded with the following changes:

 

- Added highlight to the shipping address on the orders edit page if shipping address is different

- Added number of orders and total to the customer listing page

- Added files for quick install on oscommerce 2.3

- Fixed mistake in language file that caused the colors to be switched

- Fixed coding mistake in finding the customers ID in orders.php

Share this post


Link to post
Share on other sites

Jack, I have a sql error message but I will honest I don't know if it is related to this contribution (mainly because I don't know what the error is trying to tell me). But it only shows up on admin>order.php so that's why I wanted to check with you.

 

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 'my product name' and p.products_model = 'my product model#' at line 1

select p.products_id from products p left join products_description pd on p.products_id = pd.products_id where pd.products_name = 'my product name' and p.products_model = 'my product model#'
[TEP STOP]

 

Everything seems to run fine in the shop itself, but when i go to Admin>Customers>Orders I get this error message displaying above the list of orders.

 

Any idea what it is signaling?

Share this post


Link to post
Share on other sites

Jack, I have a sql error message but I will honest I don't know if it is related to this contribution (mainly because I don't know what the error is trying to tell me). But it only shows up on admin>order.php so that's why I wanted to check with you.

 

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 'my product name' and p.products_model = 'my product model#' at line 1

select p.products_id from products p left join products_description pd on p.products_id = pd.products_id where pd.products_name = 'my product name' and p.products_model = 'my product model#'
[TEP STOP]

 

Everything seems to run fine in the shop itself, but when i go to Admin>Customers>Orders I get this error message displaying above the list of orders.

 

Any idea what it is signaling?

That doesn't look like anything to do with this contribution. It doesn't even look valid since it is saying the product model is 'my product model#'. I suggest you use the included files to test, or start over with the changes to the orders file and do them one at a time, checking after each change.

Share this post


Link to post
Share on other sites

That doesn't look like anything to do with this contribution. It doesn't even look valid since it is saying the product model is 'my product model#'. I suggest you use the included files to test, or start over with the changes to the orders file and do them one at a time, checking after each change.

 

No, I changed the actual model # and product name because I didn't think you would know what they were.

 

It just started happening after this contribution was added and I uploaded my products with Easy Populate. So I figured it was one of the two, maybe it is EP related then.

 

Could you give me the sql command to "undo" the database changes that your installation sql command does?

Share this post


Link to post
Share on other sites

Jack,

 

When I set Show Orders Highlight Address Mismatch to False, there is no change. Is this supposed to turn off the highlighting on the orders page? order summary page? or both?

 

Using ver 1.5, on 2.2rc2a

 

Great work as always. Thanks.


-Dave

Share this post


Link to post
Share on other sites

Jack,

 

When I set Show Orders Highlight Address Mismatch to False, there is no change. Is this supposed to turn off the highlighting on the orders page? order summary page? or both?

 

Using ver 1.5, on 2.2rc2a

 

Great work as always. Thanks.

You're welcome and I appreciate the sentimate. :)

 

That setting is meant to control the indication that the billing and shipping address do not match. But I see now I only added the check for that setting on the orders listing page. It should be on the orders edit page as well. As it is, if you have an order where the billing and shipping address don't match, there will be a message indicating that when you select that order on the orders listing page.

Share this post


Link to post
Share on other sites

I changed

 

FIND (around line 220):
		    <td class="main"><?php echo tep_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br>'); ?></td>
REPLACE WITH:
		    <?php /*** BOF: Additional Orders Info ***/ ?>
		    <?php $style = (BillingShippingDontMatch($oID) ? 'style="color:red; font-weight:bold"' : '' );  ?>
		    <td class="main" <?php echo $style; ?>><?php echo tep_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br>'); ?></td>
		    <?php /*** EOF: Additional Orders Info ***/ ?>

 

TO

 

FIND (around line 220):
<td class="main"><?php echo tep_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br>'); ?></td>
REPLACE WITH:
		    <?php /*** BOF: Additional Orders Info ***/ ?>
		    <?php $style = (BillingShippingDontMatch($oID) ? 'style="color:red; font-weight:bold"' : '' );  ?>
		    <?php if (SHOW_ORDERS_HIGHLIGHT_ADDRESS_MISMATCH=='true') { ?>
		    <td class="main" <?php echo $style; ?>> <?php echo tep_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br>'); ?></td>
		    <?php }else{ ?>
		    <td class="main"><?php echo tep_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br>'); ?></td>
		    <?php } ?>
		    <?php /*** EOF: Additional Orders Info ***/ ?>

 

That works I think.

Edited by Roaddoctor

-Dave

Share this post


Link to post
Share on other sites

Yes, that will work. Or you can get rid of the if/else and use this line, which is what I will use in the next version

					    <?php $style = (SHOW_ORDERS_HIGHLIGHT_ADDRESS_MISMATCH=='true' && BillingShippingDontMatch($oID) ? 'style="color:red; font-weight:bold"' : '' );  ?>

Share this post


Link to post
Share on other sites

That doesn't look like anything to do with this contribution. It doesn't even look valid since it is saying the product model is 'my product model#'. I suggest you use the included files to test, or start over with the changes to the orders file and do them one at a time, checking after each change.

 

Jack,

 

I decided to start looking into this again to find out what's wrong.

 

I uploaded everything into a stock store and I am having the same problem with a certain item (There's something about Mary, dvd). I haven't check every item in the stock store but I found the error with this one so I figured I would reach out to you to see if you can find out what is causing the problem.

 

Just to refresh you on what I am experiencing:

 

When I am in my admin area and I click on Customers>Orders I get a list of orders that have been placed.

 

When I click on an individual order I get a brief description of the order contents.

 

But when I click on some orders (at this point anything containing the "There's Something About Mary" dvd I get the following error.

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 's Something About Mary' and p.products_model = 'DVD-TSAB'' at line 1
select p.products_id from products p left join products_description pd on p.products_id = pd.products_id where pd.products_name = 'There's Something About Mary' and p.products_model = 'DVD-TSAB'
[TEP STOP]

 

This is the only item that seems to throw things out of whack, but I don't know if this error is just a visual nuisance or if it is causing other issues that I haven't noticed yet.

 

By the way, I am using the included admin/orders.php file that was included with the contribution. And the sql command was run during the install. The contribution seems to function normally with the options under admin>configuration>additional info I just can't figure out why this specific stock osc item is causing this db error.

 

The only thing I see that is unusual is in the error, in the first paragraph it leaves out the beginning of the title of the dvd it doesn't list [There's Something] it shows [s Something] Could it have something to do with the apostrophe in the title?

Share this post


Link to post
Share on other sites

Just to refresh you on what I am experiencing:

 

When I am in my admin area and I click on Customers>Orders I get a list of orders that have been placed.

In admin/includes/genreal.php,replace this line
$prod_query = tep_db_query("select p.products_id from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id where pd.products_name = '" . tep_db_prepare_input($product['name']) . "' and p.products_model = '" . tep_db_prepare_input($product['model']) . "'");

with this one

$prod_query = tep_db_query("select p.products_id from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id where pd.products_name = '" . tep_db_input($product['name']) . "' and p.products_model = '" . tep_db_input($product['model']) . "'");

Edited by Jack_mcs

Share this post


Link to post
Share on other sites

In admin/includes/genreal.php,replace this line

$prod_query = tep_db_query("select p.products_id from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id where pd.products_name = '" . tep_db_prepare_input($product['name']) . "' and p.products_model = '" . tep_db_prepare_input($product['model']) . "'");

with this one

$prod_query = tep_db_query("select p.products_id from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id where pd.products_name = '" . tep_db_input($product['name']) . "' and p.products_model = '" . tep_db_input($product['model']) . "'");

 

Jack,

 

I don't have a admin>includes>general.php file. I have a general.js file in there.

 

You meant admin>includes>functions>general.php right? I tried the code replacement in there and it fixed it. Just want to make sure I did it in the right spot though.

Share this post


Link to post
Share on other sites

No, I changed the actual model # and product name because I didn't think you would know what they were.

 

It just started happening after this contribution was added and I uploaded my products with Easy Populate. So I figured it was one of the two, maybe it is EP related then.

 

Could you give me the sql command to "undo" the database changes that your installation sql command does?

 

 

Hi ggrant3

 

I have exactly the same problem as you have. I figure out it is not cuase by other addon as I had uninstalled it and the error still remain there. Could you please kindly share the solution how you fix the error ?

 

Many thanks in advance.

 

Lyn

Share this post


Link to post
Share on other sites

In admin/includes/genreal.php,replace this line

$prod_query = tep_db_query("select p.products_id from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id where pd.products_name = '" . tep_db_prepare_input($product['name']) . "' and p.products_model = '" . tep_db_prepare_input($product['model']) . "'");

with this one

$prod_query = tep_db_query("select p.products_id from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id where pd.products_name = '" . tep_db_input($product['name']) . "' and p.products_model = '" . tep_db_input($product['model']) . "'");

 

Hi Jack,

 

I had the exactly same problem as ggrant3.

I modify the general.php with new code you provide, I got new error message as below:

 

Fatal error: Call to undefined function tep_get_version() in /admin/includes/header.php on line 32

 

can you please help? Thanks in advance. Lynn

Share this post


Link to post
Share on other sites

The tep_get_version function is a core oscommerce function, not part of this contribution, so it seems you have overwritten it, or somehow deleted it, in your changes.

Share this post


Link to post
Share on other sites

@@Jack_mcs

Jack -

Just installed this on a new 2.3.3.4 shop. All is well with one exception.

 

This line, from admin\orders.php

 

        $contents[] = array('text' => $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . sprintf(TEXT_PRODUCTS_REMAINING, GetProductsOnHand($order->products[$i])));

 

is causing this when you single click (select) any order that contains, for example, "A Bug's Life"

 

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 's Life' and p.products_model = 'DVD-ABUG'' at line 1
select p.products_id from products p left join products_description pd on p.products_id = pd.products_id where pd.products_name = 'A Bug's Life' and p.products_model = 'DVD-ABUG'

 

It's a single quote issue I'm pretty sure. Why would this be a problem here? I noticed a similar use of

$order->products[$i]['name']

earlier in the file and there is no issue. I'm a bit confused.

 

If I remove the offending line all is well, so I am 99% sure I'm looking at the problem code. If I manually edit out the single quote from A Bug's Life, then all is well.

 

Changing the product title itself made no difference, as this is reading from TABLE_ORDERS_STATUS_HISTORY and not the product listing itself... What to do

 

Any ideas?

Edited by Roaddoctor

-Dave

Share this post


Link to post
Share on other sites

I hadn't tried this in 2.3.3.4 but I just did and see the error you found. To fix it, in admin/includes/functions/general.php, find

$prod_query = tep_db_query("select p.products_id from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id where pd.products_name = '" . tep_db_prepare_input($product['name']) . "' and p.products_model = '" . tep_db_prepare_input($product['model']) . "'");

and replace it with

$prod_query = tep_db_query("select p.products_id from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id where pd.products_name = '" . tep_db_input($product['name']) . "' and p.products_model = '" . tep_db_input($product['model']) . "'");

Edited by Jack_mcs

Share this post


Link to post
Share on other sites

@@Jack_mcs

 

Just noticed that

 

Products Ordered: 1

1 x A Bugs Life

(On Hand: 6)

 

is broken on an order with the same single quote in the title, vs. an identical order with the ' edited out.

 

Products Ordered: 1

1 x A Bug's Life

(On Hand: )

 

I'm seeing that is part of the same GetProductsOnHand function. Something more needed?

 

Thank you!


-Dave

Share this post


Link to post
Share on other sites

I'm not seeing that here. Are you sure you made both changes to the line I mentioned?

Share this post


Link to post
Share on other sites

Jack I found what was happening...

During debugging at one point I had changed the product name, removing the single quote, so I assume with mismatches of NAME, somewhere in the code things get boogered. When I put the single quote back into the product title, testing with one order with single quote and one without, the behavior described above inverts, like

 

Products Ordered: 1

1 x A Bugs Life

(On Hand: )

 

 

Products Ordered: 1

1 x A Bug's Life

(On Hand: 6)

 

By correcting the product title to the original with single quote, and editing the single quote back into the orders, things match and work properly. So I believe things are good.

 

Thank you thank you


-Dave

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

×