Ir para conteúdo

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

  • 0
Ramon Medeiros

Integração do MercadoPago ao meu site em php

Pergunta

Bom dia pessoal! É o seguinte, nunca fiz uma loja virtual e queria entender como funciona. Andei pesquisando e encontrei o MercadoPago com Checkout Transparente. Eu queria adicionar um carrinho de compras no meu site feito em php e finalizar a compra pagando com o MercadoPago, mas sem sair do meu site. Tentei entender o tutorial pelo MercadoPago Developers mas não entendi quase nada por ser novo no ramo de php. Consigo integrar o MercadoPago sem ter plataforma E-commerce? Gostaria de uma luz de como ou por onde eu começo.

 

Desde já agradeço.

Compartilhar este post


Link para o post
Compartilhar em outros sites

0 respostas a esta questão

Recommended Posts

Até agora não há respostas para essa pergunta


  • Conteúdo Similar

    • Por Carlos Antoliv
      Senhores, tudo bem?
       
      Tô numa dúvida aqui... tá matando.
      Estou tentando contar a quantidade de itens do carrinho de compras.
       
      Este aqui é o input que aparece a quantidade de itens:
      <td><input type="text" name="prod[<?php echo $result['id']?>]" value="<?php echo $qtdProd = $result['quantity']?>" size="1"  />                          </td>  
      Aparece normalmente a quantidade de itens. Ex: arroz   2  <<< este 2 fica dentro do input, onde posso alterá-lo.
      Minha ideia é mostrar na tela a quantidade total de itens que estão no carrinho.
       
      To usando esse código aqui pra aparecer o número total.... e até funciona:
       
                         <?php                                     if(isset($_SESSION['carrinho'])){                                     $amount = 0;                                     $count = 0;                                     $size = count($_SESSION['carrinho']);                                                                         foreach($_SESSION['carrinho'] as $data){                                     $count++;                                     $amount += $data['quantity'];                                     if($size == $count){                                     echo "TOTAL = $amount";                                     }                                 }                             }                                 ?>  
      O problema é que está exibindo o seguinte erro:
      Warning: Illegal string offset 'quantity' in C:\...\www\sistema\carrinho-de-compra\carrinho.php on line 90
       
      Erro na linha 90, no caso, neste linha aqui: 
          $amount += $data['quantity'];
       
      Daí travei um pouco.
       
      Alguém que poderia dar força ? Tá osso aqui.
      tmj
       
       
    • Por tony_lu
      Ola pessoal, preciso de uma ajuda!
      Tenho uma loja virtual na brasil na web onde esta integrado uma conta do pagseguro. Acontece que a mesma empresa quer uma outra loja, porém na plataforma Tray e com pagamento via Pagseguro! Então estou na duvida, posso integrar a mesma conta pagseguro com o mesmo token para as duas lojas? Não pode dar conflito?
      A plataforma Brasil na Web eu coloco para configurar o token e o email de cadastro do Pagseguro, na loja Tray tem que colocar além do token, cadastrar uma url la dentro do pagseguro, acho que é uma url de retorno. Então meu receio é dar conflito! Qual seria a melhor solução? Aguardo obrigado
    • Por Hamanom007
      Loja Virtual criada em 2008, nosso querido PHP atualizou e fico descontinuada, a loja não funcionava, mas com muito esforço consegui, e agora volto a ter sua função de comprar e de alertar o responsável que fizeram um novo pedido.

      Sendo assim sua funcionalidade básica volto ao normal.

      Porem á erro que não estou conseguindo resolver.
      Os meus estudos sobre a falha aponta para: 
      Atualize o ISC e magic_quotes_runtime_on 
      Mas como disse, são só conteúdos que tenho lido, porem não sei se estou no caminho correto.

      O erro aparecendo é esse:
       
      Strict Standards: Declaration of ISC_FORMFIELD_CHECKBOXSELECT::getFieldRequestValue() should be compatible with ISC_FORMFIELD_BASE::getFieldRequestValue($fieldName = '') in /home2/jajajavai/public_html/loja/lib/formfields/formfield.checkboxselect.php on line 295 Configuração do PHP INI:


       Quem poder me apontar uma direção fico muito agradecido Obrigado a todos.


      Aqui está o arquivo do alerta:

       
      <?php error_reporting(0); class ISC_FORMFIELD_CHECKBOXSELECT extends ISC_FORMFIELD_BASE { /** * Constructor * * Base constructor * * @access public * @param mixed $fieldId The optional form field Id/array * @param bool $copyField If TRUE then this field will copy the field $fieldId EXCEPT for the field ID. Default is FALSE * @return void */ public function __construct($formId, $fieldId='', $copyField=false) { $defaultExtraInfo = array( 'class' => '', 'style' => '', 'options' => array() ); parent::__construct($formId, $defaultExtraInfo, $fieldId, $copyField); } /** * Get the form field description * * Static method will return an array with the form field name and description as the elements * * @access public * @return array The description array */ public static function getDetails() { return array( 'name' => GetLang('FormFieldSingleCheckBoxName'), 'desc' => GetLang('FormFieldSingleCheckBoxDesc'), 'img' => 'checkbox.png', ); } /** * Get the requested (POST or GET) value of a field * * Method will search through all the POST and GET array values are return the field * value if found. Method will the POST and GET arrays in order based on the PHP INI * value 'variables_order' (the GPC order) * * @access public * @return mixed The value of the form field, if found. Empty string if not found */ public function getFieldRequestValue() { $options = parent::getFieldRequestValue(); if (!is_array($options)) { $options = array($options); } $options = array_filter($options); $options = array_values($options); return $options; } /** * Run validation on the server side * * Method will run the validation on the server side (will not run the JS function type) and return * the result * * @access public * @param string &$errmsg The error message if the validation fails * @return bool TRUE if the validation was successful, FALSE if it failed */ public function runValidation(&$errmsg) { if (!parent::runValidation($errmsg)) { return false; } $values = $this->getValue(); if ($values == '') { return true; } /** * Just need to check that all our selected values actually existing within our options array */ if (empty($this->extraInfo['options'])) { return true; } foreach ($values as $value) { if (!in_array($value, $this->extraInfo['options'])) { $errmsg = sprintf(GetLang('CustomFieldsValidationInvalidSelectOption'), $this->label); return false; } } return true; } /** * Set the field value * * Method will set the field value, overriding the existing one * * @access public * @param mixed $value The default value to set * @param bool $setFromDB TRUE to specify that this value is from the DB, FALSE from the request. * Default is FALSE * @param bool $assignRealValue TRUE to filter out any values that is not in the options array, * FALSE to set as is. Default is TRUE */ public function setValue($value, $setFromDB=false, $assignRealValue=true) { if (!is_array($value)) { $value = array($value); $value = array_filter($value); } if ($assignRealValue && !empty($this->extraInfo['options'])) { $filtered = array(); foreach ($value as $key => $val) { $index = array_isearch($val, $this->extraInfo['options']); if ($index !== false) { $filtered[$key] = $this->extraInfo['options'][$index]; } } $value = $filtered; } parent::setValue($value, $setFromDB); } /** * Set the field value by the indexes in the options array * * Method will set the value based upon the indexes in the options array. Every values in the * array $indexes will correspond to the index in the options array * * @access public * @param array $indexes The array of indexes * @return NULL */ public function setValueByIndex($indexes) { if (!is_array($indexes)) { $indexes = array($indexes); } $indexes = array_filter($indexes, 'is_numeric'); if (empty($indexes) || empty($this->extraInfo['options'])) { return; } $newValue = array(); foreach ($indexes as $index) { if (array_key_exists($index, $this->extraInfo['options'])) { $newValue[] = $this->extraInfo['options'][$index]; } } $this->setValue($newValue); } /** * Set the select options * * Method will set the select option for the frontend select box, overriding any perviously set options * * @access public * @param array $options The options array with the key as the options value and the value as the options text * @return bool TRUE if the options were set, FALSE if options were not an array */ public function setOptions($options) { if (!is_array($options)) { return false; } else { $options = array_values($options); } $this->extraInfo['options'] = $options; } /** * Build the frontend HTML for the form field * * Method will build and return the frontend HTML of the loaded form field. The form field must be * loaded before hand * * @access public * @return string The frontend form field HTML if the form field was loaded beforehand, FALSE if not */ public function loadForFrontend() { if (!$this->isLoaded()) { return false; } /** * Make sure that our value is an array */ $this->setValue($this->value); /** * Do we have options (hope so)? */ $GLOBALS['FormFieldCheckBoxes'] = ''; if (!empty($this->extraInfo['options'])) { $id = $this->getFieldId(); $name = $this->getFieldName(); $args = ''; if ($this->extraInfo['class'] !== '') { $args .= 'class="' . isc_html_escape($this->extraInfo['class']) . ' FormFieldOption" '; } else { $args .= 'class="FormFieldOption" '; } if ($this->extraInfo['style'] !== '') { $args .= 'style="' . isc_html_escape($this->extraInfo['style']) . '" '; } $checkboxes = array(); $options = array_values($this->extraInfo['options']); foreach ($this->extraInfo['options'] as $key => $val) { $newId = $id . '_' . $key; $newName = $name . '[' . $key . ']'; $html = '<label for="' . $newId . '">'; $html .= '<input type="checkbox" id="' . $newId . '" name="' . $newName . '" value="' . isc_html_escape($val) . '" ' . $args; /** * Is this one of our values? */ if (in_array($val, $this->value)) { $html .= ' checked="checked"'; } $html .= ' /> ' . isc_html_escape($val) . '</label>'; $checkboxes[] = $html; $key++; } $GLOBALS['FormFieldCheckBoxes'] = implode('<br />', $checkboxes); } $GLOBALS['FormFieldDefaultArgs'] = 'id="' . isc_html_escape($this->getFieldId()) . '" class="FormField"'; return $this->buildForFrontend(); } /** * Build the backend HTML for the form field * * Method will build and return the backend HTML of the form field * * @access public * @return string The backend form field HTML */ public function loadForBackend() { $GLOBALS['FormFieldClass'] = isc_html_escape($this->extraInfo['class']); $GLOBALS['FormFieldStyle'] = isc_html_escape($this->extraInfo['style']); $GLOBALS['FormFieldOptions'] = implode("\n", $this->extraInfo['options']); return parent::buildForBackend(); } /** * Save the field record * * Method will save the field record into the database * * @access protected * @param array $data The field data record set * @param string &$error The referenced variable to store the error in * @return bool TRUE if the field was saved successfully, FALSE if not */ public function saveForBackend($data, &$error) { return parent::saveForBackend($data, $error); } }  
    • Por dutopfave
      Boa Tarde, estou criando uma loja virtual, e a questão é voltado para o carrinho de compras, ate agora ta tudo certo, funcionando normal, porém tem produtos que tem vários tamanho, exemplo eu tenho um tênis, e eu posso escolhe se quero tamanho 41 ou 42, blz ate ai ele registra certinho no banco, porém, se por a caso eu também queira compra o do tamanho 41, e dps volto la e compro o 42, invés de cria 2 produto no carrinho ele acaba atualizando o mesmo, pegando o ultimo tamanho q escolhi e na quantidade aumentando pra 2, vou manda o código aki, pq o ideal seria aparece 2 produto no carrinho, pq são 2 tamanho diferente, e isso ta quebrando a cabeça:
      Código:
      if($_GET['acao'] == 'adds'){ $qtds = $_POST['qtds']; $cart_tamanho = $_POST['cart_tamanho']; if(!isset($_SESSION['carrinho'][$id]) && $_SESSION['carrinho'][$id] < $Verifica_qtd_row2){ $_SESSION['carrinho'][$id] = $qtds; $_SESSION['cart_tamanho'][$id] = $cart_tamanho; }elseif($_SESSION['carrinho'][$id] < $Verifica_qtd_row2){ $_SESSION['carrinho'][$id] += $qtds; $_SESSION['cart_tamanho'][$id] = $cart_tamanho; }else{ $_SESSION['carrinho'][$id] = 1; $_SESSION['cart_tamanho'][$id] = $cart_tamanho; } }  
×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.