Check the setting of the $xcart_web_dir variable in config.php. It is probably set to '/'.
The product URL uses $http_location to build the link, so check to see if it has a trailing slash. If it does, you could use preg_replace() to remove it.
Try this:
Code:
$product_url = preg_replace('/\/$/', '', $http_location).'/customer/product.php?productid='.$products[$key][productid].$partner_track;
You may also need to do the same thing to $image_url
If the above does not work, then you may be using a version of X-Cart that I am not familiar with.