facebookarchive / facebook-for-magento2

* Pixel on all pages, which trigger events link, PageView, ViewContent, AddToCart, Initiatecheckout and Purchase.* In the background, Syncs the products from the merchants product catalog to Facebook Catalog.* Stores all the data, like pixel id, catalog id, business maanger id, on to the local database on the instance.
Other
46 stars 36 forks source link

An FBR Installation or Catalog does not exist #28

Closed nix0x00 closed 1 year ago

nix0x00 commented 3 years ago

Hey, finally 1.4.0 is working, however upon pushing the product I get below error in the facebook log file.

Pushing batch 1 with 29 products [] []
[2021-04-13 23:05:23] FBE.INFO: Store id---1 [] []
[2021-04-13 23:05:23] FBE.INFO: Months since last update : 0 [] []
[2021-04-13 23:05:23] FBE.INFO: Catalog Batch API - https://graph.facebook.com/v10.0/fbe_catalog/batch?fbe_external_business_id=fbe_magento_1_607623b33eb38 [] []
[2021-04-13 23:05:23] FBE.INFO: Product push response "{\"error\":{\"message\":\"(#33) An FBE installation or associated Catalog does not exist for the business with ID fbe_magento_1_607623b33eb38, or cannot be loaded due to missing permissions\",\"type\":\"OAuthException\",\"code\":33,\"fbtrace_id\":\"A66Xa-pxOKx3qwN5uYDRGC4\"}}" [] []
xxu3-sc commented 3 years ago

Hi quick question, did you setup the integration before sync catalog? This error happens when our extension can not find the catalog id in database.

xxu3-sc commented 3 years ago

If something wrong with the integration, you can go to store-facebook-setup and delete connection, then re connect. Usually this problem can be solved.

nix0x00 commented 3 years ago

If something wrong with the integration, you can go to store-facebook-setup and delete connection, then re connect. Usually this problem can be solved.

I previously had installed the extension, then as it was not working and i didn't know what to do there were no tutorials etc. I thought of redoing from start and I pretty much tried to delete everything from the Facebook Business, though I failed as it wasn't being deleted automatically.

Then, I uninstalled the extension, and reinstalled it in Magento, connected with Facebook thinking that it shall recreate or fix any issues.

Though I am not sure if it did. So, now i don't know what to check for this issue.

xxu3-sc commented 3 years ago

Hi we recently created a user guide can be downloaded at https://marketplace.magento.com/facebook-facebook-for-magento2.html#product.info.details.tech_specs If you want to re-install, you can go to Admin-Stores-Facebook-Setup and then click Connection Setting, you will see a button called delete connection.

nix0x00 commented 3 years ago

Hi we recently created a user guide can be downloaded at https://marketplace.magento.com/facebook-facebook-for-magento2.html#product.info.details.tech_specs If you want to re-install, you can go to Admin-Stores-Facebook-Setup and then click Connection Setting, you will see a button called delete connection.

Hey, so I reconnected and made sure the Facebook for Magento user has all the access, and now when I click Push to facebook, I get below message in log:

[2021-04-14 00:38:21] FBE.INFO: Pushing batch 1 with 29 products [] []
[2021-04-14 00:38:21] FBE.INFO: Months since last update : 0 [] []
[2021-04-14 00:38:21] FBE.INFO: Catalog Batch API - https://graph.facebook.com/v10.0/455926898953866/items_batch [] []
[2021-04-14 00:38:23] FBE.INFO: Product push response "{\"handles\":[\"Acy9dHqd-4VvkzQtTKGa4r7qYDz2JsjOTtusYsInefJYk0BhAblNcXoJd8qlHy_4B3JtwgNqtyHGZY11q23mRJiSOObnsI43LraRYN1j1clqlg\"]}" [] []

Upon checking the Catalog I can see the 29 products which is sweet.

1) However, among those 29 products I have 1 product on SALE. But in catalog I do not see the sale price, instead it shows actual price. 2) I can see only 1 image per product, so is it by default? or is there a setting which will allow facebook users to view all the images of that certain product?

xxu3-sc commented 3 years ago

Hi regarding images, it should show all images(up to 10). It might take few minutes before those images showed up. If you still don't see them in 10 min, let me know. I will fix it.

nix0x00 commented 3 years ago

Hi regarding images, it should show all images(up to 10). It might take few minutes before those images showed up. If you still don't see them in 10 min, let me know. I will fix it.

I just checked now, and i can see only one image per product in the catalog. Please check the images below:

Image 1 Image 2 Image 3

xxu3-sc commented 3 years ago

Got it. This is actually a serious issue for us. Do you have any coding knowledge? If yes you can help me detect the issue. First open file $MagentoRoot/app/code/Facebook/BusinessExtension/Model/Product/Feed/Builder.php Add these two lines of code at line 355 right after the line with $imageUrl = $this->trimAttribute(self::ATTR_IMAGE_URL, $images['main_image']);

$this->fbeHelper->log('images path'); $this->fbeHelper->log(json_encode($images)); Then replace self::ATTR_ADDITIONAL_IMAGE_URL => implode(',', $images['additional_images']), to self::ATTR_ADDITIONAL_IMAGE_URL => $images['additional_images'],

Then you can sync catalog again either by editing product or click the sync catalog button in Stores/Configuration/Facebook

First verify if the image sync is correct, then go to the log files at $MagentoRoot/var/log/facebook-business-extension.log Send me a screenshot of logs containing image path

nix0x00 commented 3 years ago

Got it. This is actually a serious issue for us. Do you have any coding knowledge? If yes you can help me detect the issue. First open file $MagentoRoot/app/code/Facebook/BusinessExtension/Model/Product/Feed/Builder.php Add these two lines of code at line 355 right after the line with $imageUrl = $this->trimAttribute(self::ATTR_IMAGE_URL, $images['main_image']);

$this->fbeHelper->log('images path'); $this->fbeHelper->log(json_encode($images)); Then replace self::ATTR_ADDITIONAL_IMAGE_URL => implode(',', $images['additional_images']), to self::ATTR_ADDITIONAL_IMAGE_URL => $images['additional_images'],

Then you can sync catalog again either by editing product or click the sync catalog button in Stores/Configuration/Facebook

First verify if the image sync is correct, then go to the log files at $MagentoRoot/var/log/facebook-business-extension.log Send me a screenshot of logs containing image path

I made those necessary changes, then edited product price and following are the logs.

Note: I do not see sync catalog buttin In Stores/Config/Facebook. The only button is to push. Note: The product price was successfully updated in Facebook/Catalog but still has 1 image of product.

Logs:

[2021-04-14 03:43:49] FBE.INFO: ViewCategory event fired for Pixel id : 496419364713597 [] []
[2021-04-14 03:44:21] FBE.INFO: AddToCart event fired for Pixel id : 496419364713597 [] []
[2021-04-14 03:44:22] FBE.INFO: Sending event 59b007e1-3788-45d0-9c42-39780a4705c9 [] []
[2021-04-14 03:44:22] FBE.INFO: ViewContent event fired for Pixel id : 496419364713597 [] []
[2021-04-14 03:45:19] FBE.INFO: Sending event c0f588c0-3247-4ec6-8f9d-c16c0245b629 [] []
[2021-04-14 03:45:20] FBE.INFO: InitiateCheckout event fired for Pixel id : 496419364713597 [] []
[2021-04-14 03:55:15] FBE.INFO: images path [] []
[2021-04-14 03:55:15] FBE.INFO: {"main_image":"https:\/\/www.website.com\/media\/catalog\/product\/s\/c\/screen_shot_2021-04-05_at_6.34.09_pm.png","additional_images":["https:\/\/www.website.com\/media\/catalog\/product\/s\/c\/screen_shot_2021-04-05_at_4.59.28_pm.png","https:\/\/www.website.com\/media\/catalog\/product\/s\/c\/screen_shot_2021-04-05_at_5.02.48_pm.png"]} [] []
[2021-04-14 03:55:15] FBE.INFO: Months since last update : 0 [] []
[2021-04-14 03:55:15] FBE.INFO: Catalog Batch API - https://graph.facebook.com/v10.0/455926898953866/items_batch [] []
nix0x00 commented 3 years ago

Alright, looks like In the products I have to at least input 1 field of facebook attributes then only I can see all the images of product in the catalog.

But this doesn't make sense, I don't know why, shouldn't the extension sync its attribute with that of Magento?

xxu3-sc commented 3 years ago

What? I am glad you can sync addition images but surprised about your findings? Could you verify again? There is a latency before catalog can show additional images. Also you need to refresh the catalog pages. Meanwhile I am looking into the code to see if we are doing something wrong.

nix0x00 commented 3 years ago

What? I am glad you can sync addition images but surprised about your findings? Could you verify again? There is a latency before catalog can show additional images. Also you need to refresh the catalog pages. Meanwhile I am looking into the code to see if we are doing something wrong.

Nope I confirm, additional images are being loaded for only those products where I set at least 1 facebook attribute. Refreshing doesn't help, and this change is instant i.e. the moment I add FB attribute e.g. Material to a product, the images for that product can be seen in the Catalog.

Now my question... are those FB attributes really important? what's the purpose? what if I leave majority of those blank?

xxu3-sc commented 3 years ago

Those attributes help Facebook understand products. They are useful for ranking and categorizing. They are optional.

nix0x00 commented 3 years ago

Those attributes help Facebook understand products. They are useful for ranking and categorizing. They are optional.

Ah I see. Well for now, I hope its all well. I should request for shop review lol. Thanks mate. +1

xxu3-sc commented 3 years ago

Wait...I still need your help detecting this issue. Could you add this line of code $this->fbeHelper->log(json_encode($entry)); before and after $this->enhancedCatalogHelper->assignECAttribute($product, $entry); This is where the code handle the facebook attributes. Also if you can test on products with and without facebook attributes, that would tell how the facebook attributes changed the full request.

xxu3-sc commented 3 years ago

Additional images are critical for shop ranking. If a product does not have more than 3 images it will have low ranking scores.

nix0x00 commented 3 years ago

Additional images are critical for shop ranking. If a product does not have more than 3 images it will have low ranking scores.

Okay after further testing it seems that it has nothing to do with the FB attributes lol. If I save the product, the catalog gets updated automatically with additional images. So for my previous products, all I had to do is (open the product and save).

However, below are the logs with/without fb attributes.

Log without FB attribute:

[2021-04-14 05:07:12] FBE.INFO: images path [] []
[2021-04-14 05:07:12] FBE.INFO: {"main_image":"https:\/\/www.website.com\/media\/catalog\/product\/i\/m\/img-4067_1.jpg","additional_images":["https:\/\/www.website.com\/media\/catalog\/product\/i\/m\/img-4066.jpg","https:\/\/www.website.com\/media\/catalog\/product\/i\/m\/img-4068_1.jpg","https:\/\/www.website.com\/media\/catalog\/product\/i\/m\/img-4069_1.jpg"]} [] []
[2021-04-14 05:07:12] FBE.INFO: {"id":"54","item_group_id":"","title":"Rattan Bag - Knot","description":"Handmade in Bali, THE ORIGINAL. Beautiful and elegant rattan bag takes you back in time with its rare vintage feel. With fine cling shoulder (leather) strap that has a knot style closure so you can hold things safely in style.
\u00a0
Specification
Material: Ata grass & Leather
Style: Casual
Size: 18x18x8 cm","availability":"in stock","inventory":12,"brand":"LAVESTIR","google_product_category":"","product_type":"Bags > Rattan Bags > Accessories","condition":"new","price":"3,651.00 PKR","sale_price":"","color":"","size":"","link":"https:\/\/www.website.com\/rattan-bag-knot","image_link":"https:\/\/www.website.com\/media\/catalog\/product\/i\/m\/img-4067_1.jpg","additional_image_link":"https:\/\/www.website.com\/media\/catalog\/product\/i\/m\/img-4066.jpg,https:\/\/www.website.com\/media\/catalog\/product\/i\/m\/img-4068_1.jpg,https:\/\/www.website.com\/media\/catalog\/product\/i\/m\/img-4069_1.jpg"} [] []
[2021-04-14 05:07:12] FBE.INFO: {"id":"54","item_group_id":"","title":"Rattan Bag - Knot","description":"Handmade in Bali, THE ORIGINAL. Beautiful and elegant rattan bag takes you back in time with its rare vintage feel. With fine cling shoulder (leather) strap that has a knot style closure so you can hold things safely in style.
\u00a0
Specification
Material: Ata grass & Leather
Style: Casual
Size: 18x18x8 cm","availability":"in stock","inventory":12,"brand":"LAVESTIR","google_product_category":"","product_type":"Bags > Rattan Bags > Accessories","condition":"new","price":"3,651.00 PKR","sale_price":"","color":"","size":"","link":"https:\/\/www.website.com\/rattan-bag-knot","image_link":"https:\/\/www.website.com\/media\/catalog\/product\/i\/m\/img-4067_1.jpg","additional_image_link":"https:\/\/www.website.com\/media\/catalog\/product\/i\/m\/img-4066.jpg,https:\/\/www.website.com\/media\/catalog\/product\/i\/m\/img-4068_1.jpg,https:\/\/www.website.com\/media\/catalog\/product\/i\/m\/img-4069_1.jpg"} [] []
[2021-04-14 05:07:12] FBE.INFO: Months since last update : 0 [] []
[2021-04-14 05:07:12] FBE.INFO: Catalog Batch API - https://graph.facebook.com/v10.0/455926898953866/items_batch [] []

Log with FB attribute (Gender):

[2021-04-14 05:08:30] FBE.INFO: images path [] []
[2021-04-14 05:08:30] FBE.INFO: {"main_image":"https:\/\/www.website.com\/media\/catalog\/product\/i\/m\/img-4063.jpg","additional_images":["https:\/\/www.website.com\/media\/catalog\/product\/i\/m\/img-4064.jpg","https:\/\/www.website.com\/media\/catalog\/product\/i\/m\/img-4065.jpg"]} [] []
[2021-04-14 05:08:30] FBE.INFO: {"id":"55","item_group_id":"","title":"Rattan Bag - Sunflower","description":"Born in Bali; Beloved worldwide.
Whether you\\'re a celeb walking a red carpet or an easygoing gal hitting the beach, this bag is made to inspire. Sunflower printed elegant round bag with leather strap.
\u00a0
Round shaped handmade bag with white base and floral deco art inspired painting at front, comes with cling leather shoulder strap (50\\\") and button closure, finished with a plain brown inner lining.
\u00a0
Specification
Material: Rattan & Leather
Style: Casual
Size: 18*8 cm","availability":"in stock","inventory":20,"brand":"LAVESTIR","google_product_category":"","product_type":"Bags > Rattan Bags > Accessories","condition":"new","price":"3,950.00 PKR","sale_price":"","color":"","size":"","link":"https:\/\/www.website.com\/rattan-bag-sunflower","image_link":"https:\/\/www.website.com\/media\/catalog\/product\/i\/m\/img-4063.jpg","additional_image_link":"https:\/\/www.website.com\/media\/catalog\/product\/i\/m\/img-4064.jpg,https:\/\/www.website.com\/media\/catalog\/product\/i\/m\/img-4065.jpg"} [] []
[2021-04-14 05:08:30] FBE.INFO: {"id":"55","item_group_id":"","title":"Rattan Bag - Sunflower","description":"Born in Bali; Beloved worldwide.
Whether you\\'re a celeb walking a red carpet or an easygoing gal hitting the beach, this bag is made to inspire. Sunflower printed elegant round bag with leather strap.
\u00a0
Round shaped handmade bag with white base and floral deco art inspired painting at front, comes with cling leather shoulder strap (50\\\") and button closure, finished with a plain brown inner lining.
\u00a0
Specification
Material: Rattan & Leather
Style: Casual
Size: 18*8 cm","availability":"in stock","inventory":20,"brand":"LAVESTIR","google_product_category":"","product_type":"Bags > Rattan Bags > Accessories","condition":"new","price":"3,950.00 PKR","sale_price":"","color":"","size":"","link":"https:\/\/www.website.com\/rattan-bag-sunflower","image_link":"https:\/\/www.website.com\/media\/catalog\/product\/i\/m\/img-4063.jpg","additional_image_link":"https:\/\/www.website.com\/media\/catalog\/product\/i\/m\/img-4064.jpg,https:\/\/www.website.com\/media\/catalog\/product\/i\/m\/img-4065.jpg","gender":"Female"} [] []
[2021-04-14 05:08:30] FBE.INFO: Months since last update : 0 [] []
[2021-04-14 05:08:30] FBE.INFO: Catalog Batch API - https://graph.facebook.com/v10.0/455926898953866/items_batch [] []
xxu3-sc commented 3 years ago

Would the Push Product button being able sync additional images as well? That might be easier. It looks like the previous code changes worked. I will make a PR tmr.

nix0x00 commented 3 years ago

Would the Push Product button being able sync additional images as well? That might be easier. It looks like the previous code changes worked. I will make a PR tmr.

Push Product should be working, though when I make any change e.g. price it automatically gets updated in the catalog. However, for the previous products (before Business Extension) I have to manually open the product and save, then only catalog contains additional images.

Also, the only change in code I think I did was replacing ATTR_ADDITIONAL_IMAGE_URL value, but I tried to revert it back to its original i.e. implode(',', $images['additional_images']), and the result is same as with the $images['additional_images'],.

Luckily I only have 29 products to update/save. Might be a problem for someone with 1000+ products.

xxu3-sc commented 3 years ago

Would the Push Product button being able sync additional images as well? That might be easier. It looks like the previous code changes worked. I will make a PR tmr.

Push Product should be working, though when I make any change e.g. price it automatically gets updated in the catalog. However, for the previous products (before Business Extension) I have to manually open the product and save, then only catalog contains additional images.

Do you mean products you created before installing business extension? It shouldn't matter when you created the product.

Also, the only change in code I think I did was replacing ATTR_ADDITIONAL_IMAGE_URL value, but I tried to revert it back to its original i.e. implode(',', $images['additional_images']), and the result is same as with the $images['additional_images'],.

So the problem gets fixed automatically by itself? Strange..

Luckily I only have 29 products to update/save. Might be a problem for someone with 1000+ products.

nix0x00 commented 3 years ago

Do you mean products you created before installing business extension? It shouldn't matter when you created the product.

Yes, However If the code to push products for the first time is same as when we update/save product, then I don't know why additional images were not uploaded. However, if different file/class is being used, then perhaps the issue might be with the initial push code. Though, not sure.

So the problem gets fixed automatically by itself? Strange..

Not really... not itself, I have to manually save each product. Then only additional images get saved in the Facebook Catalog.

xxu3-sc commented 3 years ago

It is the same logic though...Now it is confusing.

jveins commented 3 years ago

Hi, has this issue been fixed? I am about to install version 1.4.0. I don't know coding and I won't be able to troubleshoot any errors that may arise.

nix0x00 commented 3 years ago

Hi, has this issue been fixed? I am about to install version 1.4.0. I don't know coding and I won't be able to troubleshoot any errors that may arise.

If you are not using multi inventory then you can install version 1.4.0. If you see any issue at FB catalog, just open the product and save it again.