Created
November 14, 2012 16:29
-
-
Save deivisonarthur/4073134 to your computer and use it in GitHub Desktop.
unique-taxvat-parte02.phtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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