Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2004
    Posts
    142
    Plugin Contributions
    0

    Default Product View Count

    Hi all,
    In the admin side I can see the list of item views count.
    Is there a way to display that in the product_info page?
    This product has been viewed...

    Thanks
    Grant

  2. #2

    Default Re: Product View Count

    Quote Originally Posted by stampsville View Post
    Hi all,
    In the admin side I can see the list of item views count.
    Is there a way to display that in the product_info page?
    This product has been viewed...

    Thanks
    Grant
    Yes i want that too.

    I onlle managed to show the most viewed product count number, not the exact views of every separate product.

    What have i done:

    In /includes/modules/pages/product_info/main_template_vars.php right before

    PHP Code:
    $products_model $product_info->fields['products_model'];
      
    // if no common markup tags in description, add line breaks for readability:
      
    $products_description = (!preg_match('/(<br|<p|<div|<dd|<li|<span)/i'$product_info->fields['products_description']) ? nl2br($product_info->fields['products_description']) : $product_info->fields['products_description']); 
    i put that:
    PHP Code:
    $products_query_raw "select p.products_id, pd.products_name, pd.products_viewed, l.name from " TABLE_PRODUCTS " p, " TABLE_PRODUCTS_DESCRIPTION " pd, " TABLE_LANGUAGES " l where p.products_id = pd.products_id and l.languages_id = pd.language_id order by pd.products_viewed DESC";
        
    $products $db->Execute($products_query_raw); 
    and somewhere in product info page exactly were i wanted to apear in my case under product image
    PHP Code:
    <?php echo $products->fields['products_viewed']; ?>
    But that gives me only the most watched product count.

    Can someone help ?

  3. #3

    Default Re: Product View Count

    Problem solved :)

    I was so dum to copy-paste everything and forgot to revise the DB "order by pd.products_viewed DESC"

    you just need to delete that line from main_template_vars.php and everythig comes to its places.

    Many regards

  4. #4
    Join Date
    Dec 2007
    Location
    Payson, AZ
    Posts
    1,076
    Plugin Contributions
    15

    Default Re: Product View Count

    Quote Originally Posted by perfumbg View Post
    Problem solved :)

    I was so dum to copy-paste everything and forgot to revise the DB "order by pd.products_viewed DESC"

    you just need to delete that line from main_template_vars.php and everythig comes to its places.

    Many regards
    This is what I use to display number of viewed at the base of my auction products... for you, in tpl_products_info_display.php if it's not in your template folder, move it over then make the edit where you wish it to be displayed... add
    Code:
    <?php echo ( zen_products_lookup((int)$_GET['products_id'], 'products_viewed') > 0 ? '<div class="reviewCount">' . 'Product Viewed: ' . zen_products_lookup((int)$_GET['products_id'], 'products_viewed') . '</div>' : '') . "\n"; ?>
    This a quick if statement, if the product been viewd before, display 'Product Viewed: #' if not, don't display anything... or you could say something else... I didn't use a languge file here so you could do that by changing 'Product Viewed: ' and defining it in your languge file.
    Dave
    Always forward thinking... Lost my mind!

 

 

Similar Threads

  1. v139h 1136 Column count doesn't match value count at row 1
    By riolas in forum General Questions
    Replies: 3
    Last Post: 5 Jul 2013, 07:48 AM
  2. v138a Different Images for listing view and product view
    By MikeBryan90 in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 3 Feb 2012, 10:24 PM
  3. product view count
    By zmtak in forum General Questions
    Replies: 1
    Last Post: 23 Dec 2011, 06:24 PM
  4. Replies: 6
    Last Post: 25 Mar 2009, 08:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg