S
S
sasha2019-10-22 19:50:57
MODX
sasha, 2019-10-22 19:50:57

How to get data from minishop2 cart in modx revo snippet?

Hello. Please tell me how to get data from the cart in your snippet, namely from msOrder ... for example, the total amount ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor, 2019-10-31
@sashko2307

More or less like this:

<?php
$miniShop2 = $modx->getService('miniShop2');
$miniShop2->initialize($modx->context->key);

$cart = $miniShop2->cart->get(); // товары корзины
$order = $miniShop2->order->get(); // заказ
$status = $miniShop2->cart->status(); // статус корзины

$cost = $miniShop2->order->getCost();
$order['cost'] = $miniShop2->formatPrice($cost['data']['cost']);

More details in the documentation: https://docs.modx.pro/komponentyi/minishop2/razrab...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question