Skip to content

Instantly share code, notes, and snippets.

@deivisonarthur
Created November 14, 2012 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deivisonarthur/4073134 to your computer and use it in GitHub Desktop.
Save deivisonarthur/4073134 to your computer and use it in GitHub Desktop.
unique-taxvat-parte02.phtml
<?php
include_once '../app/Mage.php';
Mage::app();
$compara = $_GET['firstname'];
$cli = Mage::getModel('customer/customer')
->getCollection()
->addAttributeToFilter('firstname', array('eq' => $compara));
//exclui do filtro o seu cpf, apra caso queira editar o cpf (É necessário mexer mais nisso para que na hora da edição ele não sete um cpf de outra pessoa)
//->addFieldToFilter('customer_firstname', array('neq' => $compara));
$flag=0;
foreach ($cli as $customer) {
$dataid=$customer->getId();
if ($dataid != $compara) //if the value is from another customer_id
$flag |= 1; //we found a dup value
}
if ($flag) {
echo $_GET['firstname'];
}
return true
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment