Answer the question
In order to leave comments, you need to log in
How to form an array of ordered products in a snippet?
Tell me how in the snippet you can get a list of products from a specific order (minishop2) in the form of such an array
$prods = array(
array(
'name' => 'Плита CERAMAGUARD FINE FISSURED (100 RH) 600*600*15',
'count' => 25,
'price' => 1210,
'nds' => 18,
),
array(
'name' => 'Европодвес (0.5м)',
'count' => 100,
'price' => 5.50,
'nds' => 0,
),
array(
'name' => 'Профиль 20*20',
'count' => 10,
'price' => 550,
'nds' => 10,
),
);
Answer the question
In order to leave comments, you need to log in
$order_id = 1; // ID Заказа
/** Вот так получить список всех товаров конкретного заказа: **/
$q = $modx->prepare("SELECT * FROM ".$modx->getOption('table_prefix')."ms2_order_products WHERE order_id=".$order_id);
$q->execute();
$results = $q->fetchAll(PDO::FETCH_ASSOC);
/** Вот так получить сам заказ: **/
$order = $modx->getObject('msOrder', $order_id)->toArray();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question