FoxyCart / foxycart-craft

CraftCMS integration for FoxyCart
7 stars 1 forks source link

Updating templates to account for some data potentially not being present #7

Closed adamjudd closed 5 years ago

adamjudd commented 5 years ago

Resolves #5

Not all customer data is required, and the legacy API response for blank values is interpreted as an empty array. When the Twig tries to output that as a string, it triggers an error.

This fix adds if conditionals around those values so it's only output if the value is present.

RobErskine commented 5 years ago

hey @adamjudd I checked out your branch and i'm still seeing the same error in #5. Is there anything else I can do to diagnose / help with this issue?

adamjudd commented 5 years ago

@RobErskine,

Oh it's not? Interesting. Could you check the logs and see if you can see what field is being tripped up by the array to string conversion? I thought I covered all the fields that could be empty, but I've obviously missed one somewhere that's impacting you here. The stack trace should show what field it's trying to output in the template.

RobErskine commented 5 years ago

@adamjudd sorry I just did a bunch of digging to find you logs which led me to clearing my Craft cache and all seems to be working now. I'm seeing live purchases as of today 3/19 in the admin panel now.

Sorry for the redundancy, but I think this is good now.

adamjudd commented 5 years ago

@RobErskine - ah, sorry yes, that would do it. Certain API requests are cached for 10 minutes to prevent duplicate requests in quick succession. Sorry for not thinking of that earlier. Glad it's working for you now!