This recordset is set up to work on a product details page... you are using a subcategory results page. For that page the recordset query would be:
SELECT productcategories.*, catParent.CatPermalink as ParentPermalink FROM productcategories INNER JOIN productcategories AS catParent ON catParent.CategoryID = productcategories.CategoryParentID WHERE catParent.CategoryID = (SELECT CategoryParentID FROM productcategories WHERE CatPermalink = ?)