Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2011
    Posts
    67
    Plugin Contributions
    0

    Default Is there a plugin to show how many times a product has been viewed?

    Hello!

    I was wondering if there is a such a plugin for product viewed on the products page? Where it shows how many times that product has been viewed.


    I have looked through the plugins...tried different words and nothing came up..just curious if I missed it.

    Thanks!

  2. #2
    Join Date
    Oct 2008
    Location
    Croatia
    Posts
    1,740
    Plugin Contributions
    22

    Default Re: Is there a plugin to show how many times a product has been viewed?

    I don't think there's a plugin available just for that, but you can easily accomplish it with a few minor edits.

    First, edit you includes/modules/pages/product_info/main_template_vars.php and replace this
    Code:
        $sql = "select p.products_id, pd.products_name,
                      pd.products_description, p.products_model,
                      p.products_quantity, p.products_image,
                      pd.products_url, p.products_price,
                      p.products_tax_class_id, p.products_date_added,
                      p.products_date_available, p.manufacturers_id, p.products_quantity,
                      p.products_weight, p.products_priced_by_attribute, p.product_is_free,
                      p.products_qty_box_status,
                      p.products_quantity_order_max,
                      p.products_discount_type, p.products_discount_type_from, p.products_sort_order, p.products_price_sorter
               from   " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
               where  p.products_status = '1'
               and    p.products_id = '" . (int)$_GET['products_id'] . "'
               and    pd.products_id = p.products_id
               and    pd.language_id = '" . (int)$_SESSION['languages_id'] . "'";
    with
    Code:
    $sql = "select p.products_id, pd.products_name,
                      pd.products_description, p.products_model,
                      p.products_quantity, p.products_image,
                      pd.products_url, p.products_price,
                      p.products_tax_class_id, p.products_date_added,
                      p.products_date_available, p.manufacturers_id, p.products_quantity,
                      p.products_weight, p.products_priced_by_attribute, p.product_is_free,
                      p.products_qty_box_status,
                      p.products_quantity_order_max,
                      p.products_discount_type, p.products_discount_type_from, p.products_sort_order, p.products_price_sorter, pd.products_viewed
               from   " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
               where  p.products_status = '1'
               and    p.products_id = '" . (int)$_GET['products_id'] . "'
               and    pd.products_id = p.products_id
               and    pd.language_id = '" . (int)$_SESSION['languages_id'] . "'";
    Then, add
    Code:
    $products_viewed = $product_info->fields['products_viewed'];
    somewhere between lines 99 and 133, for example right after
    Code:
    $products_url = $product_info->fields['products_url'];
    Next, edit your includes/templates/YOUR_TEMPLATE/templates/tpl_product_info_display.php and add the following line where you want to display the counter:
    Code:
    <?php echo 'This product was viewed ' . $products_viewed . ' times'; ?>
    The language is obviously hard-coded in this case, but you can easily change it into a definition if you want...

  3. #3
    Join Date
    Oct 2011
    Posts
    67
    Plugin Contributions
    0

    Default Re: Is there a plugin to show how many times a product has been viewed?

    thanks! i am going to give it a try..

 

 

Similar Threads

  1. Display how many times a product has been purchased?
    By StraightArrow in forum Setting Up Categories, Products, Attributes
    Replies: 29
    Last Post: 26 Sep 2015, 01:53 PM
  2. v139h Is there a way to track how many times a customer puts items into a cart
    By Allaction in forum Managing Customers and Orders
    Replies: 1
    Last Post: 30 Jun 2012, 07:09 PM
  3. Replies: 0
    Last Post: 10 Aug 2011, 04:06 AM
  4. how many times a product has been seen
    By mipavluk in forum General Questions
    Replies: 3
    Last Post: 19 Sep 2007, 05:10 AM

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