1

We have some affiliate tracking on our site. On the success page we need to pass the tracking some information including whether it's a new or returning customer. I've tried a few things but I can't seem to get it working.

My latest attempt is the following

if(Mage::getSingleton('customer/session')->isLoggedIn()) {
  # Existing Customer
  $ED = 11111;
}

else {
  # New customer
  $ED = 22222;
}

This script just returns everybody is a new customer.

Any thoughts?

Thanks

  • where did you insert this code? Anyway you will not see with this if it is a new or returning customer, but only if the customer has an account and is logged in. The account could have been created also in the actual session – HelgeB Feb 12 at 10:16
0

try this

$pidsess = Mage::getSingleton('core/session', array('name'=>'frontend'));
$custsess = Mage::getSingleton('customer/session');
if($custsess->isLoggedIn() == true) {
 $LoggedIn = 'yes';
}
unset($piddata);
unset($custsess);
0

Mage::getSingleton('customer/session')->isLoggedIn() does not return if the customer is a returning customer is or not. As the function suggests, it returns only true if a customer is logged in.

In order to see if someone is a returning customer you would have to make a module where you track who has visited your site before by either logging for example their IP address and/or useragent or by placing a cookie in their browser.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.