PDA

View Full Version : Hot picks hack


Andy
20-06-07, 17:14
RE: this thread: http://www.shopwindowforum.com/forumdisplay.php?f=5

can someone tell me if there yet a way to make the hot picks relevant to the category a user is in?

cheers

Cheers for this Idea, Ive had some plays and Ive come up with something rather natty.

I wanted to show some relevant hotpicks under each product. Give them a choice, I thought, and also have some nice relevant internal links to help the Search engines.

So, heres what I did.
(Please note, that some of this is specific to my site, so you may have to play around alittle)

1. I didn't want these hotpicks to be displayed exactly the same as my homepage hotpicks, so, I duplicated hot_picks.php and hot_picks.tpl. This might not be nessecary for you.

2. Open products.php, find:
$oSmarty->display('product.tpl');
directly above add:
include(HOME_PATH.'includes'.DIRECTORY_SEPARATOR.' elements'.DIRECTORY_SEPARATOR.'hot_picks.php');
(or your duplicated hot_picks.php file)

3. open includes/elements/class.page_product.php, find:
function buildData()
{
# check requirements
if ( !is_numeric($this->iProductId) ) return false;
Directly below, add this:
##hack for relevant hotpicks on product page
if(isset($_GET['c'])){

$aHotPickParams = array("iLimit"=>8,"iCategoryId"=>$_GET['c']);
$this->oHotPick = $oClient->call('getHotPickProductList', $aHotPickParams);
}
########
You can change: "iLimit"=>8 to whatever number of products you want to display.
NOTE: if(isset($_GET['c'])){
This is important because some product pages do not have the categoryID in the get string. These pages would return an error and slow the page load down a hell of alot.

4. Finally, in templates/YOURTEMPLATE/product.tpl add this anywhere you want the hotpicks to be displayed:
{include file="elements`$DIRECTORY_SEPARATOR`hot_picks.tpl"}
(or your duplicated hot_picks.tpl file)
It's upto you to work out your own styling for these.


You could rework these instructions to include the hotpicks on category pages, by changing any "products" mentioned above to "category".

Hope Ive remembered everything, and hope this helps someone get closer to their aims.

happy hacking!!!

Andy :D

Ajax2000
27-06-07, 11:42
Nice, was about to do something similar, very grateful!

Whilst I'm typing, anyone worked out how to highlight the current Sub Category when navigating? See ShopWindow.com for sample.