Forums / General Questions / Visible Counter of Product Sold

Visible Counter of Product Sold

Locked

Started by jmp01 on 19 Aug 2010, 12:27 AM · Views: 1,396

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
19 Aug 2010, 12:27 AM
#1
jmp01 avatar

jmp01

New Zenner

Join Date:
Feb 2009
Location:
Citrus Heights CA
Posts:
12
Plugin Contributions:
0

Visible Counter of Product Sold

Newbie...
I'd like to set up a counter for each item sold, so that I can display it anywhere on the site. I have tried:

<?php $products = $db->Execute("select count(*) as count from " . TABLE_PRODUCTS . " where products_ordered > '0'"); define('PRODUCTS','The total number sold so far is '); echo '<div class="row"><span class="left">' . PRODUCTS . ' </span><span class="right">' . $products->fields['count'] . '</span></div>'; ?>

But this counter gets stuck at "1"

Any ideas?

19 Aug 2010, 2:12 AM
#2
amandagero avatar

amandagero

Zen Follower

Join Date:
Feb 2009
Posts:
188
Plugin Contributions:
0

Re: Visible Counter of Product Sold

you could use

$chk_products_ordered = zen_products_lookup((int)$_GET('products_id'], 'products_ordered');

Then echo the $chk_products_ordered where you want to display it ...

19 Aug 2010, 11:14 PM
#3
jmp01 avatar

jmp01

New Zenner

Join Date:
Feb 2009
Location:
Citrus Heights CA
Posts:
12
Plugin Contributions:
0

Re: Visible Counter of Product Sold

:oops: OK... so here is the script that I inserted into my main page:

<?php $chk_products_ordered =zen_products_lookup((int)$_GET('products_id'], 'products_ordered'); echo '<div class="row"><span class="left">' . $chk_products_ordered . ' </span><span class="right">' . $products->fields['count'] . '</span></div>'; ?>

The Page is coming up blank...
Que` Pasa?

20 Aug 2010, 3:14 PM
#5
ajeh avatar

ajeh

Oba-san

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

Re: Visible Counter of Product Sold

Try this instead:

<?php define('TEXT_QTY_SOLD', 'Number Sold: '); $chk_products_ordered = zen_products_lookup((int)$_GET['products_id'], 'products_ordered'); echo '<div class="row"><span class="left">' . TEXT_QTY_SOLD . $chk_products_ordered . '</span></div>'; ?>

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!