facebookarchive / facebook-for-magento

A first-party extension plugin built for Magento. This plugin will install a pixel on your site, upload your products into a catalog for use in FB ads, and (optionally) auto-create an FB shop with your products.
https://www.facebook.com/business/help/532749253576163
84 stars 57 forks source link

Gender problem - strtolower() expects parameter 1 to be string, array given #99

Closed anitr closed 5 years ago

anitr commented 5 years ago

Hi,

My client sent me your module to install it to his Magento page. And I am having issues after installing it to Magento version 1.9.3.10. I got this error:

"\"Warning: strtolower() expects parameter 1 to be string, array given in \/app\/code\/community\/Facebook\/AdsExtension\/Model\/FBProductFeed.php on line 299"

I used debugger to see what is happening, and I can see that I get array of 2 gender_ids in function: private function getGenderInformation($gender_id) which comes from $product->getData('gender') and this function is expecting only 1. Does this module not allow products to be available for 2 genders?

Thank you

dmitridr commented 5 years ago

Hello,

This looks like a bug to me, we can fix it. But the fix will be to take one of the genders or leave gender blank, it depends on what you'd prefer, please let us know your preference. I'm guessing leaving it blank is best in the case of multiple genders.

There is only one gender allowed per product by this plugin, due to a limitation on the Facebook Infrastructure side.

Is this warning causing the whole plugin to fail? Normally warnings are ignored unless your server is set up with strict settings for PHP.

anitr commented 5 years ago

Hello,

yes please, you can fix it that way - so if a product has multiple genders, leave it blank.

I use developer mode in my local server, so this warning breaks it all. I have to set it up on my localhost first, then if everything works fine, I will push it to production server - there, warnings are ignored.

Thank you again

dmitridr commented 5 years ago

We've fixed this in v2.6.2. Please open a new issue and reference this one if you continue to see the warning after update.