siramthar
Posts: 5
|
Posted: 05/17/2013, 3:51 PM |
|
Hi!
I'm trying to figure out the best way to add the item the client is viewing to his "favorites".
The status is as follows:
- The client is already logged in (his client id is on a cookie) and he is looking at an item (it's a not editable record).
- I want to save an entry with the client_id and the item_id in a favorites table I already have ready. (different table than the item table )
- I want the client to just click something (a Link, probably) where it goes and saves a new line in the favorites table with the user_id and the item_id (this would be an sql query like "insert ... on duplicate key update.. " that I know how to do)
What would be the best way to do this? I'm working on PHP. Is there an event that would do that?
Thanks in advance!
|
|
|
Oper
Posts: 1195
|
Posted: 05/17/2013, 4:05 PM |
|
every time you view and item
add to a table like this:
TableViewItems
--------ClienteID
--------ItemID
--------Type (1=View, 2=Favorite 3= WishList)
(Check if the Item already add to the client before Insert)
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)
http://www.PremiumWebTemplate.com
Affiliation Web Site Templates
Please do backup first |
|
|
siramthar
Posts: 5
|
Posted: 05/17/2013, 4:17 PM |
|
Oh, perfect, that gave me the extra idea of adding the current date too.
So, basically, I would always add/update a row to the Favorites table
-ClientId
-ItemId
-Type (1=View, 2=Favorite 3= WishList)
-CurrentDate
and then if the user wants a favorite then just update the type from 1 to 2! Got it.
Now, to business:
- should I create a record that updates the Favorites table and then link it with some event to the Item view?
or
-Should I just add the code to insert/update a row on the ClientViewItems table in the Before Show Event on the Item, and another code snippet to update the type from 1 to 2 on the Table? I know links only have the Before Show event... so . . . any ideas? (Maybe link to the current Item with a new parameter so that it updates the current ClientViewTable row with the new type? Hmm.. I think I'm going somewhere this way :) )
Thanks!
Thanks!
|
|
|
|