Updating Woocommerce Orders Programmatically - mysql

I have an eCommerce site running Woocommerce on top of Wordpress, and the company running it has changed there shipping system to an external company who stores the products in their warehouse and ships the products when they are bought.
In terms of automation, downloading information on new orders and sending it to the shipping company is fine, but when they respond to me with an XML of the orders sent and the associated tracking numbers, I need to be able to have a system that automatically updates the orders (including sending out the emails necessary). However, the only way I currently know how to do that is to update the MySQL database. But with that method, the automated email system is overridden and ignored.
Does anyone know how I can update orders statues and other information programmatically, which would allow Woocommerce's internal functions to be executed in the same way as manually logging into the admin side and updating the order?

Found a solution to this yet?
The code below works to mark an order as complete, but does not execute other actions as you describe in the admin
// create a new checkout instance and order id
$checkout = new WC_Checkout();
$this_order_id = $checkout->create_order();
$order = new WC_Order($this_order_id);
$order->update_status('completed');

Related

How do I make it possible that my spring boot application updates the created_by automatically when I have when say adding products to a product table

Dears, I am able to create a rest api that saves, deletes and updates products or asserts and within the asserts entity class I have a created_by field mapped to a database table which I can only update by typing my name every time to show that I am the one who have created it, but however this is not what I want, I have got a rest api that simply asks for my username and password and validate against the users table in the database.
So I want the this userid to continue to linger into the application session as long as the rest api app is running and then when I create new asserts(products) the methods defined for saving those products should automatically save that currently running user_id in memory.
I have no idea how I can accomplish this. Please any ideas.
I have created my entity classes for Asserts, Users and I can perform all CRUD actions on them successfully but the problem is on saving the user automatically without manually saving the user_id everytime an assert(product) is added, deleted, or updated.

Update shopify inventory automatically

I have a shopify website, but my fulfilment process is done outside of shopify, meaning that when the customer picks a product, it redirects to another service, were the fulfillment is done, and the the purchase is concluded. Because of that, shopify has no way to know if the purchase is concluded or not, so the store has to be updated manually. This is what I would like to avoid.Is is there an app, or a way I can update shopify by sending a json or a CSV with the updated products? And does uploading a CSV with the entirety of my data to repopulate my inventory a valid idea?
I expect there to be an outside service/App that might be able to help automate this, because I am able to receive a Json file (via an api) with all the info of the products that have been purchased, but I don't know how to use it to update shopify.
Even if you fulfill external to Shopify with a service, Shopify can be set to maintain your inventory by removing the sold inventory. Fulfillment does not really come into play.
Regardless though, Shopify does have an API, and there are handy calls that let you update 100 SKUs with a new quantity, in one API call, at one location. So if you have a CSV or JSON file, it is very easy to use that data to update Shopify. Make authenticated API calls. In the store itself, you can generate a token allowing API updates, and you can test with Postman, meaning your total investment in this is near zero.

Number of users logged in Business Objects 5.x Version

I am trying to create audit report for number of users logged in business objects.
I have read from Blogs , this version is not supported with Query Builders, not able to connect through query Builder.
I tried to run these scripts to identify number of users logged in BO, in
MS access Query:
SELECT * FROM CI_INFOOBJECTS
WHERE SI_PARENTID=23 AND SI_NAME = 'COMPANY A'
I have also found this script in SAP blogs
SELECT count (SI_NAME) FROM CI_SYSTEMOBJECTS
WHERE SI_LASTLOGONTIME> '2013.02.14.00.00.01' AND SI_KIND = 'Connection'
Error for both queries:
Tables/objects do not exist
I Guess this is only supported for newer versions of BO repository. Any one could help me to create similar scripts for BO repository for 5X version of Busienss objects. I am not familiar with older version tables and could not build query.
Note: I want to query number of users logged into Business objects at
a given period
Database: BO repository
SQL : MS Access
I don't believe the number or list of active users is query-able in BO prior to XI. You can get the list of active users in the Admin Console, however. The number of active users is displayed in the status bar, and the list of active users is available on the Site Properties tab -- click on "List of logged in users".
If you want historical connection info, then that will be available in the auditing tables, provided that you have a license for Auditor and it is enabled in Admin Console.
Note that this will not capture users logged in to Full Client (aka DeskI); only those logged in to Infoview.

Structuring a booking website

I am very new to web development, and I'm trying to get my head around the most efficient method in creating the website.
The premise of the website is for booking activities in various locations. Processes I believe that would take place are:
Customer books activity;
Request updates database, and request is sent to vendor;
If vendor approves request, confirmation is sent to customer in the form of QR code, barcode, and numerical code (for redemption);
If approved, customer is charged the amount of the activity.
My question is what structure should I use in approaching this problem? My thoughts at the moment is placing the website in Google' app engine, using mySQL database.
Any thoughts would be greatly appreciated.
If you're using GAE, I suggest looking into NDB Datastore. https://cloud.google.com/appengine/docs/python/ndb/
Customer books activity → a) store in ndb datastore and b) verify that information → send to vendor
Confirmation (display URL code e.g. http://website.com/?c=generaterandomlongstringhere)
If URL is clicked, you can add a confirm as well after like accept | decline (e.g. http://website.com/?c=generaterandomlongstringhere&?v=acceptordecline)
Update NDB and Charge user

Working with multiple facebook apps user id v1.0 and v2.0

We're using multiple Facebook apps for our product, in V1.0 we used to get the same user id for all apps. We save accounts collection in our db in which we save Facebook id in and creating new accounts for users in which we don't have their FB id already.
Last week we've created a new app, when we started to use it we found out that we're getting a different id for existing users and we're creating a new account for them in our db. (This happened because the new app was created on v2.0 as explained here - https://developers.facebook.com/docs/apps/upgrading#upgrading_v2_0_user_ids)
I read that we can use business manager in order to define all apps and get all the user id for all apps under the same business (https://developers.facebook.com/docs/apps/for-business), but I couldn't find how can I connect these ids to the original id.
I saw a hack that once I have app_scoped_id, I can make a another FB api call to get the original id (Get Facebook User ID from app-scoped User ID) but this means I keep managing the FB ids on our db, is this a good approach? or should I move on to manage the app scope ids? how can I get them for my V1.0 apps before this transition takes place? can I migrate my data in db (when having FB global ids only)? or do I must have a user access token in order to get this info?
Thanks!
Ilana