DjangoOscarEasyrecDocumentationRelease0.0.7JonathanMossJanuary10,2014Contents1GettingStarted31.1Installation................................................31.2Configuration...............................................32GettingRecommendations53RecommendationTemplateTags73.1user_recommendations......................................73.2users_also_bought........................................73.3users_also_viewed........................................73.4products_rated_good.......................................73.5related_products.........................................83.6Parameters................................................84GettingRankings95RankingsTemplateTags115.1most_viewed.............................................115.2most_bought.............................................115.3most_rated..............................................115.4best_rated..............................................115.5worst_rated.............................................115.6Parameters................................................126AsynchronousActions137Settings158Indicesandtables17iiiDjangoOscarEasyrecDocumentation,Release0.0.7Oscarisanopen-source,domaindrivenecommerceframeworkforDjangoandeasyrecisarecommendationsystem.Sonaturallydjangooscareasyrecisareusableappdesignedtointegratethetwoasseamlesslyaspossible.Contents:Contents1DjangoOscarEasyrecDocumentation,Release0.0.72ContentsCHAPTER1GettingStarted1.1InstallationFromPyPI:pipinstalldjango-oscar-easyrecorfromGithub:pipinstallgit+git://github.com/tangentlabs/django-oscar-easyrec.git#egg=django-oscar-easyrecAdd’easyrec’toINSTALLED_APPS.Youwillalsoneedtoinstalleasyrecitself.InstructionsforinstallingEasyreccanbefoundoneasyrec’ssourceforgewikiNote:Ifyouwanttomakeuseofbacktrackingurls.Ensureyousetthesiteurlcorrectlyinthetenantsconfigurationsectionofeasyrec.I’dalsoheartilyrecommendreadingthroughsomeofthebasicconceptsofeasyrectogetabetterideaofhowtogetthebestoutofit.1.2ConfigurationEdityoursettings.pytosetthefollowingsettings:EASYREC_ENDPOINT=’’EASYREC_TENANT_ID=’...’EASYREC_API_KEY=’...’Ineasyrecallitemshavean‘itemtype’.django-oscar-easyrecpassestheproductclassnameforthisvalue.Iftheitemtypeisnotregisteredineasyrecitwillsendthedefaultvalueof‘ITEM’.Soeachofyourproductclassesneedstomanuallyaddedasanitemtypeviaeasyrec’sdashboardifyouwantthemtoberecordedseparately.Note:Ifyouadditemtypestoeasyrecyouwillneedtorestartyourdjangoprojecttoensuretheyarepickedupcorrectly.Andthat’sit!Allpurchases,productviewsandreviewswillautomaticallybepushedtoeasyrec.3DjangoOscarEasyrecDocumentation,Release0.0.74Chapter1.GettingStartedCHAPTER2GettingRecommendationsdjango-oscar-easyreccomeswithatemplatetagallowingyoutoeasilyfetchrecommendationsanddisplaytheminyourtemplates.Thereareanumbersupportedtemplatetagswhichdoprettymuchwhattheysay:{%loadrecommendations%}{%user_recommendationsrequest.userasrecommendations%}{%forrecommended_productinrecommendations%}!--Doyourthing!--{%endfor%}{%users_also_boughta_productrequest.userasrecommendations%}{%forrecommended_productinrecommendations%}!--Doyourthing!--{%endfor%}{%users_also_vieweda_productrequest.userasrecommendations%}{%forrecommended_productinrecommendations%}!--Doyourthing!--{%endfor%}{%products_rated_goodproductasrecommendations%}{%forrecommended_productinrecommendations%}!--Doyourthing!--{%endfor%}{%related_productsproductasrecommendations%}{%forrecommended_productinrecommendations%}!--Doyourthing!--{%endfor%}Eachtemplatetagprovidesalistofrecommendations.Eachrecommendationisadictionarycontainingaproductobject,andatrackingurl.e.g.:{product:Product,tracking_url:}Ifnorecommendationsarefoundthenanemptylistisreturned.Eachofthesetagsalsosupportsanumberofotheroptionalparameters.Youcanalsocalltherecommendationfunctionsdirectly:5DjangoOscarEasyrecDocumentation,Release0.0.7fromeasyrec.utilsimportget_gatewayeasyrec=get_gateway()recommendations=easyrec.get_user_recommendations(user.user_id)recommendations=easyrec.get_other_users_also_bought(product.upc,user_id)recommendations=easyrec.get_other_users_also_viewed(product.upc,user_id)6Chapter2.GettingRecommendationsCHAPTER3RecommendationTemplateTags3.1user_recommendationsReturnsalistofrecommendeditemsforauserSyntax:{%user_recommendationsuser[max_results15][requested_item_typeITEM][action_typeVIEW]%}3.2users_also_boughtReturnsalistofrecommendeditemsbasedonuserswhoboughtthisalsoboughtXSyntax:{%users_also_boughtproductuser[max_results15][requested_item_typeITEM]%}3.3users_also_viewedReturnsalistofrecommendeditemsbasedonuserswhoviewedthisalsoviewedXSyntax:{%users_also_viewedproductuser[max_results15][requested_item_typeITEM]%}3.4products_rated_goodReturnsalistofrecommendeditemsbasedonuserswhoratedthisasgoodalsoratedXasgood.Syntax:{%product_rated_goodproductuser[max_results15][requested_item_typeITEM]%}7DjangoOscarEasyrecDocumentation,Release0.0.73.5related_productsReturnsalistofitemsrelatedtothesuppliedoneSyntax:{%related_productsp