Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Fn_Change_Order Status Not Working Since Upgrade Rate Topic   - - - - -

 
  • jt_shop
  • Junior Member
  • Members
  • Join Date: 13-Mar 11
  • 12 posts

Posted 02 November 2017 - 10:02 AM #1

Hi,

 

We use the website to also handle offline payments, such as cash and via PIN. We have a plugin that's supposed to take care of the order status of these orders, because otherwise the status will stay on waiting for payment.

 

This is the function, in the func.php file from the add-on:

function fn_quick_order_form_change_order_status(&$status_to, &$status_from, &$order_info, &$force_notification, &$order_statuses, &$place_order)
{
    $payment_method_ids = array(22,23);    
    if($status_to == "O" && $status_from == "N" && in_array($order_info['payment_id'], $payment_method_ids))
    {
        $status_to = "C"; 
}
}

And it's registered in the init.php file:

fn_register_hooks(
   'change_order_status'
);

Yet nothing happens. I've seen that in 4.6.2 the change_order hook has been changed a bit, but I don't know how to make it working again.

 

Thanks in advance.



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 21984 posts

Posted 02 November 2017 - 12:56 PM #2

Please make sure that payment methods IDs were not changed during upgrade process


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)

 
  • jt_shop
  • Junior Member
  • Members
  • Join Date: 13-Mar 11
  • 12 posts

Posted 02 November 2017 - 05:55 PM #3

I have - it's still 22 for cash and 23 for pin.



 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 12071 posts

Posted 02 November 2017 - 06:38 PM #4

I would add some logging to veriffy that the full condition is being satisfied, especially the '$from_status field.  There might be an intermediate step being generated that is affecting the condition.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • galtinbaeva
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 06-Dec 13
  • 3627 posts

Posted 03 November 2017 - 05:43 AM #5

I have - it's still 22 for cash and 23 for pin.

 

Hello!

 

You can quickly check what's happening in this function. Just add this code in the function:

if ($_SERVER['REMOTE_ADDR'] == 'YOUR_IP') {
    fn_print_die($status_to, $status_from, $order_info['payment_id']);
}

Paste your IP and place order.


Simtech Development | sales@simtechdev.com | www.simtechdev.com
CERTIFIED CS-CART PARTNER | LICENSES | DEVELOPMENT | ADD-ONS | DESIGN | UPGRADE

Google Analytics Enhanced Ecommerce - get advanced ecommerce analytics


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 21984 posts

Posted 03 November 2017 - 06:06 AM #6

Since order statuses are updated by ajax, I suggest you to use the following code

fn_set_notification('E', __('notice'), 'TO: ' . $status_to . ' FROM: ' . $status_from . ' PAYMENT: ' . $order_info['payment_id']);


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)

 
  • jt_shop
  • Junior Member
  • Members
  • Join Date: 13-Mar 11
  • 12 posts

Posted 03 November 2017 - 01:40 PM #7

Adding either of those codes to my function doesn't actually do anything... it's as if it's never executed. I forgot a ; and the page didn't load anymore; so it does load func.php in but apparently the function is never called...

 

Putting die(); at the beginning of the function does nothing. So I assume it has something to do with the hook not being called, but then I would have to be looking into the core files... And I'm no expert unfortunately.



 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 12071 posts

Posted 03 November 2017 - 06:56 PM #8

Then you most likely have a typo in your init.php where you call register_hooks() or you have register_hooks in a non-standard location and it's not being called.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 21984 posts

Posted 06 November 2017 - 06:56 AM #9

Do other functions of the module work correctly after upgrade?


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)