Skip to content

Pickup point data not populated in sales_order #25

@taskula

Description

@taskula

This is somewhat vague issue as we haven't yet figured out how it can be replicated, but I've decided to report it anyway in case someone else is experiencing the same problem.

The issue is that every now and then pickup_point_* fields in sales_order table do not get populated. When store staff attempt to create a new shipment, such order dies with an error "Error: 533, Unsupported product code: empty"

Since we don't know how the bug occurs, we've placed following SQL query in a cronjob to populate the missing fields when ever necessary. It helps the store staff by giving them the ability to reliably process shipments, but of course does not fix the root cause of this issue.

update sales_order set 
pickup_point_id=regexp_replace(shipping_method, '^pktkppickuppoint_', ''),
paketikauppa_smc=(case when shipping_description like '%Posti -%' then 2103 when shipping_description like '%Matkahuolto -%' then 90080 when shipping_description like '%DB -%' then 80010 end),
pickup_point_provider=(case when shipping_description like '%Posti -%' then "Posti" when shipping_description like '%Matkahuolto -%' then "Matkahuolto" when shipping_description like '%DB -%' then "DB Schenker" end),
pickup_point_name=shipping_description,
pickup_point_street_address=regexp_replace(regexp_replace(shipping_description, '^.*: ', ''), ',.*' ,''),
pickup_point_postcode=regexp_substr(shipping_description, '([0-9]){5}'),
pickup_point_city=regexp_replace(regexp_replace(shipping_description, '^.*,', ''), ' -.*', ''),
pickup_point_country="FI"
where shipping_method like 'pktkppickuppoint_%' and pickup_point_id is NULL

The empty fields in sales_order are

pickuppoint_zip | home_delivery_service_provider | pickup_point_provider | pickup_point_location | pickup_point_id | pickup_point_name | pickup_point_street_address | pickup_point_postcode | pickup_point_city | pickup_point_country | pickup_point_description | paketikauppa_smc

The following fields do get populated (these are what our SQL query uses for populating the missing fields)

shipping_description | shipping_method

Any idea what could be causing this bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    investigatingInvestigating, trying to reproduce, fixing it, etc...

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions