closed Listing liked items via _user_id - jrLike

joshwolve
joshwolve
@covertlogic
9 years ago
21 posts
Ive been stuck on this for 5 hours so far, gonna ask for help at this point.

From other topics Ive been able to piece together code that should work, but it's missing something.

Ive confirmed this will list out songs Liked by admin (user id 1) if i specify the user ID

{jrCore_list module="jrLike" search1="like_module = jrAudio" search2="like_action = like" template="wishlist_row.tpl" search3="_user_id = 1" }

When i attempt to make it dynamic for currently logged in user though, it doesnt work. Here is the code so far, with search3 being the problem:

{jrCore_list module="jrLike" search1="like_module = jrAudio" search2="like_action = like" template="wishlist_row.tpl" search3="_user_id = '$_user._user_id'" }

I'm wondering if im supposed to assign something in order to search for it? Ive also confirmed that correct user_id is there, just by printing to screen {$_user._user_id}



The next issue is that when it does list out the songs that are liked, its disconnected from the add to cart button. I realize this is another issue entirely though and will deal with it later. Heres the cart code in wishlist_row.tpl just for reference. Thanks so much.

{jrCore_module_function function="jrFoxyCart_add_to_cart" module="jrAudio" field="audio_file" item=$item}

updated by @covertlogic: 05/18/15 02:22:20PM
joshwolve
joshwolve
@covertlogic
9 years ago
21 posts
Here is a peak at datastore for a liked audio item in jrLike:

like_action: like
like_item_id: 12
like_item_url: ahhcult-original
like_module: jrAudio
like_profile_id: 7
like_profile_url: extrakt
like_title: Ahhcult (Original)
like_user_ip: ...........
douglas
@douglas
9 years ago
2,793 posts
You might try using the profile_id instead...

{jrCore_list module="jrLike" search1="like_module = jrAudio" search2="like_action = like" template="wishlist_row.tpl" profile_id=$_user._profile_id}

I've not tested it so not sure if that will work.


--

Douglas Hackney
Jamroom Team - Designer/Developer/Support
FAQ-Docs-Help Videos
paul
@paul
9 years ago
4,332 posts
1) Use 'back ticks' around the _user_id variable -

{jrCore_list module="jrLike" search1="like_module = jrAudio" search2="like_action = like" template="wishlist_row.tpl" search3="_user_id = `$_user._user_id`" }

2) The problem with -

{jrCore_module_function function="jrFoxyCart_add_to_cart" module="jrAudio" field="audio_file" item=$item}

is that when listing the results of the Like search, the array variable $item (for each liked audio) isn't available. I'm not near my development PC atm but this might work -

{jrCore_module_function function="jrFoxyCart_add_to_cart" module="jrAudio" field="audio_file" item_id=$item.like_item_id}

If not, let us know and we'll come up with something else.


--
Paul Asher - JR Developer and System Import Specialist
joshwolve
joshwolve
@covertlogic
9 years ago
21 posts
Thats the odd part :) I do have backticks around it. EDIT WOOHOO. Thanks everyone. @Douglas I had tried profile id but was trying to do it via search, instead of just defining it like you did.

You guys saved me another 5 hours of digging im sure, thanks as always. *beers all around
joshwolve
joshwolve
@covertlogic
9 years ago
21 posts
@paul Thanks for foxy snippet. i had a hunch it was something to that extent, still getting acquainted with jr/smarty again. Even if it doesnt work ill keep tinkering for a day or two with

{jrCore_module_function function="jrFoxyCart_add_to_cart" module="jrAudio" field="audio_file" item_id=$item.like_item_id}

before asking again. That is how i learn after all.

Tags