Affilistore Quick hack - Display number of products

It adds nothing to the functionality, but with the switch to the Affilistore v2.01 engine it has become a much simpler proposition to add a count to your site of the size of your product catalogue.

This comes about because it is easier to count products in a single product database rather than to add the product counts from many (and a variable number of them).

The following steps will show you how to do it.

I know that many people like to see these added elements, so if you are one of those people, it is but a 2 minute job to make this happen.

Simply add the following to your index.php file :
//get product count
$getcount = mysql_query("SELECT count(*) count FROM affiliSt_products1");
$productcount = mysql_fetch_assoc($getcount);
$body->assign("PRODCOUNT",'Now serving ‘.number_format($productcount['count']).’ products.’);

Where you add it isn’t particularly important, but now you can the {PRODCOUNT} tag wherever you see fit in your .tpl skin fies.

If you want to see this in action, then visit my DIY Tools & Accessories store. Incidentally, that site is running via the hosting that I am considering reselling (see here). As you will see, my site is running at a decent speed even although it does not use any PHP caching.

If you would consider a tailored hosting package running in the same environment, please respond via the forum postings.

Edit: Sorry that somehow the code got screwed up - Wordpress does not naturally like to present PHP - the version attached should work. I don’t believe in censorship, hence the comments appear here as given. However, I do appreciate civility, gine that I am contributing to the community.

5 Responses to “Affilistore Quick hack - Display number of products”

  1. Ah had a bit of trouble getting this to work, but I found that it worked best if I had placed the code underneath //hompage {blabla}.

    Modified it a little bit to fit in well :) Thanks for the hack I feel it will be useful and may (unlikely but hopefully) attract a few more of the visitors to browse around a little longer than usual.

  2. So long as you enter the code into a new block of code anywhere in index.php (outside of any if statements, then it shouldn’t matter).

    You might like the new hack I posted on a similar vein for the Admin area.

    I doubt that it will keep most visitors around. It is just something else visual and dynamic.

  3. Kramer auto Pingback[...] it intohttp://www.payless4golf.co.uk/affilistore/Many thanksI did that one too …. see my blog - Affilistore Quick hack - Display number of productsEDIT: I placed text including the # of products in the tag, but obviously you can remove the rest of [...]

  4. Your code is wrong.

    size=”2″

    one character is worng, guess which…

  5. Actually, the your whole sourcecode is fucked up, damn :(
    Please correct it.

Leave a Reply