bobbingwide / vgc

VGC - Garden Vista Group theme
GNU General Public License v2.0
0 stars 0 forks source link

Avoid messages when Product is not connected to a Brand #64

Open bobbingwide opened 1 year ago

bobbingwide commented 1 year ago

When I imported the two products from my original test environment WordPress Importer reported that everything was OK but that wasn't actually the case.

Product Original ID New ID Brand
A test product 6 x 4 ft 7982 9565 [CDATA[a:1:{i:0;s:4:"2314";}]] = BIC
A test product 10 x 10ft 8030 9566 [CDATA[a:1:{i:0;s:4:"2318";}]]

The value for the Brand relationship for 9566 was incorrect ID 2318 doesn't match any value: BIC (2314), Eden Greenhouses (2316) nor Elite Greenhouses (8593)

Therefore it failed when looking up the brand to find:

Since no brand was returned the code failed trying to process a null field.

Workaround

Fix

Originally posted by @bobbingwide in https://github.com/bobbingwide/gardenvista/issues/27#issuecomment-1779539717

bobbingwide commented 1 year ago

Note: You can see which products are not connected to a Brand using

There are currently 30 products not connected, including one called test ( ID 9557 ) ... which is still causing problems!

The Brand can also be viewed on the Product Ranges tab.