Interspire Product Knowledge Base

Would you like to...

Print this page Print this page

Email this page Email this page

Post a comment Post a comment

Subscribe me

Add to favorites Add to favorites

Remove Highlighting Remove Highlighting

Edit this Article

Export to PDF

User Opinions (10 votes)

50% thumbs up 50% thumbs down

How would you rate this answer?



Thank you for rating this answer.

Where Does the "You Might Also Like" Panel Get Its Information From? How Do I Change How It Works?

The "You Might Also Like" panel is generally viewable by your users after they have added an item to their shopping cart. The file that controls this panel is located at:
/includes/display/SuggestiveCartContent.php

Here is the way it works:

The system looks for 9 items to input into the panel. If you wish it to be more or less, you'll need to edit this line in that file:

$query .= $GLOBALS['ISC_CLASS_DB']->AddLimit(0, 9);


and also this line:

$remaining_places = 9-count($prod_ids);


Which is actually included twice in the file (you'll need to edit both places). Just change the 9 to the new number of items that you wish to display.
----------------------------------------------------------------------------------------------
All right, now that we know how many items we want to appear, here is how the system defaults to picking those items....

First, the program searches the order database to see what other users have purchased WHEN they have purchased an item in the cart. If the number of items found in that search is greater than 9, it stops with the first 9 and displays the panel.

Then it searches the related products database table and pulls all related products. If the number of combined items (with the first search) is great than 9, it stops with the first 9 and displays the panel.

If it still hasn't reached 9 at that point, it performs a search of the ratings database table (reviews/ratings) and pulls the highest rated items to fill out the rest of the 9 spots.
----------------------------------------------------------------------------------------------------------
If you want to only have related items shown (which is a popular request from our users), you will need to comment out the other two options.

by changing:

$query = "
SELECT ordprodid
FROM [|PREFIX|]order_products
WHERE orderorderid IN (
SELECT orderorderid FROM [|PREFIX|]order_products WHERE ordprodid='".(int)$GLOBALS['ProductJustAdded']."'
) AND ordprodid NOT IN (".$ignore_prod_list.")
GROUP BY ordprodid
ORDER BY COUNT(ordprodid) DESC
";
$query .= $GLOBALS['ISC_CLASS_DB']->AddLimit(0, 9);
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);

// Get the list of suggested product id's
while($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
$prod_ids[] = $row['ordprodid'];
}
$suggest_prod_ids = implode(",", $prod_ids);
$remaining_places = 9-count($prod_ids);


TO:

/*
$query = "
SELECT ordprodid
FROM [|PREFIX|]order_products
WHERE orderorderid IN (
SELECT orderorderid FROM [|PREFIX|]order_products WHERE ordprodid='".(int)$GLOBALS['ProductJustAdded']."'
) AND ordprodid NOT IN (".$ignore_prod_list.")
GROUP BY ordprodid
ORDER BY COUNT(ordprodid) DESC
";
$query .= $GLOBALS['ISC_CLASS_DB']->AddLimit(0, 9);
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);

// Get the list of suggested product id's
while($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
$prod_ids[] = $row['ordprodid'];
}
$suggest_prod_ids = implode(",", $prod_ids);
$remaining_places = 9-count($prod_ids);
*/


and changing:

if($remaining_places > 0) {
if(!$suggest_prod_ids) {
$suggest_prod_ids = 0;
}
$query = sprintf("select productid, floor(prodratingtotal/prodnumratings) as prodavgrating from [|PREFIX|]products where productid not in (%s) and productid not in (%s) and prodvisible='1' order by prodavgrating desc", $suggest_prod_ids, $ignore_prod_list);

$query .= $GLOBALS['ISC_CLASS_DB']->AddLimit(0, $remaining_places);
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
// Is there at least one product to suggest?
while($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
$prod_ids[] = $row['productid'];
}
$suggest_prod_ids = implode(",", $prod_ids);
}


TO:
/*
if($remaining_places > 0) {
if(!$suggest_prod_ids) {
$suggest_prod_ids = 0;
}
$query = sprintf("select productid, floor(prodratingtotal/prodnumratings) as prodavgrating from [|PREFIX|]products where productid not in (%s) and productid not in (%s) and prodvisible='1' order by prodavgrating desc", $suggest_prod_ids, $ignore_prod_list);

$query .= $GLOBALS['ISC_CLASS_DB']->AddLimit(0, $remaining_places);
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
// Is there at least one product to suggest?
while($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
$prod_ids[] = $row['productid'];
}
$suggest_prod_ids = implode(",", $prod_ids);
}
*/

Related Articles

No related articles were found.

Attachments

No attachments were found.

Powered by Interspire Knowledge Manager - World's #1 Best Selling FAQ and Knowledge Base Software