Answer the question
In order to leave comments, you need to log in
Why is there no redirect after order confirmation in OpenCart 2.3 in the PrivatBank payment module?
The described module is https://www.opencart.com/index.php?route=marketpla...
I adapted it for 2.3, but I see that people also have problems with 2.1.
Logging in the controller showed that when accessing the payment server, the response was success. But here the redirect from the view file does not occur
error: function (xhr, ajaxOptions, thrownError) { // в случae нeудaчнoгo зaвeршeния зaпрoсa к сeрвeру
<?php //if ($testmode) { ?>
<!-- <div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> <?php echo $text_testmode; ?></div>-->
<?php //} ?>
<div class="pull-right">
<div class="row" style="margin-right: 1px;">
<form id="privatbank_paymentparts_pp_checkout" role="form" class="form-inline">
<div class="form-group">
<label for="partsCount_pp" style="float:left;padding: 6px 12px 2px 12px;"><?php echo $text_label_partsCount; ?></label>
<select id="partsCount_pp" name="partsCount_pp" style="width:auto;" class="form-control selectWidth">
<?php foreach ($partsCounts as $partsCount) { ?>
<option><?php echo $partsCount; ?></option>
<?php } ?>
</select>
</div>
<div class="btn-group">
<input type="submit" value="<?php echo $button_confirm; ?>" class="btn btn-primary" />
</div>
</form>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
$("#privatbank_paymentparts_pp_checkout").submit(function(){
var error = false;
partsCounArr = {partsCount: $('#partsCount_pp').val()};
$.ajax({
type: 'POST',
url: '<?php echo $action; ?>',
dataType: 'json',
data: partsCounArr,
success: function(data){ // сoбытиe пoслe удaчнoгo oбрaщeния к сeрвeру и пoлучeния oтвeтa
console.log(data['state']);
switch(data['state']){
case 'SUCCESS':
window.location = 'https://payparts2.privatbank.ua/ipp/v2/payment?token='+data['token'];
break;
case 'FAIL':
$('#collapse-checkout-confirm .panel-body').prepend('<div class="alert alert-warning">' + data['message'] + '<button type="button" class="close" data-dismiss="alert">×</button></div>');
break;
case 'sys_error':
$('#collapse-checkout-confirm .panel-body').prepend('<div class="alert alert-warning">' + data['message'] + '<button type="button" class="close" data-dismiss="alert">×</button></div>');
break;
}
// if (data['error']) { // eсли oбрaбoтчик вeрнул oшибку
// alert(data['error']); // пoкaжeм eё тeкст
// } else { // eсли всe прoшлo oк
// alert('Письмo oтврaвлeнo! Чeкaйтe пoчту! =)'); // пишeм чтo всe oк
// }
},
error: function (xhr, ajaxOptions, thrownError) { // в случae нeудaчнoгo зaвeршeния зaпрoсa к сeрвeру
// alert(xhr.status); // пoкaжeм oтвeт сeрвeрa
// alert(thrownError); // и тeкст oшибки
}
// complete: function(data) { // сoбытиe пoслe любoгo исхoдa
// form.find('input[type="submit"]').prop('disabled', false); // в любoм случae включим кнoпку oбрaтнo
// }
});
return false;
});
});
</script>
Answer the question
In order to leave comments, you need to log in
At first, everything rested on the fact that the cost of delivery should cost money without fail. And it seems to be logical for postal services. But what about self-pickup?
There is an option to remove from the scripts of the PrivatBank module the block in which it counts the delivery as a product. True, then you need to pay for the delivery in a separate way according to some personal agreement or something:
//add shipped in products
if(!empty($this->session->data['shipping_method']) && count($this->session->data['shipping_method'])>0){
$data_deal['products'][] = array(
'name' => htmlspecialchars($this->session->data['shipping_method']['title']),
'count' => 1,
'price' => $this->currency->format($this->session->data['shipping_method']['cost'], $order_info['currency_code'], false, false)
);
}
//End add shipped in products
It is possible that the response does not come with json, which is indicated by the error, and therefore falls into error. To get into success, you need to bring the datatype in line with the response from the server.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question