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

Simple Products from configurable not matching the catalog #41

Closed markmaurerrr closed 6 years ago

markmaurerrr commented 6 years ago

The view content Pixel is working fine – the viewed content is matching my catalog products.

bildschirmfoto 2018-03-17 um 19 08 03

But when it comes to "add to cart" or "purchase", the event is not matching to the products. I guess because they're simple products within the configurable.

bildschirmfoto 2018-03-17 um 19 08 12

How do i deal with this one?

Thanks a lot in advance!

dmitridr commented 6 years ago

Hey,

Looks like you caught a bug, good find! I think we can solve this from our end by releasing a new version.

Your guess is correct, we fire the pixel with the id of the simple product under the configurable, but we should be firing it with the id of the configurable.

I don't think it will be too hard to solve, I'll aim to have a new version by end of this week with this fix. I will reach out to you if I need more info.

If you'd like to help speed up the process, a screenshot of the settings for one of your simple products that has this problem would help me get the fix out faster!

Thanks.

markmaurerrr commented 6 years ago

Hey, thanks a lot for the fast response! Could you tell me which settings you'd like to have a screenshot from? Magento or Facebook Business?

dmitridr commented 6 years ago

Magento, we basically want to set up the exact same product you have to verify the fix works.

markmaurerrr commented 6 years ago

Simple:

bildschirmfoto 2018-03-21 um 11 03 49

Configurable:

bildschirmfoto 2018-03-21 um 14 12 00 bildschirmfoto 2018-03-21 um 14 12 13

If this is not what you're seeking for, just tell me and i'll do new ones.

Thanks a lot!

dmitridr commented 6 years ago

Hello again,

I set up the products as in your screenshot, but I can't reproduce the problem. AddToCart and Purchase is firing with the configurable product id for me even if I add the simple product to the cart.

Could you provide a link to your site to the specific product so I could try out the add-to-cart behavior to see how it differs from our test server? Then I could set up the same on ours and reproduce the problem.

I'm not sure why it would be working for me but doesn't work for you though, strange. I do have a good idea about how to fix it though, the problem should be here, though purchase might be harder to fix.

markmaurerrr commented 6 years ago

Hey @dmitridr,

that's strange. The link is: https://inspired.mrgoodlife.net/de/poster-santa-barbara-pier

Thanks a lot!

t40 commented 6 years ago

Same problem here! I'm really surprised this basic & crucial functionality of Magento (Configurable Products with Simple Products as each option) isn't supported in this extension and don't understand why FB is promoting it as "official", as for most Magento Shops it's useless. See as well: Issues #25 & #48.

markmaurerrr commented 6 years ago

@dmitridr any news? this is really frustrating...

JasonMawave commented 6 years ago

Same Problem here! I'm using the Pixel Plugin from Facebook itself for Magento. Please help!

bildschirmfoto 2018-07-30 um 17 11 47 bildschirmfoto 2018-07-30 um 17 11 36 bildschirmfoto 2018-07-30 um 17 11 19
dmitridr commented 6 years ago

Hi @markmaurerrr

Thanks for your patience. I verified the problem on the link you sent, but still can't reproduce the problem on our servers.

However I'm reasonably sure I know what the problem is... based on that I created a custom version of the extension for you to try with a fix. If this works, we can push the fix out to everyone. Could you try it?

https://github.com/facebookincubator/facebook-for-magento/releases/download/v2.5.1-beta/Facebook_Ads_Extension-2.5.1.tgz

If you're familiar with the Facebook Pixel Helper Chrome extension please use that to verify that AddToCart is working. This fix does not fix purchase (but if it works, we can apply it to purchase as well).

@JasonMawave @t40 Please feel free to try this as well. As we can't reproduce the problem locally we're relying on all of you to help test the fix.

dmitridr commented 6 years ago

Just FYI in case this helps others this is the fix. Replace this line with the lines below:

    $product = $observer->getProduct();
    $productId = $product->getId();
    if ($product->getVisibility() == Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE &&
        $product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE) {
          $parentIds = Mage::getModel('catalog/product_type_configurable')
            ->getParentIdsByChild($productId);
          if ($parentIds && !empty($parentIds) && is_array($parentIds) && $parentIds[0]) {
            $productId = $parentIds[0];
          }
    }
dmitridr commented 6 years ago

v2.6.0 is out with the fix. Since there have been no replies, I assume the issue is now working for everyone. Please open a new issue if you continue to have problems and reference this one.