Recommendation Engine - flagbit/Magento-FACTFinder GitHub Wiki
All the Recommendation functionality is implemented in FACTFinder_Recommendation module.
Magento has two types of linked products: up-sell (product page) and cross-sell (cart page). The module fills the collections of these blocks with results received from FF.
Method loadRecommendedItemsItems() in Observer.php is called on catalog_product_collection_load_before event and checks whether the collection to load is either up- or cross-sell.
Then it makes a request to the FF server and loads the collection with the id filter according to these results in method _processCollection().
This approach allows to avoid any rewrites in the code.
The recommendation module uses the same logic for both types of collections and the only difference is that in case of up-sells only one product ID is sent to FF (the ID of the current product), while for getting cross-sell results multiple IDs are used (from all the items in the cart), as it can be seen in _getProductIds() method.
For displaying up-sell product the following block should be defined in the theme XML for product page:
<block type="catalog/product_list_upsell" name="product.info.upsell" as="upsell_products" template="catalog/product/list/upsell.phtml" />
For displaying cross-sell product the following block should be defined in the theme XML for cart page:
<block type="checkout/cart_crosssell" name="checkout.cart.crosssell" as="crosssell" template="checkout/cart/crosssell.phtml"/>
The same can be done for any other page on the website, sometimes the block should be called from the template, but this a topic not specific to the module.