V
V
Vitaly2021-02-05 23:36:59
MODX
Vitaly, 2021-02-05 23:36:59

How to get the ID of the items added to the cart?

Good evening!

I am developing a site on modx/minishop. There was a need to get the ID of the goods in the basket.
I tried to do this through the msCart snippet, and at the output I got a placeholder with an array of string type.

How can I do that? Any ideas?
I will be glad for any help. Thank you in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arthur Sh, 2021-02-06
@vnem

Two arrays $products and $total come to the cart, respectively, to get the product id, you need to loop through the $products array approximately

{foreach $products as $product}
{$product.id}
Чтобы увидеть все данные
{$product | print_r}
{/foreach }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question