T
T
Tutucu2018-09-18 18:07:19
MODX
Tutucu, 2018-09-18 18:07:19

How to programmatically change resource group in MODX Revo?

Hello, I'm uploading products from csv to MODX Revo MINISHOP 2. I wrote a snippet that creates and updates products, but the problem is that product discounts are based on resource groups, i.e. the product is assigned a group of 5%, and the discount is accordingly calculated by 5%. And here the question arises - how to programmatically specify the resource group to which it belongs?
Displayed all the values ​​of the resource:

$res = $modx->getObject('modResource',373);
$output = $res->toArray();

But there is no meaning of groups there. I didn't find anything about it in the documentation either.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor, 2018-09-27
@Tutucu

In any unclear situation, see the diagram: https://github.com/modxcms/revolution/blob/2.x/cor...

$res = $modx->getObject('modResource',373);
$group = $res->getOne('ResourceGroupResources');
$output = $group->toArray();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question