Quote:
Originally Posted by mltriebe
Actually I do seem to be having issues with these 2 lines:
$category_data = func_query_first("SELECT categoryid, lpos, rpos FROM $sql_tbl[categories] USE INDEX (PRIMARY) WHERE categoryid = '$cat'");
if ($category_data)
$result = func_query_hash("SELECT categoryid FROM xcart_categories USE INDEX (pa) WHERE lpos BETWEEN $category_data[lpos] AND $category_data[rpos] AND avail = 'Y'", "categoryid", false, true);
Specifically lpos and rpos do not exist in 4.3.2.
I will keep working at it but any help would be great.
Mike
|
Older versions of X-Cart used the field, categorid_path, in the categories table rather than lpos and rpos. I'm not sure when the change occurred, but I think it was with the 4.4.x branch. So your categories table in 4.3.2 should be similar to the categories table in my current live 4.1.8 store and the 4.2.3 version I tested some time ago. I looked at bestsellers.php for 4.2.3 and, based on that, modified the category IDs section to this:
Code:
if ($cat) {
$category_data = func_query_first("SELECT categoryid_path FROM $sql_tbl[categories] USE INDEX (PRIMARY) WHERE categoryid = '$cat'");
$result = func_query_hash("SELECT categoryid FROM $sql_tbl[categories] USE INDEX (pa) WHERE categoryid_path LIKE '$category_data[categoryid_path]/%' AND avail = 'Y'", "categoryid", false, true);
$cat_ids = array();
if (is_array($result) && !empty($result)) {
$cat_ids = array_keys($result);
} else {
$cat_ids[] = $cat;
}
$search_query = " AND $sql_tbl[products_categories].categoryid IN ('".implode("','", $cat_ids)."')";
unset($result);
}
I don't have any way of testing this code, but it should work in your version unless major changes occurred between 4.2.3 and 4.3.2. Hope that helps.