deivisonarthur
11/14/2012 - 4:29 PM

unique-taxvat-parte02.phtml

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

?>