K
K
kyctaphik2022-02-01 15:16:37
PHP
kyctaphik, 2022-02-01 15:16:37

Opencart How to display cart amount in cart?

On the opencart 3 cart page, I need to display the cart amount using a variable from the cart.php controller, then I want to manipulate it, namely, divide by 1000 to calculate the number of gifts, but this is not so important, the problem is that, I already tried a hundred times to display my variable, but it is always empty. I tried this: it $data['privet'] = $this->cart->getSubTotal();returns an empty value, then I spied on how the amount of goods in the basket is displayed, {{ product.total }I try to display it for the sake of experiment, but to no avail, an empty value is displayed, I also tried to pass any string to a variable and display it to understand whether it works at all or not, but nothing output, empty string:$data['privet'] = 'hello';. I tried to rearrange this variable in different places in the cart.php controller file, but it didn’t work (I can’t understand what the problem is because I displayed the cost of the cart in the header, $data['privet'] = $this->cart->getSubTotal();this design in the controller and {{ privet }}in the template was enough, everything works properly, but in no basket.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question