I have a digital product store and a lot of time customers dont realize that they have purchase a downloadable product before and accidently order it again. Resulting in an email..and the time it takes for me to issue a refund, or give them another design.
I would like to code the cart page to alert customers that are logged in via a message below the product they enter telling them that tada.."You have purchsed this product before"
Heres the code I have so far but im not getting the message when i test adding a product that I have already have on the test account:
if($ccUserData[0]['customer_id']>0)
{
$query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_order_sum INNER JOIN ".$glob['dbprefix']."CubeCart_order_inv ON ".$glob['dbprefix']."CubeCart_order_sum.cart_order_id = ".$glob['dbprefix']."CubeCart_order_inv.cart_order_id WHERE ".$glob['dbprefix']."CubeCart_order_sum.cart_order_id = ".$db->mySQLSafe($_GET['cart_order_id'])." AND ".$glob['dbprefix']."CubeCart_order_sum.cart_order_id=".$db->mySQLsafe($ccUserData[0]['cart_order_id']);
$prodArray = $db->select($query);
if($prodArray == TRUE)
{
foreach($prodArray as $prodBought) {
$prodList[] = $prodBought['productId'];
}
foreach($basket['conts'] as $key => $value){
$i++;
$productId = $cart->getProductId($key);
if (in_array($productId, $prodList)) {
$view_cart->assign("SUCCESS2","You have already purchased this product.");
$view_cart->parse("view_cart.repeat_cart_contents.duplicate");
}}}}