/** * This function retrieves the "neighbor" products of a product specified by $product_id * Neighbors are the previous and next product in the current list * * @param int $product_id * @return array */ function get_neighbor_products($product_id) { global $perm, $orderby, $my, $auth, $keyword, $DescOrderBy, $limit, $limitstart, $search_limiter, $search_op, $category_id, $manufacturer_id, $vm_mainframe, $vmInputFilter, $product_type_id, $keyword1, $keyword2; $limit = 2000; $limitstart = 0; if (!empty($_SESSION['last_browse_parameters'])) { foreach ($_SESSION['last_browse_parameters'] as $paramName => $paramValue) { ${$paramName} = $paramValue; } } $db = new ps_DB(); $db_browse = new ps_DB(); if (defined('VM_ALLOW_EXTENDED_CLASSES') && defined('VM_THEMEPATH') && VM_ALLOW_EXTENDED_CLASSES && file_exists(VM_THEMEPATH . 'user_class/shop_browse_queries.php')) { // Load the user-defined shop_browse_queries file include_once VM_THEMEPATH . 'user_class/shop_browse_queries.php'; } else { // Otherwise we have to use the original file include PAGEPATH . 'shop_browse_queries.php'; } $db->query($list); $neighbors = array('previous' => '', 'next' => ''); while ($db->next_record()) { if ($db->f('product_id') == $product_id) { $previous_row = $db->previousRow(); $next_row = $db->nextRow(); if (!empty($previous_row->product_id)) { $neighbors['previous']['product_id'] = $previous_row->product_id; $neighbors['previous']['product_name'] = $previous_row->product_name; } if (!empty($next_row->product_id)) { $neighbors['next']['product_id'] = $next_row->product_id; $neighbors['next']['product_name'] = $next_row->product_name; } } } return $neighbors; }
/** * This function retrieves the "neighbor" products of a product specified by $product_id * Neighbors are the previous and next product in the current list * * @param int $product_id * @return array */ function get_neighbor_products($product_id) { global $perm, $orderby, $my, $auth, $keyword, $DescOrderBy, $limit, $limitstart, $search_limiter, $search_op, $category_id, $manufacturer_id, $vm_mainframe, $vmInputFilter, $product_type_id, $keyword1, $keyword2; $limit = 2000; $limitstart = 0; if (!empty($_SESSION['last_browse_parameters'])) { foreach ($_SESSION['last_browse_parameters'] as $paramName => $paramValue) { ${$paramName} = $paramValue; } } $db = new ps_DB(); $db_browse = new ps_DB(); include PAGEPATH . 'shop_browse_queries.php'; $db->query($list); $neighbors = array('previous' => '', 'next' => ''); while ($db->next_record()) { if ($db->f('product_id') == $product_id) { $previous_row = $db->previousRow(); $next_row = $db->nextRow(); if (!empty($previous_row->product_id)) { $neighbors['previous']['product_id'] = $previous_row->product_id; $neighbors['previous']['product_name'] = $previous_row->product_name; } if (!empty($next_row->product_id)) { $neighbors['next']['product_id'] = $next_row->product_id; $neighbors['next']['product_name'] = $next_row->product_name; } } } return $neighbors; }