Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / Displaying Product Viewed in the product_info_diplay

Displaying Product Viewed in the product_info_diplay

Views: 1,105

Results 1 to 11 of 11
10 Jun 2011, 8:46 PM
#1
safarce avatar

safarce

New Zenner

Join Date:
Jun 2011
Posts:
11
Plugin Contributions:
0

Displaying Product Viewed in the product_info_diplay

Hi guys,

I was wondering if there is any way I can display how many time my products has been viewed on each individual product page!

Thank youuuu

10 Jun 2011, 11:55 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Displaying Product Viewed in the product_info_diplay

You might peek at the Reports in your Zen Cart Admin ...

11 Jun 2011, 12:23 AM
#3
safarce avatar

safarce

New Zenner

Join Date:
Jun 2011
Posts:
11
Plugin Contributions:
0

Re: Displaying Product Viewed in the product_info_diplay

Hi,

Thank you for the fast respond, I do understand it is located in the reports but I would like to show that same number for each product in the product description page.

Basically the same option utilized by youtube where it shows how many times a video has been viewed.

11 Jun 2011, 1:10 AM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Displaying Product Viewed in the product_info_diplay

The Report on the Viewed Products counts the view from the product_info page ...

11 Jun 2011, 1:39 AM
#5
safarce avatar

safarce

New Zenner

Join Date:
Jun 2011
Posts:
11
Plugin Contributions:
0

Re: Displaying Product Viewed in the product_info_diplay

How can I view that count on the page as well? Thank you

11 Jun 2011, 2:19 AM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Displaying Product Viewed in the product_info_diplay

One method you can use is:

  <?php
  // bof: get product views
    $products_viewed_raw = "select p.products_id, pd.products_viewed from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$_GET['products_id'] . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'";
    $products_views = $db->Execute($products_viewed_raw);
    echo ($products_views->fields['products_viewed'] > 0 ? '<li>' . 'Views: ' . $products_views->fields['products_viewed'] . '</li>' . "\n" : '');
  // eof: get product views
  ?>

Another method is with a function:

  <?php echo ( zen_products_lookup((int)$_GET['products_id'], 'products_viewed') > 0 ? '<li>' . 'Views: ' . zen_products_lookup((int)$_GET['products_id'], 'products_viewed') . '</li>' : '') . "\n"; ?>
11 Jun 2011, 8:36 AM
#7
safarce avatar

safarce

New Zenner

Join Date:
Jun 2011
Posts:
11
Plugin Contributions:
0

Re: Displaying Product Viewed in the product_info_diplay

That is just perfect. Thank you so much :smile:

11 Jun 2011, 1:25 PM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Displaying Product Viewed in the product_info_diplay

You are most welcome ... thanks for the update that this is now working for you ... :smile:

15 Jun 2011, 1:35 PM
#9
fonzie avatar

fonzie

New Zenner

Join Date:
Feb 2008
Location:
Antwerpen
Posts:
51
Plugin Contributions:
0

Re: Displaying Product Viewed in the product_info_diplay

hi,

is it possible to put this in the admin section, in the table of the products, between the status and the sort-order for example, this could give us some useful information about the products in the shop.

regards,

15 Jun 2011, 2:46 PM
#10
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Displaying Product Viewed in the product_info_diplay

You could customize the:
/admin/includes/modules/category_product_listing.php

                <td class="dataTableContent" align="right"><?php echo $products->fields['products_quantity']; ?></td>

and change to:

                <td class="dataTableContent" align="right"><?php echo $products->fields['products_quantity'] . '<br>' . zen_products_lookup((int)$products->fields['products_id'], 'products_viewed'); ?></td>

This would then show below the Quantity ...

15 Jun 2011, 3:24 PM
#11
fonzie avatar

fonzie

New Zenner

Join Date:
Feb 2008
Location:
Antwerpen
Posts:
51
Plugin Contributions:
0

Re: Displaying Product Viewed in the product_info_diplay

Thanks,

that works perfect,

I've put it on the same line as the stock, with a few spaces, that makes it a bit easier to see,

regards,