Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with orders that have no address #39

Closed
aeu opened this issue Nov 29, 2021 · 8 comments
Closed

Error with orders that have no address #39

aeu opened this issue Nov 29, 2021 · 8 comments
Assignees

Comments

@aeu
Copy link

aeu commented Nov 29, 2021

11/29/2021 04:47 :
An error occurred attempting to update orders: Error in XML. Reason: The 'Country' element is invalid - The value '' is invalid according to its datatype 'StringExactly2' - The actual length is less than the MinLength value.

We have orders in our system which don't have addresses but they are being sent to ShipStation which is rejecting them. The problem is that from that point onward, ShipStation stops processing and no subsequent orders are being sent.

We need a way to mark orders to not be sent to ShipStation (ref: #38)

@sjcallender
Copy link
Contributor

Hi @aeu - See the detailed instructions here on how you can do this by creating more than one "store" endpoint.
#19 (comment)

@aeu
Copy link
Author

aeu commented Nov 29, 2021

Hi @sjcallender - that looks like its exactly what we need. I'll give it a shot and hopefully you'll never hear from me again. 😄

@aeu
Copy link
Author

aeu commented Nov 30, 2021

Hello - I did these steps and now am getting 401 for user authorization (this was not happening before). Is there a way to test this (via curl for example) so I can isolate the problem to my end vs. the shipstation interface?

@sjcallender
Copy link
Contributor

For curl, can you try following this other comment? #36 (comment)

@aeu
Copy link
Author

aeu commented Nov 30, 2021

Hi, curl worked great.

This is what I am have in my admin:
00-order-fields

01-order

02-shipping-info-field

03-store-type-field

My curl:

curl \ --request GET 'https://not.the.real.site.com/actions/shipstationconnect/orders/process?store=standard&action=export' \ --header 'Authorization: Basic not the real info='

And the response:
{"error":"SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_storeType' in 'where clause'\nThe SQL being executed was: SELECT COUNT(*)\nFROM (SELECTelements.idASelementsId, elements_sites.idASelementsSitesId, content.idAScontentId\nFROM elements elements\nINNER JOIN commerce_orders commerce_ordersONcommerce_orders.id=elements.id\nLEFT JOIN commerce_addresses billing_addressONbilling_address.id=commerce_orders.billingAddressId\nLEFT JOIN commerce_addresses shipping_addressONshipping_address.id=commerce_orders.shippingAddressId\nINNER JOIN elements_sites elements_sitesONelements_sites.elementId=elements.id\nINNER JOIN content contentONcontent.elementId=elements.id\nWHERE (commerce_orders.isCompleted=TRUE) AND (field_storeType='standard') AND (elements.archived=FALSE) AND (elements.dateDeleted IS NULL) AND (elements.draftId IS NULL) AND (elements.revisionIdIS NULL))subquery\nINNER JOIN commerce_orders commerce_ordersONcommerce_orders.id=subquery.elementsId\nLEFT JOIN commerce_addresses billing_addressONbilling_address.id=commerce_orders.billingAddressId\nLEFT JOIN commerce_addresses shipping_addressONshipping_address.id=commerce_orders.shippingAddressId\nINNER JOIN elements elementsONelements.id=subquery.elementsId\nINNER JOIN elements_sites elements_sitesONelements_sites.id=subquery.elementsSitesId\nINNER JOIN content contentONcontent.id=subquery.contentId"}

@sjcallender
Copy link
Contributor

@johnnynotsolucky - Can you take a look at this tomorrow?

@aeu
Copy link
Author

aeu commented Nov 30, 2021

FYI

MariaDB [myDatabaseName]> show columns from content;
+-------------------------------------+---------------+------+-----+---------+----------------+
| Field                               | Type          | Null | Key | Default | Extra          |
+-------------------------------------+---------------+------+-----+---------+----------------+
| id                                  | int(11)       | NO   | PRI | NULL    | auto_increment |
| elementId                           | int(11)       | NO   | MUL | NULL    |                |
| siteId                              | int(11)       | NO   | MUL | NULL    |                |
| title                               | varchar(255)  | YES  | MUL | NULL    |                |
| dateCreated                         | datetime      | NO   |     | NULL    |                |
| dateUpdated                         | datetime      | NO   |     | NULL    |                |
| uid                                 | char(36)      | NO   |     | 0       |                |
| field_summary                       | text          | YES  |     | NULL    |                |
| field_wholesalePrice                | decimal(12,2) | YES  |     | NULL    |                |
| field_subtitle                      | text          | YES  |     | NULL    |                |
| field_productDescription            | text          | YES  |     | NULL    |                |
| field_shortTitle                    | text          | YES  |     | NULL    |                |
| field_titleSegmentOne               | text          | YES  |     | NULL    |                |
| field_titleSegmentTwo               | text          | YES  |     | NULL    |                |
| field_featuredVideo                 | text          | YES  |     | NULL    |                |
| field_contentBlock1_zbffhfye        | text          | YES  |     | NULL    |                |
| field_contentBlock2_cmajwvhx        | text          | YES  |     | NULL    |                |
| field_contentBlock3_uyecsfae        | text          | YES  |     | NULL    |                |
| field_contentBlock4_oxnjsxqw        | text          | YES  |     | NULL    |                |
| field_contentBlock5_iucermmr        | text          | YES  |     | NULL    |                |
| field_featuredVideoPadding_jkrvxrlv | text          | YES  |     | NULL    |                |
| field_costOfGoods_vgdhhdrq          | decimal(12,2) | YES  |     | NULL    |                |
| field_message_toqblkac              | text          | YES  |     | NULL    |                |
| field_storeType_vvcxynwm            | varchar(255)  | YES  |     | NULL    |                |
| field_anotherStoreType_uazjzkcy     | varchar(255)  | YES  |     | NULL    |                |
+-------------------------------------+---------------+------+-----+---------+----------------+
25 rows in set (0.001 sec)

@johnnynotsolucky
Copy link
Contributor

@aeu thank you for the column listing. The important information is that the field column names now include a suffix for all new fields. See craftcms/cms#6922.

Unfortunately the change mentioned is a breaking change for any code which relies on queries which touch the field columns in the content table. In this case, it's related to OrdersController.php#L137-L140 where we assume the a field is assumed to have the format of "field_{$handle}".

This should be resolved in 1.3.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants