D
D
Darkhan Kamaliev2018-04-23 22:12:18
opencart
Darkhan Kamaliev, 2018-04-23 22:12:18

How to get the total value in the cart to send to the payment aggregator widget?

There is a code (bank_transfer.tpl - added a handler to the button):

<script >
var amount =    \\тут проблема
  button.onclick = function() {
    var widget = new cp.CloudPayments();
  widget.charge({ // options
    publicId : 'pk', //id из личного кабинета
    description : 'Оплата товаров Shone.kz', //назначение
    amount : amount, //сумма
    currency : 'KZT', //валюта
    invoiceId : '1234567', //номер заказа  (необязательно)
    accountId : '[email protected]', //идентификатор плательщика (необязательно)
    data : {
      myProp : 'myProp value' //произвольный набор параметров
    }
  })
  };
</script>

I'm not familiar with the MVC model and OOP in general, and the code is driving me to the grave.
How to pass the total amount of the cart order to this js code in opencart 2?
What is the easiest way to get the value of a variable? (Total amount of goods)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
zoozag, 2018-04-25
@zoozag

What is the easiest way to get the value of a variable?

You can even pull it out from the front, since it’s a js script.
But why do you need a widget when there is a ready-made integration for Opencart

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question