If this is your first visit, check our documentation. To post, register or login.
Forums / Community Contributed Add-Ons / Addon Shipping Modules / Website not replying to Shipstation

Website not replying to Shipstation

Started by helenewallis on 30 Jun 2021, 2:54 AM · Views: 2,215

Results 1 to 9 of 9
30 Jun 2021, 2:54 AM
#1
helenewallis avatar

helenewallis

Totally Zenned

Join Date:
Jun 2016
Location:
Suffolk VA
Posts:
625
Plugin Contributions:
0

Post #1 by helenewallis

I've been using ShipStation along with ZC 1.55a for about five years now, with no problems except ShipStation's occasional bugs. Recently, I installed the new ShipStation module from the plugins. It specifically states that it works with 1.55, so I didn't expect any problems. However, although I didn't realize it immediately, ShipStation is no longer receiving a reply from the website when it tries to update the customer record with the shipping information (shipping service, date, tracking number, etc). The record is actually being updated, but ShipStation isn't getting the expected response back from Zencart that the update was successful. In some cases, there have been multiple attempts over a 24-hour period that resulted in fifteen or twenty updates to the order record.

I assumed this was a ShipStation problem, but their support people say Zencart simply isn't replying to them. Here is the communication they sent. I've obscured their password and the tracking number. Otherwise, it's exactly as they provided it to me.

GET https://www.newnaturalsonline.com/shipstation_zc.php?SS-UserName=shipstation&SS-Password=xxxxxxxx&action=update&order_number=7951&status=shipped&comment=Package+shipped+on+6%2f25%2f2021+via+USPS+First+Class+Mail.+Tracking+No+940011110840002xxxxxx&carrier_cost=3.49 HTTP/1.1
SS_AUTH_USER: shipstation
SS_AUTH_PW: xxxxxxx
User-Agent: ShipStation
Authorization: Basic c2hpcHN0YXRpb246c2hpcDkwMTIx
Host: https://www.newnaturalsonline.com
Cookie: cookie_test=this_is_a_terrible_hack
Connection: Keep-Alive

HTTP/1.1 200 OK
Date: Tue, 29 Jun 2021 21:37:37 GMT
Server: Apache
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: zenid=5d63t3svj8ugra64ndeicvjtq0; path=/; domain=www.newnaturalsonline.com; secure; HttpOnly
Strict-Transport-Security: max-age=300; includeSubDomains; preload
Upgrade: h2,h2c
Connection: Upgrade, Keep-Alive
Keep-Alive: timeout=5, max=100
Content-Type: text/xml;charset=UTF-8
Content-Length: 2

30 Jun 2021, 11:56 AM
#2
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,146
Plugin Contributions:
56

Post #2 by lat9

I just 'hit' your site via FireFox and see (in the browser's console log): Cookie “zenid” has been rejected for invalid domain.

I'm guessing that that's part of the issue.

30 Jun 2021, 2:31 PM
#3
helenewallis avatar

helenewallis

Totally Zenned

Join Date:
Jun 2016
Location:
Suffolk VA
Posts:
625
Plugin Contributions:
0

Post #3 by helenewallis

lat9:

I just 'hit' your site via FireFox and see (in the browser's console log): Cookie “zenid” has been rejected for invalid domain.

I'm guessing that that's part of the issue.

Well--all I can say is that nothing has changed recently except updating the ShipStation plugin. I'll follow up on that.

30 Jun 2021, 4:05 PM
#4
helenewallis avatar

helenewallis

Totally Zenned

Join Date:
Jun 2016
Location:
Suffolk VA
Posts:
625
Plugin Contributions:
0

Post #4 by helenewallis

lat9:

I just 'hit' your site via FireFox and see (in the browser's console log): Cookie “zenid” has been rejected for invalid domain.

I'm guessing that that's part of the issue.

I can see I'm going to end up learning more about browser innards than I have time for right now. I don't see any cookies when I look at the errors in the browser console. And I see a session id only when click on one of the site catgories, not when I bring up the home page. Are you seeing a session id on the home page?

30 Jun 2021, 7:53 PM
#5
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,146
Plugin Contributions:
56

Post #5 by lat9

HeleneWallis:

I can see I'm going to end up learning more about browser innards than I have time for right now. I don't see any cookies when I look at the errors in the browser console. And I see a session id only when click on one of the site catgories, not when I bring up the home page. Are you seeing a session id on the home page?
I 'hit' the site without the www. prefix, do you have anything in your .htaccess to redirect to the www. site when no www. is present in the URL?

30 Jun 2021, 8:35 PM
#6
barco57 avatar

barco57

Totally Zenned

Join Date:
Apr 2006
Location:
West Salem, IL
Posts:
2,846
Plugin Contributions:
0

Post #6 by barco57

Ok, I also have this issue with a 1.5.7 site. After conversing on the phone with Helene I think I may have a handle on this problem

in the "old code" for updating the order

} else {

                    $db->Execute("update " . TABLE_ORDERS . "
    	                        set orders_status = '" . zen_db_input($status) . "', last_modified = now()
    	                        where orders_id = '" . (int) $_GET['order_number'] . "'");

                    $db->Execute("insert into " . TABLE_ORDERS_STATUS_HISTORY . "
    	                      (orders_id, orders_status_id, date_added, customer_notified, comments)
    	                      values ('" . (int) $_GET['order_number'] . "',
    	                      '" . zen_db_input($status) . "',
    	                      now(),
    	                      '" . zen_db_input($customer_notified) . "',
    	                      '" . zen_db_input($comments) . "')");
                    echo 'Status updated successfully';
                }

The echo 'Status updated successfully' is what ShipStation is looking at to

The "new code"

                if (function_exists('zen_update_orders_history')) {
                    zen_update_orders_history((int)$_GET['order_number'], $comments, (!empty($_GET['SS-UserName']) ? zen_db_input($_GET['SS-UserName']) : 'ShipStation'), $status, $customer_notified, false);
                } else {

                    $db->Execute("update " . TABLE_ORDERS . "
    	                        set orders_status = '" . zen_db_input($status) . "', last_modified = now()
    	                        where orders_id = '" . (int) $_GET['order_number'] . "'");

                    $db->Execute("insert into " . TABLE_ORDERS_STATUS_HISTORY . "
    	                      (orders_id, orders_status_id, date_added, customer_notified, comments)
    	                      values ('" . (int) $_GET['order_number'] . "',
    	                      '" . zen_db_input($status) . "',
    	                      now(),
    	                      '" . zen_db_input($customer_notified) . "',
    	                      '" . zen_db_input($comments) . "')");
                    echo 'Status updated successfully';
                }

so if it finds zen_update_orders_history function it uses that to update the order, which doesn't echo 'Status updated successfully' for ShipStation to see

I checked Helene's files and she does indeed have the includes/functions/extra_functions/osh_updated_by_functions.php file so her site is skipping the echo also

Mike
AEIIA - Zen Cart Certified & PCI Compliant Hosting
The Zen Cart Forum...Better than a monitor covered with post-it notes!

30 Jun 2021, 9:08 PM
#7
helenewallis avatar

helenewallis

Totally Zenned

Join Date:
Jun 2016
Location:
Suffolk VA
Posts:
625
Plugin Contributions:
0

Post #7 by helenewallis

barco57:

Ok, I also have this issue with a 1.5.7 site. After conversing on the phone with Helene I think I may have a handle on this problem

in the "old code" for updating the order

} else {

                $db->Execute("update " . TABLE_ORDERS . "
	                        set orders_status = '" . zen_db_input($status) . "', last_modified = now()
	                        where orders_id = '" . (int) $_GET['order_number'] . "'");

                $db->Execute("insert into " . TABLE_ORDERS_STATUS_HISTORY . "
	                      (orders_id, orders_status_id, date_added, customer_notified, comments)
	                      values ('" . (int) $_GET['order_number'] . "',
	                      '" . zen_db_input($status) . "',
	                      now(),
	                      '" . zen_db_input($customer_notified) . "',
	                      '" . zen_db_input($comments) . "')");
                echo 'Status updated successfully';
            }
> 
> The echo 'Status updated successfully' is what ShipStation is looking at to 
> 
> The "new code" 
> ```
                if (function_exists('zen_update_orders_history')) {
                    zen_update_orders_history((int)$_GET['order_number'], $comments, (!empty($_GET['SS-UserName']) ? zen_db_input($_GET['SS-UserName']) : 'ShipStation'), $status, $customer_notified, false);
                } else {

                    $db->Execute("update " . TABLE_ORDERS . "
    	                        set orders_status = '" . zen_db_input($status) . "', last_modified = now()
    	                        where orders_id = '" . (int) $_GET['order_number'] . "'");

                    $db->Execute("insert into " . TABLE_ORDERS_STATUS_HISTORY . "
    	                      (orders_id, orders_status_id, date_added, customer_notified, comments)
    	                      values ('" . (int) $_GET['order_number'] . "',
    	                      '" . zen_db_input($status) . "',
    	                      now(),
    	                      '" . zen_db_input($customer_notified) . "',
    	                      '" . zen_db_input($comments) . "')");
                    echo 'Status updated successfully';
                }

so if it finds zen_update_orders_history function it uses that to update the order, which doesn't echo 'Status updated successfully' for ShipStation to see

I checked Helene's files and she does indeed have the includes/functions/extra_functions/osh_updated_by_functions.php file so her site is skipping the echo also

I just pm'd you about that, should have looked here first, lol. Your 1.57 client is never replying back to Shipstation because the echo statement isn't in there for that section of the logic.

1 Jul 2021, 4:28 PM
#8
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,146
Plugin Contributions:
56

Post #8 by lat9

Perhaps changing that "new" block:

                if (function_exists('zen_update_orders_history')) {
                    zen_update_orders_history((int)$_GET['order_number'], $comments, (!empty($_GET['SS-UserName']) ? zen_db_input($_GET['SS-UserName']) : 'ShipStation'), $status, $customer_notified, false);
                } else {

                    $db->Execute("update " . TABLE_ORDERS . "
    	                        set orders_status = '" . zen_db_input($status) . "', last_modified = now()
    	                        where orders_id = '" . (int) $_GET['order_number'] . "'");

                    $db->Execute("insert into " . TABLE_ORDERS_STATUS_HISTORY . "
    	                      (orders_id, orders_status_id, date_added, customer_notified, comments)
    	                      values ('" . (int) $_GET['order_number'] . "',
    	                      '" . zen_db_input($status) . "',
    	                      now(),
    	                      '" . zen_db_input($customer_notified) . "',
    	                      '" . zen_db_input($comments) . "')");
                    echo 'Status updated successfully';
                }

... so that the echo's always performed:

                if (function_exists('zen_update_orders_history')) {
                    zen_update_orders_history((int)$_GET['order_number'], $comments, (!empty($_GET['SS-UserName']) ? zen_db_input($_GET['SS-UserName']) : 'ShipStation'), $status, $customer_notified, false);
                } else {

                    $db->Execute("update " . TABLE_ORDERS . "
    	                        set orders_status = '" . zen_db_input($status) . "', last_modified = now()
    	                        where orders_id = '" . (int) $_GET['order_number'] . "'");

                    $db->Execute("insert into " . TABLE_ORDERS_STATUS_HISTORY . "
    	                      (orders_id, orders_status_id, date_added, customer_notified, comments)
    	                      values ('" . (int) $_GET['order_number'] . "',
    	                      '" . zen_db_input($status) . "',
    	                      now(),
    	                      '" . zen_db_input($customer_notified) . "',
    	                      '" . zen_db_input($comments) . "')");
[B]//[/B]                    echo 'Status updated successfully';
                }
               [B]echo 'Status updated successfully';[/B]
6 Jul 2021, 3:18 PM
#9
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #9 by drbyte

lat9:

Perhaps changing that "new" block:

            if (function_exists('zen_update_orders_history')) {
                zen_update_orders_history((int)$_GET['order_number'], $comments, (!empty($_GET['SS-UserName']) ? zen_db_input($_GET['SS-UserName']) : 'ShipStation'), $status, $customer_notified, false);
            } else {

                $db->Execute("update " . TABLE_ORDERS . "
                            set orders_status = '" . zen_db_input($status) . "', last_modified = now()
                            where orders_id = '" . (int) $_GET['order_number'] . "'");

                $db->Execute("insert into " . TABLE_ORDERS_STATUS_HISTORY . "
                          (orders_id, orders_status_id, date_added, customer_notified, comments)
                          values ('" . (int) $_GET['order_number'] . "',
                          '" . zen_db_input($status) . "',
                          now(),
                          '" . zen_db_input($customer_notified) . "',
                          '" . zen_db_input($comments) . "')");
                echo 'Status updated successfully';
            }
> ... so that the echo's always performed:
> ```
                if (function_exists('zen_update_orders_history')) {
                    zen_update_orders_history((int)$_GET['order_number'], $comments, (!empty($_GET['SS-UserName']) ? zen_db_input($_GET['SS-UserName']) : 'ShipStation'), $status, $customer_notified, false);
                } else {

                    $db->Execute("update " . TABLE_ORDERS . "
                                set orders_status = '" . zen_db_input($status) . "', last_modified = now()
                                where orders_id = '" . (int) $_GET['order_number'] . "'");

                    $db->Execute("insert into " . TABLE_ORDERS_STATUS_HISTORY . "
                              (orders_id, orders_status_id, date_added, customer_notified, comments)
                              values ('" . (int) $_GET['order_number'] . "',
                              '" . zen_db_input($status) . "',
                              now(),
                              '" . zen_db_input($customer_notified) . "',
                              '" . zen_db_input($comments) . "')");
[B]//[/B]                    echo 'Status updated successfully';
                }
               [B]echo 'Status updated successfully';[/B]

Yes, I agree, that should work fine.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.