06-20-2022 11:15 AM - edited 06-22-2022 04:16 PM
Trying to integrate Shipstation with Magento 2.4.4. The extension is version 2.3.1 from the Magento marketplace. I'm getting the following error in the admin area.
Deprecated Functionality: error_log(): Passing null to parameter #1 ($message) of type string is deprecated in /home/public_html/magento/vendor/auctane/api/Model/NoConfigNotification.php on line 32
Looking at NoConfigNotification.php, I can see the configuration is supposed to be done from my shipstation.com account. I have tried setting up the store integration there, but I get a 404 error. I can see the APIs in swagger. I'm able to manually hit the GET API (v1/auctane/configure). I figured out from looking at Authenticator.php that I needed to pass 'ShipStation-Access-Token' in the header with the generated api key as it's value. I tried with cURL and get a 200 OK. I'm also able to hit the POST API and pass dummy values which make the above error go away. So, it seems the APIs are working. I'm not sure why Shipstation is getting a 404. Any ideas how to get this working?
06-20-2022 02:36 PM - edited 06-20-2022 02:37 PM
Well we were able to get the Magento Admin side working... and we've got our connection (sort of) successfully made between Magento 2.4.4 and ShipStation. But there's more problems.... let's say you DO get your Magento installation connected to ShipStation you are still going to face an uphill battle:
auctane_api.ERROR: Deprecated Functionality: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /chroot/home/xxxxx/vendor/auctane/api/Model/Action/Export.php on line 312
ShipStation hasn't made much of an effort to help Magento users fix these problems. We connected immediately and without any issues via ShippingEasy but their system is worse than ShipStation. No APP. Unable to send shipment notification emails for "MARK AS SHIPPED" orders. As much as we hate ShipStation V3 we'd love to stick around if we can get Magento 2.4.4 working properly. If not we've got to move on until ShipStation can get their act together.
Aloha
06-20-2022 02:55 PM
It seems like maybe I have an API missing. When I test the connection, I get 'GET /index.php/api/auctane?action=export&start_date=06%2f20%2f2022+21%3a33&end_date=06%2f20%2f2022+21%3a38&page=1' written to my SSL log. /index.php/api/auctane seems to be the page which isn't found. I was using Easyship, but I got frustrated with it because everytime I needed to use it, I would have to reset the API connection.
06-20-2022 02:59 PM - edited 06-20-2022 03:00 PM
Can't help with the module install. Via Composer it went pretty smooth for us. No different than any other module. Unfortunately it still doesn't work. 😂
Search the interwebz and you'll find no shortage of Magento users that have MADE IT WORK eventually but it sure would be nice to have a working module for 2.4.4 right out of the box. OR... do what ShippingEasy does and skip the crap and just go straight to a User / Password approach. That makes it relatively easy to get going but the ShippingEasy product is weak sauce compared to the features ShipStation offers (when it works).
Aloha
06-20-2022 03:02 PM
I also installed with Composer. No apparent problems there. It just doesn't work. I'll keep trying.
06-20-2022 03:23 PM
Unfortunately the "support" that ShipStation is going to give you by email will most likely be next to useless. I think the ShipStation support employees make the minimum effort but it's hard to blame them as they aren't Magento Developers. Magento is downright difficult and one semicolon in the wrong spot brings down the house. I'm hoping that some Moderator will see the length of this thread and make a call to the person within ShipStation (or whatever agency they use for development) and get this fixed. An option we're exploring is to hire a professional Magento developer (we aren't pros, we run our own site because we're cheap) and get this fixed but that's a last resort.
Aloha
06-20-2022 04:59 PM
That sounds expensive. I'll probably just go back to easyShip. It may have been frustrating to have to reset the connection all the time, but at least it was functional. This kind of makes me mad because we pay a monthly fee for the service. They spend millions on TV ads. They need to put some money into making their products compatible with the platforms they advertise them for.
06-20-2022 09:31 PM - edited 06-20-2022 09:35 PM
I got it working. The problem is that Shipstation puts index.php in the URL. So, when testing the connection, it's trying to get mysite.com/index.php/api/auctane, but the API is at mysite.com/api/auctane. I put a redirect in my vhost file and it works now. That's not to say everything works, but just that I was able to connect my store. Now I'll see what the next issue is.
06-20-2022 10:23 PM
Have you been able to pull order data from the Magento site into ShipStation yet? Connection was the easy part for us... getting it to actually retrieve data has proven less so.
Aloha
06-20-2022 10:45 PM
Can't say for certain because I have no orders. I'll try doing a test buy tomorrow. Right now, the issue seems to be Shipstation trying to POST to /index.php/rest/V1/auctane/configure but the API is at /rest/V1/auctane/configure. Can't redirect a POST request, so I'm trying to get rewrite to change it.
06-21-2022 12:59 PM
Fixed it. Added the following rewrite rules in my servers vhosts.conf file (could also be done in .htaccess). If a request comes in with index.php in the url, it redirects it without the index.php.
RewriteCond %{REQUEST_URI} ^/index.php/
RewriteRule (.*)index\.php/(.*) /$2 [L,R=307,NC,QSA]
Doesn't seem to be importing orders yet. I'll tackle that next.
06-21-2022 04:38 PM
Doesn't seem to be importing orders yet. I'll tackle that next.
That's the fun part.
Aloha
06-21-2022 09:09 PM - edited 06-21-2022 09:14 PM
I'm making progress. The initial error I posted above (Deprecated Functionality: error_log(): Passing null to parameter #1...) was caused by the POST API rest/all/V1/auctane/configure not being available when I set up Checkout Rates under Store Setup ->MyStore->Edit Store Details. I knew from my logs that a POST request had tried to access that API yesterday. This is something which seems to only happen once. If it fails, there is no way to reset it and try again. What it does is it sets the 3 config variables. Those variables are rates_url, option_key, and marketplace_key. The rates_url is the shipping rates API endpoint. The other 2 variables seem to be identifiers for something. The main thing is, nothing works if these aren't set. To get this to work, I set my store to inactive and then clicked the 'Connect a Store or Marketplace' button and just created a new store integration. As soon as I set up the Checkout Rates, it set the 3 config variables in the database. It sucks having to set it all up again, but aside from putting in a support ticket, I think it was the only way. It still isn't importing orders, but with the other error out of the way, I can figure out what the issue is. BTW, I've been developing my own business software for years. I usually work with Java and C#. I'm new to Magento, and I haven't worked with PHP much, but with enough time and patience, I can figure anything out. Troubleshooting is something I'm good at.
06-21-2022 09:27 PM
What's odd is your initial setup seems to have been fraught with issues... and ours was relatively simple to connect. We've tried disconnecting the store on the ShipStation side and then creating a new connection and the "test connection" works just fine. We created a new connection with the hope it would import data... any data. NOPE. Zero, zilch, nada pinata. It doesn't even throw us an error to look for.
Aloha
06-21-2022 09:41 PM - edited 06-21-2022 10:00 PM
It could just be related to my server configuration. Are you on Magento 2.4.4 and ShipStation 2.3.1? I just found an error in auctane/api/Model/Action/Export.php. The variable _attributes is null, and shouldn't be. This is probably why it's not exporting orders. In the database table 'core_config_data' under path is 'shipstation_general/shipstation/attribute'. The corresponding value is null, and that is what Export.php is looking for.
Edit: That was an easy one. In Magento->Configuration->ShipStation->General Settings, you just have to select some attributes in the Export custom attributes as custom options section. Still not exporting orders though.
06-21-2022 10:21 PM - edited 06-21-2022 10:30 PM
Got it! In Magento, go to your orders and click view. On the order page, at the top, click ship. That opens the New Shipment page. At the bottom, click Submit Shipment. Now go to ShipStation and the order will import. Pending orders don't import. They have to be processing. Maybe there's an easier way, like some setting to make them automatically set to processing. Also, as I mentioned in the previous post, if you don't have any attributes selected it throws an error and probably won't export. So, select some attributes even if you don't intend to use them.
06-21-2022 10:36 PM
That's a weird workflow... in the past we never had do change the status. When an order is placed the payment has already been "authorized" so the order status for a new order defaults to Processing which is an attribute that ShipStation recognizes. Telling the system "Submit Shipment" doesn't seem like the correct way to go about it. Just for giggles I created a dummy order and did as you mentioned... viewed the order and hit Submit Shipment. Went back to ShipStation and performed another manual refresh and there was nothing there.
Aloha
06-21-2022 10:45 PM
Did you select some attributes as I said in the previous post? If none are selected, it causes an error in the export script.
06-21-2022 10:56 PM
I'm not exactly sure where or which attributes you are referring to. These settings within ShipStation? If not... can you screenshot what you are talking about?
Many Mahalos!
06-21-2022 11:01 PM
In Magento. Under ShipStation in configuration.
06-21-2022 11:02 PM
Scratch that... I see what you are saying. And it worked!
I deleted all of the "Export custom attributes as custom options" selections and saved. Cleaned / Flushed Cache. Then went back and added a few. Saved. Then went back to ShipStation and voila! Something happened. 😉
ShipStation owes you a credit. Now we need to un-cancel our cancellation. 😉
Aloha
06-21-2022 11:06 PM
Awesome! It's really dumb that it fails if no attributes are selected. I'm going to continue trying to find a better option than having to manually create shipments. That's just too much work.
06-21-2022 11:12 PM
So in our configuration we do NOT have to manually create anything. If you go back to my screenshot you should see that "processing" is a state that allows the import of an order. What is the status of your order as created? Are you just testing with "Fake" orders? If so... you might have to tinker with the initial status of the order when Magento receives and posts it.
Say you place a new "Telephone" order from the frontend. It will sit there in limbo in the eyes of ShipStation because it's not in processing. If you generate a new legitimate order with a Payment Authorization taking place on the front end it should post into Magento as "processing" under the order status. In that case it will be picked up by ShipStation. Another option may be to look back at the screenshot I posted and see if you can add your current order status to ShipStation.
That make any sense?
Aloha
06-21-2022 11:30 PM
You're correct. I just did a real purchase from the frontend and it imports with no issues. That's odd, because the first order was done that way and it showed as pending like the dummy orders.
06-30-2022 07:49 AM
Hello I was just wondering if I am missing a step? I tried this as well and am having no such luck. Everything is connected I have added so custom attributes as custom options, flushed cache, tried updating ship station, then done the process over and over changing the custom attributes as custom options and trying again but I'm still not having any luck....
06-30-2022 08:32 AM
Do you have any errors displaying in Magento admin?
06-30-2022 03:12 PM
No I have no errors and everything looks to be setup right. Even on Ship Station it is showing that it is connected but no orders are importing. Everything was working great until I updated Magento to the newest 2.4.4 Version.
06-30-2022 03:30 PM
I've heard that 2.4.4 causes grief with Shipstation...
06-30-2022 03:47 PM
It works fine once you get it set up correctly. The developers could certainly have done a better job of preventing the errors which result from bad setups though
06-30-2022 03:50 PM
In your install directory, navigate to magento->var->log. In there, you should have a shipping.log file. See if there are any errors in it.
07-01-2022 08:56 AM
I just look and got 1 order out of around 60 to import to ship station.
This was the error that I had in the backend which is above in the thread. I think why it didn't work for me is because not all my products have these custom options..
auctane_api.ERROR: Deprecated Functionality: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /chroot/home/a3938f96/fusionfirearms.com/html/vendor/auctane/api/Model/Action/Export.php on line 312 [] []
07-01-2022 11:33 AM
Update: As of now i added a custom attribute to products called Shipstation just to add something to all my products and still no luck....... and of course ship station hasn't responded in 3 days to any of my questions.....
07-02-2022 04:01 AM - edited 07-02-2022 04:06 AM
I found out a bit more about the issues with ShipStation and Magento 2.4. The problem is that PHP 8.1 deprecates passing null to a lot of functions, including the trim() function which is where your issue comes from. Previously, if a variable was null, it would be silently converted to an empty string and you wouldn't get the error. The odd thing here is that it isn't supposed to throw an error until PHP 9. My guess is it's something in Magento that throws an error on certain warnings. Anyway, a temporary fix is to use the null coalescing operator. Open yoursite/html/vendor/auctane/api/Model/Action/Export.php in a text editor and locate line 312.
It will look like this:
if (empty(trim($internalNote->getComment()))) continue;
Replace it with this:
if (empty(trim($internalNote->getComment() ?? ''))) continue;
The correct way to fix this is to make a module which overrides the Export.php class, but first I want to see if this is the only error. If it is, I can throw a module together to fix it in about 5 minutes which will get you by until ShipStation gets around to fixing it.
07-02-2022 02:00 PM
This worked!!! But im not sure why but it would only import the orders from todays date but not any others from previous days.
07-02-2022 02:04 PM
I really appreciate the help as well. You are helping me more than shipstation!
07-02-2022 05:44 PM
@TSFUSION wrote:I really appreciate the help as well. You are helping me more than shipstation!
You're welcome. The thing with customer support is they aren't software developers. When something doesn't work, all they can do is forward the issue to the tech department. Since they don't write their own software, it probably just hits a dead end at that point.
11-14-2022 06:37 AM
Hello Swappart, I just updated the theme on my website which cause me to have to do a complete database overwrite. I dont know why this is causing issues with shipstation because the development site was a copy of the original where we made the changes. I have checked all the files that I previously changed and they are how we left them. So im not sure why I cant get them to import. I have look through the entire thread and have double checked everything we did last time. If you have any suggestions that would be great.
My store shows that is is connected in shipstation.
No Errors Show.
I have Attributes selected for export.
I have double checked line 312 in export.php
07-02-2022 05:39 PM
Check the shipping log again and see if there are any new errors. Sometimes we fix one thing, only to find that there's something else that's also broken.
07-04-2022 09:17 AM
I checked the log and the only errors that I see are for an order a month ago that has already shipped and been fulfilled. Below are the 2 errors
auctane_api.ERROR: Not all of your products are available in the requested quantity. [] []
auctane_api.ERROR: Shipment can not be created for Order #000032639. Here the reasons: No order item can be sent [] []
Not sure if we need to fix anything. Everything else is running through smoothly so far.
07-09-2022 04:38 AM
The fix we did won't survive an update.
I put a plugin together which will permanently fix this, as well as all of the other issues. I'm just extensively testing it before making it available.