Recently viewed items php Version WeBid 1.2.* ONLY

Recently viewed items php Version

  1. pani100

    pani100 Well-Known Member

    Joined:
    May 9, 2011
    Messages:
    2,327
    Likes Received:
    449
    pani100 submitted a new resource:

    Recently viewed items php Version - Recently viewed items php Version

    Read more about this resource...
     
    Last edited by a moderator: May 20, 2015
  2. liran

    liran New Member

    Joined:
    May 17, 2012
    Messages:
    136
    Likes Received:
    2
    i've tried it and it works perfect!, good job pani=)
     
  3. pani100

    pani100 Well-Known Member

    Joined:
    May 9, 2011
    Messages:
    2,327
    Likes Received:
    449
    Yes, works well. I also think it is safer as the items(or should I say the complete scripts) are not taken directly form the cookies as per the other script as anyone could tamper with them.
     
  4. Guest

    Guest Guest

    havent tried the other version
    tried this one 2 times now but i dont get any output ?
     
  5. liran

    liran New Member

    Joined:
    May 17, 2012
    Messages:
    136
    Likes Received:
    2
    are you trying to view on item page or on home page?
     
  6. Guest

    Guest Guest

    itempage
    i have added code to item.php and item.tpl
     
  7. liran

    liran New Member

    Joined:
    May 17, 2012
    Messages:
    136
    Likes Received:
    2
    ok try find in item.tpl :
    {AUCTION_VIEWS}

    and (just for testing) paste after the :
    <!-- BEGIN recenlty_viewed -->
    {recenlty_viewed.TITLE}
    <img src="{recenlty_viewed.IMAGE}">
    {recenlty_viewed.ID}
    <br>
    <!-- END recenlty_viewed -->

    tell me if you see something
     
  8. Guest

    Guest Guest

    no nothing
     
  9. liran

    liran New Member

    Joined:
    May 17, 2012
    Messages:
    136
    Likes Received:
    2
    hmm wierd.. the only thing i can think of is that you haven't looked at another item after implanting the code. and thats why you aint seeing any picture(cause no auction saved in the cookie). so try look at 2 or 3 auctions and then see if its showing the recently viewed.
    if it ain't showing then i have no idea=\
     
  10. Guest

    Guest Guest

    yes strange i have 5 auctions and tried when i was logged in and seller not logged in and logged in as user, and tried it on default theme and my own theme.
    nothing works.
    tried in ie and firefox
     
    Last edited by a moderator: Oct 16, 2012
  11. Guest

    Guest Guest

    my error log says
    16-10-2012, 20:29:18:: Unknown error type: [2] in_array() expects parameter 2 to be array, boolean given on /home/server/public_html/auktion/item.php line 72
    16-10-2012, 20:29:18:: Unknown error type: [2] Invalid argument supplied for foreach() on /home/server/public_html/auktion/item.php line 95



    line 72
    if (in_array($ad_id,$cookie)) {$skip=true;}
    line 95
    foreach ($cookie as $name => $value)
     
  12. pani100

    pani100 Well-Known Member

    Joined:
    May 9, 2011
    Messages:
    2,327
    Likes Received:
    449
    Hello ,
    make sure you have put the mod after the auction data have been returned by query
    (// get auction all needed data). - which you probably have.
    The error is telling me the $cookie array is not being set correctly.
    It has seen the $_COOKIE['['recentviews'];'] (which is an array ) but it is not copying the array to our $cookie var.
    Try deleting the 'recentviews' cookie from the browser.
    If it continues can you post what is actually in the $_COOKIE['['recentviews']?
    Another thing you could try is replacing all instances of $cookie to something else as there might be a conflict with something else named the same.

    Do you have another line in error log above the first error like
    HTML:
    16-10-2012, 20:12:03:: Unknown error type: [8] Undefined variable: _COOKIE on /.....l/goods-4-sale.com/item.php line 212
    16-10-2012, 20:12:03:: Unknown error type: [2] in_array() expects parameter 2 to be array, boolean given on /....../goods-4-sale.com/item.php line 221
     
    Last edited: Oct 16, 2012
  13. Guest

    Guest Guest

    tried moving code to after last query and rename $cookie to $cookierw and tried move displaycode in item.tpl

    The cookie has this data in firebug
    recentviews=a%3A1%3A%7Bi%3A0%3Bs%3A2%3A%2224%22%3B%7D; expires=Fri, 19 Oct 2012 06:02:43 GMT; path=/auktion/; domain=localhost

    i use other cookie system for changing css colors (some code grabbed and modified from wbcolors theme, and there must be some conflict, as it stopped working too. i try find out what causes it.
     
  14. Guest

    Guest Guest

    tried moving code to after last query and rename $cookie to $cookierw and tried move displaycode in item.tpl

    The cookie has this data in firebug
    recentviews=a%3A1%3A%7Bi%3A0%3Bs%3A2%3A%2224%22%3B%7D; expires=Fri, 19 Oct 2012 06:02:43 GMT; path=/auktion/; domain=localhost

    i use other cookie system for changing css colors (some code grabbed and modified from wbcolors theme, and there must be some conflict, as it stopped working too. i try find out what causes it.
     
  15. pani100

    pani100 Well-Known Member

    Joined:
    May 9, 2011
    Messages:
    2,327
    Likes Received:
    449
    That means the code has actually run once, seen there is no cooke 'recentviews', created it with first viewed item inserted (auction id 24). After that it can not get the value of the cookie. Strange
     
  16. jjjason84

    jjjason84 Donor Donor

    Joined:
    Jun 26, 2012
    Messages:
    702
    Likes Received:
    62
    Nice work pani i installed it with out any problems and it works great.

    I did see there was no hyperlink so people could not click on the auctions that is listed in the Recently viewed items so i added the hyperlink code to it so people can click on the auction and it will take them to the auction they clicked on.

    <!-- BEGIN recenlty_viewed -->
    <a href="{SITEURL}item.php?id={recenlty_viewed.ID}">
    {recenlty_viewed.TITLE}<br>
    <img src="{recenlty_viewed.IMAGE}"><br>
    {recenlty_viewed.ID}<br>
    </a>
    <!-- END recenlty_viewed -->
     
    Last edited: Oct 18, 2012
  17. youngwolfe

    youngwolfe Donor Donor

    Joined:
    Oct 6, 2012
    Messages:
    105
    Likes Received:
    1
    Same issues as Dahl

    Hi Dahl and Pani and jjjason84

    I have been having the same issues with this mod as Dahl. When I echo the contents of the cookie that is being created, stripedslashes are being added. (Caused by my php.ini configuration) After unserialize is applied to the $cookie variable. The $cookie echos nothing.

    Instead of
    PHP:
    // define the new value to add to the cookie
    $ad_id $auction_data['id'];
    $stored=0//leave alone! :)
    $skip=false;
    if(
    array_key_exists('recentviews'$_COOKIE)) {
        
    $cookie $_COOKIE['recentviews'];
        
    $cookie unserialize($cookie);
    Use

    PHP:
    // define the new value to add to the cookie
    $ad_id $auction_data['id'];
    $stored=0//leave alone! :)
    $skip=false;
    if(
    array_key_exists('recentviews'$_COOKIE)) {
        
    $cookie =$_COOKIE['recentviews'];
        
    $cookie is_array($cookie) ?
                    
    array_map('recentviews'$cookie) :
                    
    stripslashes($cookie);
       
    $cookie unserialize($cookie);
    and

    Instead of

    PHP:
    // recent item cookie mod --get cookie to show-- start
    if(array_key_exists('recentviews'$_COOKIE)) {
        
    $cookie $_COOKIE['recentviews'];
        
    $cookie unserialize($cookie);
    Now use

    PHP:
    // recent item cookie mod --get cookie to show-- start
    if(array_key_exists('recentviews'$_COOKIE)) {
        
    $cookie =$_COOKIE['recentviews'];
        
    $cookie is_array($cookie) ?
                    
    array_map('recentviews'$cookie) :
                    
    stripslashes($cookie);
       
    $cookie unserialize($cookie);
    Hope this helps
    youngwolfe
     
    Last edited: Dec 27, 2012
  18. PiataRO

    PiataRO New Member

    Joined:
    Feb 5, 2012
    Messages:
    49
    Likes Received:
    5
    small fix if you are using SEF/SEO URL

    Hello if you are using SEF/SEO url for products and wanna display on font page the recently viewed items will not work because cookies will be stored at /products/xxxxxxxx and index its on /. So to get it working you need to replace both :

    Code:
    setcookie('recentviews', $cookie, $expire);
    
    with
    PHP:
    setcookie('recentviews'$cookie$expire"/");
    This small modification its to store cookie on root of website and then recently items will be display on index of you website.
     
  19. micha_shop

    micha_shop New Member

    Joined:
    Oct 3, 2011
    Messages:
    33
    Likes Received:
    2
    try to add codes after // sort out counter in item.php, here working with 1.0.6
     
  20. skyhigh

    skyhigh Member

    Joined:
    Sep 28, 2010
    Messages:
    449
    Likes Received:
    8
    i just found this stuff, work well on local server but online doesnt even show up.
     

Share This Page