PHP Fatal error: Cannot use object of type stdClass as array in /Users/alistairmcclymont/Sites/dl7artfo/sites/all/modules/commerce_email/theme/commerce-order-email.tpl.php on line 15
just got this error after upgrading - this error is produced when i complete checkout (i'm using paypal) and get returned to the site, I get a whitescreen and this error is in the log. I did have a bunch of test data being printed out in my email by inserting some php code in the order email. But i've since deleted all of that and still have the error.
Comments
Comment #1
paul.linney commentedThe reference to the customer name needs updated, as $customer_profile (object) now contains the full profile not just the customer address. This allows for custome data in the profile. Try dumping out $customer_profile in the template to see whats available.
I'll update the template to reflect the changes, as I missed them in last commit.
Paul
Comment #2
amcc commentedhow do you debug the emails - i'd like to do what you say and see what does what, but the only way i can see to test is buy buying something (in the sandbox) and getting an email, i'm sure there's a better method.
Comment #3
paul.linney commentedIn the commerce_email.rules.inc, after Line 78 put in:
I'll add in the basic options in the template comments when I update next time.
Paul
Comment #4
amcc commentedHow do i test what this is printing out. I'm struggling to work out how i can see the results of the bits of code i put into the email, and also the lines you've suggested about without completing an order and generating an email. Is there a debug method to generate this email or print on screen the results without going through the order process
thanks for the the help
(i'm using the latest version of all the modules by the way)
Comment #5
paul.linney commentedThis may work (untested). Get an order id and put this on a template in your theme, say bottom of page.tpl.php:
Replace ORDER_ID with any valid order.
Apologies for the inconvenience
Paul
Comment #6
amcc commentedsorry its taken a couple of days to test this. your instructions in #3 produces this after completing checkout
without that code i get a whitescreen, thanks for the help so far!
Comment #7
amcc commenteduninstalling the module, deleting the rule it creates and re-installing fixes this issue.
Comment #8
starsinmypockets commentedWas a patch committed for this? As far as I can see, replacing the array notation with object notation fixes this problem...
Comment #10
Isostar commentedI had the same issue when downgrading from 2.x. Uninstalling the module and deleting the rules as suggested in #6 didn't help.
I used own defined fields in the customer profile, maybe that is causing this error.