Example #1
0
 /**
  * Render customer info to grid column html
  * 
  * @param Varien_Object $row
  */
 public function render(Varien_Object $row)
 {
     $actionName = $this->getRequest()->getActionName();
     if (strpos($actionName, 'export') === 0) {
         return $row->getCustomerEmail();
     }
     return sprintf('<a target="_blank" href="%s">%s</a>', $this->getUrl('adminhtml/customer/edit', array('id' => $row->getCustomerId())), $row->getCustomerEmail());
 }
    public function render(Varien_Object $row)
    {
        if ($row->getCustomerId()) {
            return sprintf('
				<a href="%s" title="%s">%s</a>', $this->getUrl('adminhtml/customer/edit/', array('_current' => true, 'id' => $row->getCustomerId())), Mage::helper('catalog')->__('View Customer Detail'), $row->getCustomerEmail());
        } else {
            return sprintf('%s', $row->getCustomerEmail());
        }
    }
Example #3
0
 /**
  * @param Varien_Object $row
  *
  * @return string
  */
 public function render(Varien_Object $row)
 {
     /** @var AW_Helpdesk3_Model_Ticket $row */
     $customerId = $this->_getCustomerIdByEmail($row->getCustomerEmail());
     if (null !== $customerId) {
         $url = Mage::helper('adminhtml')->getUrl('adminhtml/customer/edit', array('id' => $customerId));
         return "<a href='{$url}'>" . parent::render($row) . "</a>";
     }
     return parent::render($row);
 }
Example #4
0
 /**
  * Define the enqueue XML data
  *
  * @param Varien_Object $order
  */
 private function enfileirarData($order)
 {
     $this->_resetData();
     //Pega os dados do cliente
     $customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
     //Define os dados da cobrança
     $this->xmlCompradorNome = (string) $order->getBillingAddress()->getFirstname() . ' ' . $order->getBillingAddress()->getLastname();
     $customerDocs = explode(",", Mage::getStoreConfig('allpago/fcontrol/campo_documento'));
     $cpfLog = null;
     foreach ($customerDocs as $customerDoc) {
         $metodo = 'get' . ucfirst($customerDoc);
         if (!$this->xmlCompradorCpfCnpj && $customer->{$metodo}()) {
             $this->xmlCompradorCpfCnpj = (string) preg_replace('/[^0-9]/', '', $customer->{$metodo}());
         }
         if ($customer->{$metodo}()) {
             $cpfLog .= '<pre>' . print_r($customer->getData(), true) . '<br/>Método: ' . $metodo . ' ( ' . $customer->{$metodo}() . ' )</pre>';
         }
     }
     if (!$this->xmlCompradorCpfCnpj) {
         Mage::throwException('CPF não encontrado' . $cpfLog);
     }
     $this->xmlCompradorSexo = (string) 'M';
     // @todo: Pegar esta informação do Magento
     $this->xmlCompradorDataNascimento = (string) '1900-01-01';
     // @todo: Pegar esta informação do Magento
     $this->xmlCompradorDddTelefone = (string) substr(str_replace(' ', '', preg_replace('/[()-]*/', '', $order->getBillingAddress()->getTelephone())), 0, 2);
     $this->xmlCompradorNumeroTelefone = (string) substr(str_replace(' ', '', preg_replace('/[()-]*/', '', $order->getBillingAddress()->getTelephone())), 2, 9);
     $this->xmlCompradorDddCelular = (string) substr(str_replace(' ', '', preg_replace('/[()-]*/', '', $order->getBillingAddress()->getTelephone())), 0, 2);
     // @todo: Pegar esta informação do Magento / Community e o Enterprise
     $this->xmlCompradorNumeroCelular = (string) substr(str_replace(' ', '', preg_replace('/[()-]*/', '', $order->getBillingAddress()->getTelephone())), 2, 9);
     // @todo: Pegar esta informação do Magento / Community e o Enterprise
     $this->xmlCompradorIP = (string) $order->getRemoteIp();
     $this->xmlCompradorEmail = (string) $order->getCustomerEmail();
     $this->xmlCompradorEnderecoCep = (string) str_replace(' ', '', preg_replace('/[-.]*/', '', $order->getBillingAddress()->getPostcode()));
     $this->xmlCompradorEnderecoRua = (string) $order->getBillingAddress()->getStreet(1);
     $this->xmlCompradorEnderecoNumero = (string) $order->getBillingAddress()->getStreet(2);
     $this->xmlCompradorEnderecoComplemento = (string) Mage::helper('core/string')->truncate($order->getBillingAddress()->getStreet(3), 100);
     $this->xmlCompradorEnderecoBairro = (string) $order->getBillingAddress()->getStreet(4);
     $this->xmlCompradorEnderecoCidade = (string) $order->getBillingAddress()->getCity();
     $region = "";
     $directoryRegion = Mage::getResourceModel('directory/region_collection');
     $directoryRegion->getSelect()->reset()->from(array('main_table' => $directoryRegion->getMainTable()), 'default_name');
     $directoryRegion->addFieldToFilter('country_id', 'BR')->addFieldToFilter('region_id', $order->getBillingAddress()->getRegionId());
     $billingRegion = $directoryRegion->getResource()->getReadConnection()->fetchOne($directoryRegion->getSelect());
     $this->xmlCompradorEnderecoEstado = (string) $billingRegion;
     //Define os dados de entrega
     $this->xmlEntregaNome = (string) ($order->getShippingAddress()->getFirstname() . ' ' . $order->getShippingAddress()->getLastname());
     $customerDocs = explode(",", Mage::getStoreConfig('allpago/fcontrol/campo_documento'));
     $this->xmlEntregaCpfCnpj = null;
     foreach ($customerDocs as $customerDoc) {
         $metodo = 'get' . ucfirst($customerDoc);
         if (!$this->xmlEntregaCpfCnpj && $order->getShippingAddress()->{$metodo}()) {
             $this->xmlEntregaCpfCnpj = (string) preg_replace('/[^0-9]/', '', $order->getShippingAddress()->{$metodo}());
         }
     }
     $this->xmlEntregaCpfCnpj = $this->xmlEntregaCpfCnpj ? $this->xmlEntregaCpfCnpj : $this->xmlCompradorCpfCnpj;
     $this->xmlEntregaSexo = (string) 'M';
     // @todo: Pegar esta informação do Magento
     $this->xmlEntregaDataNascimento = (string) '1900-01-01';
     // @todo: Pegar esta informação do Magento
     $this->xmlEntregaDddTelefone = (string) substr(str_replace(' ', '', preg_replace('/[()-]*/', '', $order->getShippingAddress()->getTelephone())), 0, 2);
     $this->xmlEntregaNumeroTelefone = (string) substr(str_replace(' ', '', preg_replace('/[()-]*/', '', $order->getShippingAddress()->getTelephone())), 2, 9);
     $this->xmlEntregaDddCelular = (string) substr(str_replace(' ', '', preg_replace('/[()-]*/', '', $order->getBillingAddress()->getTelephone())), 0, 2);
     // @todo: Pegar esta informação do Magento / Community e o Enterprise
     $this->xmlEntregaNumeroCelular = (string) substr(str_replace(' ', '', preg_replace('/[()-]*/', '', $order->getShippingAddress()->getTelephone())), 2, 9);
     // @todo: Pegar esta informação do Magento / Community e o Enterprise
     $this->xmlEntregaEnderecoCep = (string) str_replace(' ', '', preg_replace('/[-.]*/', '', $order->getShippingAddress()->getPostcode()));
     $this->xmlEntregaEnderecoRua = (string) $order->getShippingAddress()->getStreet(1);
     $this->xmlEntregaEnderecoNumero = (string) $order->getShippingAddress()->getStreet(2);
     $this->xmlEntregaEnderecoComplemento = (string) Mage::helper('core/string')->truncate($order->getShippingAddress()->getStreet(3), 100);
     $this->xmlEntregaEnderecoBairro = (string) $order->getShippingAddress()->getStreet(4);
     $this->xmlEntregaEnderecoCidade = (string) $order->getShippingAddress()->getCity();
     $directoryRegion = Mage::getResourceModel('directory/region_collection');
     $directoryRegion->getSelect()->reset()->from(array('main_table' => $directoryRegion->getMainTable()), 'default_name');
     $directoryRegion->addFieldToFilter('country_id', 'BR')->addFieldToFilter('region_id', $order->getShippingAddress()->getRegionId());
     $shippingRegion = $directoryRegion->getResource()->getReadConnection()->fetchOne($directoryRegion->getSelect());
     $this->xmlEntregaEnderecoEstado = (string) $shippingRegion;
     //Define os dados dos produtos
     $totalItems = 0;
     $items = $order->getAllItems();
     $this->xmlPedidoProdutos = array();
     foreach ($items as $item) {
         $this->xmlPedidoProdutos[] = array('Codigo' => (string) $item->getProductId(), 'Descricao' => (string) $item->getName(), 'Quantidade' => (string) $item->getQtyOrdered(), 'ValorUnitario' => (string) $item->getPrice() * 100, 'ListaDeCasamento' => (string) false, 'ParaPresente' => (string) false);
         $totalItems += $item->getQtyOrdered();
     }
     //Define os dados do pagamento
     $this->xmlPedidoPagamentos = array('MetodoPagamento' => (string) 'CartaoCredito', 'Valor' => (string) ($order->getGrandTotal() * 100), 'NumeroParcelas' => (string) 1);
     //Define os dados dos pedido
     $this->xmlPedidoCodigoPedido = (string) $order->getId();
     $dataCompra = new DateTime($order->getCreatedAt());
     $dataCompra->setTimezone(new DateTimeZone('America/Sao_Paulo'));
     $this->xmlPedidoDataCompra = (string) $dataCompra->format('Y-m-d\\TH:i:s');
     $this->xmlPedidoQuantidadeItensDistintos = (string) count($items);
     $this->xmlPedidoQuantidadeTotalItens = (string) $totalItems;
     $this->xmlPedidoValorTotalCompra = (string) ($order->getGrandTotal() * 100);
     $this->xmlPedidoValorTotalFrete = (string) ($order->getPayment()->getShippingAmount() * 100);
     $this->xmlPedidoPrazoEntregaDias = (string) '0';
     $this->xmlPedidoCanalVenda = (string) 'Loja Virtual';
 }
 public function render(Varien_Object $row)
 {
     $hlp = Mage::helper('amacart');
     $id = $row->getId();
     return '<button type="button" class="scalable task" onclick="runRuleTesting(this, ' . $id . ', \'' . $row->getCustomerEmail() . '\')"><span><span><span>' . $hlp->__('Run') . '</span></span></span></button>';
 }
 protected function _sendCustomerNotification(Varien_Object $data)
 {
     $mailTemplate = Mage::getModel('core/email_template');
     $storeId = $data->getStoreId();
     $mailTemplate->setDesignConfig(array('area' => 'frontend', 'store' => $storeId))->setReplyTo($data->getAdminUserEmail())->sendTransactional(Mage::getStoreConfig('askit/email/customer_template', $storeId), Mage::getStoreConfig('askit/email/sender', $storeId), $data->getCustomerEmail(), null, array('data' => $data));
     return $mailTemplate->getSentSuccess();
 }