When I look at your .htaccess rule for shop_product_results.php I see:
RewriteRule ^shop/(.*)/(.*)$ shop_product_results_s.php?sub=$1&perm=$2 [NC,L,QSA,T=application/x-httpd-php]
So you are passing the url parameters "sub" and "perm"
but when I look on lines 56-57 of that page you are filtering your recordset with "id" and "perm"
That mismatch has to be the root of the problem.