Carrier braspress and Wordpress Woocommerce

Asked

Viewed 856 times

-3

I am developing a Woocommerce for a customer and month. uses couriers and carrier braspress, but I did not find a solution for braspress, someone could help me, there is a plugin Cláudio Sanches but it seems q has not been finalized, there is maybe some way in Woocommerce to put freight by price range think.q.would, Could someone help me ? Thank you.

  • Welcome to SOPT: I recommend you do the tour and add a mvce

  • The title has nothing to do with what is asked, carrier braspress is a company (as far as I know) and has nothing to do with the technology mentioned and what needs. The question is: Is it a website? "Yes"; Does company A or B interfere with the technology solution? " I don’t think so", so I don’t understand what you mean by "a solution to braspress", unless you’re talking about some webservice... That’s it?

1 answer

1

The title has nothing to do with what is asked, carrier braspress is a company (as far as I know) and has nothing to do with the technology mentioned and what needs. The question is: Is it a website? "Yes"; Does company A or B interfere with the technology solution? " I don’t think so", so I don’t understand what you mean by "a solution to braspress", unless you’re talking about some webservice... That’s it?

I did not find anything ready for Wordpress, but wordpress is written in PHP so there is this repository on Github can help https://github.com/ivanwhm/braspress

Class:

Examples:

How to calculate freight:

//Ajusta a codificação e o tipo do conteúdo
header('Content-type: text/txt; charset=utf-8');

//Importa as classes
require '../classes/Braspress.php';
require '../classes/BraspressCalculaFrete.php';
require '../classes/BraspressCalculaFreteResultado.php';

try
{
  //Cria o objeto
  $consulta = new BraspressCalculaFrete(00000000000000);
  $consulta->setIdOrigem(2);
  $consulta->setCepOrigem(89010130);
  $consulta->setCepDestino(88095001);
  $consulta->setDocumentoDestino(00000000000);
  $consulta->setTipoFrete(Braspress::TIPO_FRETE_RODOVIARIO);
  $consulta->setPeso(1500);
  $consulta->setValorNF(123);
  $consulta->setVolume(1);
  if ($consulta->processaConsulta())
  {
    $retorno = $consulta->getResultado();
    //Se teve erro
    if ($retorno->getSucesso())
    {
      //Imprime o resultado
      echo 'Valor total do frete............: ' . number_format($retorno->getTotalFrete(), 2, ',', '.') . PHP_EOL;
      echo 'Percentual de ICMS..............: ' . number_format($retorno->getIcms(), 0, ',', '.') . '%' . PHP_EOL;
      echo 'Valor do ICMS...................: ' . number_format($retorno->getValorIcms(), 2, ',', '.') . PHP_EOL;
      echo 'Valor do frete peso.............: ' . number_format($retorno->getFretePeso(), 2, ',', '.') . PHP_EOL;
      echo 'Valor do frete valor............: ' . number_format($retorno->getFreteValor(), 2, ',', '.') . PHP_EOL;
      echo 'Valor da taxa de seção cadastro.: ' . number_format($retorno->getTaxaSecaoCad(), 2, ',', '.') . PHP_EOL;
      echo 'Valor da taxa de pedágio........: ' . number_format($retorno->getTaxaPedagio(), 2, ',', '.') . PHP_EOL;
      echo 'Valor da taxa de despacho.......: ' . number_format($retorno->getTaxaDespacho(), 2, ',', '.') . PHP_EOL;
      echo 'Valor da taxa de ITR............: ' . number_format($retorno->getTaxaITR(), 2, ',', '.') . PHP_EOL;
      echo 'Valor da taxa de ademe..........: ' . number_format($retorno->getTaxaAdeme(), 2, ',', '.') . PHP_EOL;
      echo 'Valor das outras taxas..........: ' . number_format($retorno->getTaxaOutros(), 2, ',', '.') . PHP_EOL;
      echo 'Valor do subtotal do frete......: ' . number_format($retorno->getSubtotal(), 2, ',', '.') . PHP_EOL;
      echo 'Prazo de entrega................: ' . $retorno->getPrazoEntrega() . PHP_EOL;
    } else
      echo 'Ocorreu um erro. Mensagem: ' . $retorno->getMensagemErro() . PHP_EOL . PHP_EOL;
  } else
    echo 'Ocorreu um erro, tente novamente mais tarde.' . PHP_EOL;
} catch (Exception $e)
{
  echo 'Ocorreu um erro ao processar sua solicitação. Erro: ' . $e->getMessage() . PHP_EOL;
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.