Jump to content
Jack_mcs

Additional Orders Info

Recommended Posts

Hi Jack,

I see that there has been no activity in a while but just to update for those who are still using this useful add-on... passing to php 7.2 on the admin side, when you click "invoice" for an order the undefined constant error comes up for SHOW_INVOICE_SHIPPING.

To fix it I just put it in single quotes 'SHOW_INVOICE_SHIPPING', so in admin/includes/functions/general.php :

CHANGE

***************************************************

////
/*** BOF: Additional Orders Info ***/
// Return orders shipping method
  function tep_get_orders_shipping_method($order_id) {
    $check_order_query= tep_db_query("select title from " . TABLE_ORDERS_TOTAL . " where orders_id='" . $order_id . "' and class='ot_shipping'");
    $check_order= tep_db_fetch_array($check_order_query);
    if (SHOW_INVOICE_SHIPPING=='2' and ($check_order['title']=='United Parcel Service' or $check_order['title']=='United States Postal Service')) {
      // return short version on UPS and USPS

***************************************

TO

**************************************

////
/*** BOF: Additional Orders Info ***/
// Return orders shipping method
  function tep_get_orders_shipping_method($order_id) {
    $check_order_query= tep_db_query("select title from " . TABLE_ORDERS_TOTAL . " where orders_id='" . $order_id . "' and class='ot_shipping'");
    $check_order= tep_db_fetch_array($check_order_query);
    if ('SHOW_INVOICE_SHIPPING'=='2' and ($check_order['title']=='United Parcel Service' or $check_order['title']=='United States Postal Service')) {
      // return short version on UPS and USPS

*******************************************************

Works for me but you are the programmer so you can check to see if it is the right fix.

 

Bobbee

Share this post


Link to post
Share on other sites

@lucsangelIt looks like the reason for the failure in this case is because 'SHOW_INVOICE_SHIPPING' is not defined. I looked in V 1.5 (the last released version) and don't see it there. What version of this addon are you using? And what version of oscommerce? Is there a setting in this addons settings that allows you to control that item?

Share this post


Link to post
Share on other sites
1 minute ago, Jack_mcs said:

@lucsangelIt looks like the reason for the failure in this case is because 'SHOW_INVOICE_SHIPPING' is not defined. I looked in V 1.5 (the last released version) and don't see it there. What version of this addon are you using? And what version of oscommerce? Is there a setting in this addons settings that allows you to control that item?

Hello Jack I am using the latest version you uploades v.1.5  https://apps.oscommerce.com/8oFiX&additional-orders-info  with FROZEN BS3 and see no control in configuration Additionnal Info for this in particular. So many of the 

Share this post


Link to post
Share on other sites
Just now, lucsangel said:

Hello Jack I am using the latest version you uploades v.1.5  https://apps.oscommerce.com/8oFiX&additional-orders-info  with FROZEN BS3 and see no control in configuration Additionnal Info for this in particular. So many of the 

addons are throwing these types of errors. (sorry my hand slipped and posted without finishing). It happens on PHP 7.2, not in the earlier versions

Share this post


Link to post
Share on other sites

@lucsangel

PHP 7.2 is much more strict than prior versions. Both Frozen and almost all add-ons need updating to work without warnings under 7.2. If you can try running PHP 7.1, I think most of those warnings will go away.

M


Get the latest Responsive osCommerce CE (community edition) here .

Share this post


Link to post
Share on other sites

@lucsangelI can't see that the SHOW_INVOICE_SHIPPING was ever declared in any of the versions for this addon. So the change you made will stop the error but it will cause the code to always skip that part. Without the change you made, it would most likely do the same since it was not declared and would probably be set to 0. I'll take a closer look at the code when I can and fix that as needed. Thanks for reporting it.

Share this post


Link to post
Share on other sites
2 hours ago, Jack_mcs said:

@lucsangelI can't see that the SHOW_INVOICE_SHIPPING was ever declared in any of the versions for this addon. So the change you made will stop the error but it will cause the code to always skip that part. Without the change you made, it would most likely do the same since it was not declared and would probably be set to 0. I'll take a closer look at the code when I can and fix that as needed. Thanks for reporting it.

Thank you Jack. It is a great addon.

Share this post


Link to post
Share on other sites

@Jack_mcs  Been using this addon for years and find it really helpful. I have just tried to install the latest version of this addon to the latest version of Phoenix running on php7.3. I have uploaded the supplied admin/orders.php file rather than try to cut and paste the code into a standard file as I thought it would be easiest. I get the same error as mentioned above. The actual error I am getting is

Quote

Warning: Use of undefined constant SHOW_INVOICE_SHIPPING - assumed 'SHOW_INVOICE_SHIPPING' (this will throw an Error in a future version of PHP) in /####/####/####/####/####/includes/functions/general.php on line 1585

There is also another error

Quote

Warning: sizeof(): Parameter must be an array or an object that implements Countable in /####/####/####/####/####/orders.php on line 526

Line 526 is

if (sizeof($order->products[$i]['attributes']) > 0) {

Any help would be appreciated.


REMEMBER BACKUP, BACKUP AND BACKUP

Get the latest Responsive osCommerce CE (community edition) here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
Share on other sites

@14steve14The original purpose of the SHOW_INVOICE_SHIPPING option was to shorten the UPS and USPS shipping lines. So a line like this

Quote

United States Postal Service 1 lbs, 5.76 oz (Priority Mail):

would be changed to

Quote

United States Postal Service

But there's no way for the code to work as it is, even if that option was present. So unless you or others see a need for that, change this code in the admin/includes.functions/additional_orders_info.php file

  if (SHOW_INVOICE_SHIPPING=='2' && ($check_order['title']=='United Parcel Service' or $check_order['title']=='United States Postal Service')) {
    // return short version on UPS and USPS
    $short_shipping_end= strpos($check_order['title'], '');
    $short_shipping= substr($check_order['title'], 1, $short_shipping_end);
    return $short_shipping;
  } else {
    // return normal shipping
    return $check_order['title'];
  }

to

    return $check_order['title'];

For the second one, I can't find that code anywhere in this addon. Please state the file it is in and I will take a look.

Share this post


Link to post
Share on other sites

Cheers @Jack_mcs changing the suggested code worked a treat. For some reason the other error has gone. May be will have to try turning it off and back on again for other errors. LOL.😁😁


REMEMBER BACKUP, BACKUP AND BACKUP

Get the latest Responsive osCommerce CE (community edition) here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
Share on other sites

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

×