Magento2: send to algolia category Image Url and receive it from algolia

Just set up new field for magento category(image url). Need to send it to algolia and then get Category Image Url in response.

Hi @projdevel,

To send the new category image attribute to Algolia, you will have to use custom event:

  • first add the new attribute to the $collection parameter, in the algolia_after_categories_collection_build event (docs here) ,
  • and then pass in the category_image attribute to the object in this algolia_category_index_before event (docs here), so that it is properly indexed in Algolia

You can learn more about back-end events here: https://www.algolia.com/doc/integration/magento-2/customize/custom-back-end-events/?language=php#dispatching-after-categories-collection-creation

Hi @marie.gillier, thats good I created two observers and after reindex I can see new result in algolia:


it has been pushed to category index: magento2_dev_test_store_view_categories

But when I load category, I see another index “magento2_dev_test_store_view_products_created_date_desc”
And cannot find there category_image_url…

Maybe I am mistaken or we can use other solutions?