Gostaria de saber como criar um modulo para transporte Correios - Brasil -
03.11.2012 22:06
|
|
germanoalves
Name: germano
07.12.2010
Сообщения: 1
|
|
11.12.2012 17:35
|
|
maclaud
Name: Connor McLaud
02.08.2012
Сообщения: 11
|
|
15.11.2015 13:48
|
|
bbcp
Name: Bruno
25.10.2015
Сообщения: 1
|
Aw: correios
Hi, 1- I am trying to create a freight simulator to integrate joomshopping and I can not get it to work. The calculation in Brazil is done with size, weight, length, width, height, I did not understand the answer on creating the menu, creating this menu? 2- Another issue is the creation of plots to integrate with the credit card, I see the option to enter the number of installments and payment cosigo not do it .Many people in Brazil are using joomlshopping would be good you create integration with Brazilian Cielo, I send attached models for you to analyze. thank you Simulator function onAfterRender() { $app = JFactory::getApplication(); if($app->getName() != 'site') { return true; } $tag_simulador = $this->params->get('tag_simulador'); $this->injetarSimulador($tag_simulador); $view = JRequest::getVar('view',''); $option = JRequest::getVar( 'option', '' ); $calcularSimulador = JRequest::getVar( 'calcularSimulador', '' ); if ($option=='com_jshopping' && $calcularSimulador == '1') { $this->simulaFrete(); } } function injetarSimulador($tag_simulador) { $body = JResponse::getBody(); $html_tag_simulador = '<'.$tag_simulador.'/>'; $pos = strpos($body, $html_tag_simulador); if ($pos == true) { $conteudo_simulador = $this->conteudoSimulador(); $new_body = str_replace($html_tag_simulador,$conteudo_simulador,$body); JResponse::setBody($new_body); } } function conteudoSimulador() { $app = JFactory::getApplication(); //$template = $app->getTemplate(); $imagem_plugin = JURI::base() . 'plugins' .DS. 'system' .DS. 'vmsimulador'; $view = JRequest::getVar('view'); $jshopping_product_id = JRequest::getVar('jshopping_product_id'); $jshopping_category_id = JRequest::getVar('jshopping_category_id'); if ($view == 'cart') { $url_simulador = JURI::base().DS. ('index.php?option=com_jshopping&tmpl=component&calcularSimulador=1&view=cart'); } else { $url_simulador = JURI::base().DS. ('index.php?option=com_jshopping&view=productdetails&jshopping_product_id=' . $jshopping_product_id . '&jshopping_category_id=' . $jshopping_category_id . '&tmpl=component&calcularSimulador=1'); } $url_correios = "http://www.buscacep.correios.com.br/"; $html = ' <script src="'.JURI::root(true).'/plugins/system/vmsimulador/jquery.maskinput.js" language="javascript"></script> <script language="javascript"> function doAjaxCEP() { jQuery("#resultAjax").html("Carregando valores do frete..."); var zip_code = jQuery("#cep_simulador").val(); jQuery.ajax({ type: "POST", url: "'.$url_simulador.'", data: "zip_code="+zip_code+"&quantity[0]=1", success: function(html) { jQuery("#resultAjax").html(html); jQuery("#resultAjax input").hide(); } }); } '. "jQuery(document).ready(function($) { $('a.correios_cep').click( function(){ $.facebox({ iframe: '" . $url_correios . "', rev: 'iframe|350|750' }); return false ; }); jQuery('#cep_simulador').mask('99999-999'); }); </script> ". '<style type="text/css"> .boxSimuleFrete { padding:5px; background:#dddddd; padding-top:5px; color: #434343; -moz-border-radius-bottomleft:5px; -moz-border-radius-topleft:5px; -moz-border-radius-bottomright:5px; -moz-border-radius-topright:5px; border-bottom-left-radius:5px; border-bottom-right-radius:5px; border-top-left-radius:5px; border-top-right-radius:5px; width: 480px; } .boxSimuleFrete .icon { float:left; margin-right:10px; } .boxSimuleFrete .inf { float:left; } .boxSimuleFrete #resultAjax { -moz-border-radius-bottomleft:5px; -moz-border-radius-topleft:5px; -moz-border-radius-bottomright:5px; -moz-border-radius-topright:5px; border-bottom-left-radius:5px; border-bottom-right-radius:5px; border-top-left-radius:5px; border-top-right-radius:5px; background:#FFF; } </style> <div class="boxSimuleFrete"> <input type="hidden" name="product_id_simulador" id="product_id_simulador" value="'.@$this->product->jshopping_product_id.'"> <div class="icon"> <img src="'.$imagem_plugin.'/images/boxes.png"> </div> <div class="inf"> <strong>Calcule o frete e o prazo de entrega estimados para sua região. </strong> <div class="formCEP"> Informe seu CEP: <input type="text" class="inputbox" name="cep" id="cep_simulador" style="width:120px;"> <input type="button" class="button" onclick="doAjaxCEP()" style="display:inline; float:none" value="OK" /> <a href="'.$url_correios.'" target="_blank" class="correios_cep">Não sei meu CEP</a> </div> </div> <br class="clear"> <div id="resultAjax"> </div> </div> '; return $html; } function simulaFrete(){ header('Content-Type: text/html; charset=utf-8'); $zipcode = JRequest::getVar('zip_code',''); if ($zipcode != '') { $view = JRequest::getVar('view'); $cart = jshoppingCart::getCart(false); // caso não haja produtos, não retorna if (empty($cart->products) and $view=='cart') { die('Carrinho vazio: Adicione produtos para simular o frete.'); } if (!isset($cart->vendorId)) $cart->vendorId = 1; //if (!isset($cart->ST)) $cart->ST = array("zip"=>$zipcode); if (!isset($cart->STsameAsBT)) $cart->STsameAsBT = 1; if (!isset($cart->ST["jshopping_country_id"])) $cart->ST["jshopping_country_id"] = 30; // seta o brasil principal $product_id = JRequest::getVar('jshopping_product_id', $this->product->jshopping_product_id); // id do produto // verifica pela view do carrinho if ($view != 'cart') { $product_model = VmModel::getModel('product'); $jshopping_product_idArray = $product_id; if (is_array($jshopping_product_idArray)) { $jshopping_product_id = $jshopping_product_idArray[0]; } else { $jshopping_product_id = $jshopping_product_idArray; } $product = $product_model->getProduct($jshopping_product_id); $preco_produto = $product->prices['salesPrice']; $cart->products = array(); $cart->products[$jshopping_product_id] = $product; $cart->products[$jshopping_product_id]->quantity = 1; $cart->pricesUnformatted = array(); $cart->pricesUnformatted["salesPrice"] = $preco_produto; $cart->pricesUnformatted['billTotal'] = $preco_produto; } else { $preco_produto = 0; foreach($cart->products as $k => $produto) { $preco_produto += $cart->pricesUnformatted[$k]['salesPrice']; } } $shipments_shipment_rates = array(); if (!class_exists('vmPSPlugin')) require(JPATH_VM_PLUGINS . DS . 'vmpsplugin.php'); JPluginHelper::importPlugin('vmshipment'); $dispatcher = JDispatcher::getInstance(); $selectedShipment = false; $returnValues = $dispatcher->trigger('plgVmDisplayListFEShipment', array( $cart, $selectedShipment, &$shipments_shipment_rates)); if (empty($shipments_shipment_rates)) { echo 'Método de envio configurado errado.'; } else { foreach($shipments_shipment_rates as $entregas) { foreach ($entregas as $metodo_envio) { echo '<div>'; echo $metodo_envio; echo '</div>'; } } } /* $_POST['quantity']=$quantidade_anterior; $cart->updateProductCart($product_id); */ } else { echo 'Erro: Cep inválido'; } die(); solu____o_integrada___manual_do_desenvolvedor_v1_0.pdf
Joomla: 3.4.5
JoomShopping: 4.11.2 PHP: 5.5.12 |