News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Error when updating order status

Started by Andrew, January 06, 2019, 22:14:20 PM

Previous topic - Next topic

Andrew

Hi there. I am using PHP7.3 Joomla 3.9.1 and virtuemart 3.4.2 hosting on siteground. When I change an order status I am getting

An error has occurred.

    0 Call to undefined function mysql_real_escape_string()
Can anyway help?
Thanks
Andrew

GJC Web Design

I would suspect a 3rd party ext/plugin

I really can't imagine you are using mysql instead of mysqli and mysql_real_escape_string() is a native function that in Joomla/VM would normally be handled by the std DB class.

Check all plugins etc that are used

turn on all debug etc to find the stack/file that is causing this
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Andrew

Hi John. Am using mysqli. I turned on all the debug stuff but didn't understand it. Have copied the result in below. Couldn't leave it there as the site is live and they are expecting a lot of orders in very shortly, so what I have done is change the php version back to 5.6.39 I can now change the order status ok.
I should have said that the reason I had to change the order status was that after the customer bought the product it went to paypal, but paypal wasn't updating the status to confirmed - left it pending. I thought it was just a glitch between paypal and the site but have had a two in a row now. Last order on the 30th was fine. Will wait and see if the status gets updated correctly now.
Andrew

{
    "__default": {
        "session": {
            "counter": 8,
            "timer": {
                "start": 1546819459,
                "last": 1546819949,
                "now": 1546820005
            }
        },
        "registry": {
            "com_virtuemart": {
                "customfields": ""
            }
        },
        "user": {
            "id": 0,
            "name": null,
            "username": null,
            "email": null,
            "password": null,
            "password_clear": "",
            "block": null,
            "sendEmail": 0,
            "registerDate": null,
            "lastvisitDate": null,
            "activation": null,
            "params": null,
            "groups": [],
            "guest": 1,
            "lastResetTime": null,
            "resetCount": null,
            "requireReset": null,
            "aid": 0
        }
    },
    "__vm": {
        "manage": 0,
        "vmlastvisitedItemid": 1123,
        "vmlastvisitedcategoryid": 13,
        "vmlastvisitedmanuid": 0
    }
}

GJC Web Design

Hi Andrew, sorry .. didn't recognise u as that Andrew!

The problem as suspected is in that Xero shite plugin thing

            // Update the database record with the errors
            $q = "UPDATE  #__virtuemart_xero_transactions SET response = '" . mysql_real_escape_string(serialize($error_array)) . "'" . $element_set . " WHERE virtuemart_order_id = " . $orderId . ";";

have changed to
            $q = "UPDATE  #__virtuemart_xero_transactions SET ".$db->quoteName("response")." = " . $db->quote(serialize($error_array)) . " " . $element_set . " WHERE ".$db->quoteName("virtuemart_order_id"). " = " . $orderId . ";";

which gives the correct syntax

UPDATE  #__virtuemart_xero_transactions SET `response` = 'a:1:{i:0;s:0:\"\";}' , `invoice_added` = 'e' WHERE `virtuemart_order_id` = 4;

You should be fine on php7.x now
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Andrew

Once again, thanks very much John. I have put the site back to php7.3 Hope it goes back to normal! I was getting some late messages back from xero saying a transmission error had occurred and the problem was "" ie, nothing. When the site was on php5. I don't understand what changed to cause the prob. I have suggested that if there are more probs we ask you to look at it and you can charge them direct? Anyway, I'll email you if that's the case, and see how you're placed.
Thanks again
Andrew

mikeofmogo

#5
Hello Andrew,

I am trying to set up this bridge as well. and having the exact same problems.

I wasn't too keen to start modifying files as this only causes problems down the line when one does updates. Instead I go onto Xero support (no pun intended) and they recommended I downgrade PHP from 7 to 5. Can you believe it? Nowhere in the documentation provided by Bongo does it say the plugin does not work on PHP 7. Anyway, I downgraded reluctantly and the original 0 Call to undefined function mysql_real_escape_string() error disappeared. Fantastic!

Submitted a test order, status set to "confirmed" and what do you know, I get the same messages back from xero saying a transmission error had occurred and the problem was "" ie, nothing.

Long story short, did the database edit as suggested by GJC Web Design resolve both these issues we have both experienced? (Which means I upgrade PHP back to 7)

Many thanks. I'd appreciate any assistance here.

UPDATE: I changed site php version to 7.0, made the "// Update the database record with the errors" edit to the xero.php file but still get the "The following errors occurred while attempting to transmit website sale _______ to Xero:
-" Xero Transmission Error email


Andrew

Hi, Yes those changes worked worked for me. There is still a problem with the module though in that in doesn't calculate coupons or discounts. The last I talked to Bongo they said they had the code ready to put in but that was a month or so ago and they haven't replied when I asked again a couple of days ago. I also told them to update the code to make it work in php 7. Don't know if they have. Its the only bridge for zero I could find though. Well there were one or two others that were a few grand. With your other prob, maybe check your security cert settings and that it ain't expired or something. I had trouble with that. It does work though. Sorry I can't hep more that that. I'd just check all your paths to the keys are correct and all that.
Andrew