public function afterIteration(array $list) { $list = parent::afterIteration($list); /* [quantity] => Array ( [78] => 10 [79] => 2 [80] => 1 [81] => 1 [83] => 2 ) */ $processors_path = dirname(dirname(dirname(dirname(__FILE__)))) . '/'; $products = (array) $this->getProperty('quantity'); foreach ($list as &$l) { $order_product_id = $l['id']; if (isset($products[$order_product_id])) { $quantity = (int) $products[$order_product_id]; if ($quantity != $l['quantity']) { $this->modx->error->reset(); $properties = array('product_key' => $order_product_id, 'quantity' => $quantity); if (!($response = $this->modx->runProcessor("basket/web/orders/products/update", $properties, array("processors_path" => $processors_path)))) { $error = "Ошибка выполнения запроса"; $this->modx->log(xPDO::LOG_LEVEL_ERROR, __CLASS__ . " - {$error}"); $this->modx->log(xPDO::LOG_LEVEL_ERROR, print_r($this->getProperties(), true)); $this->modx->log(xPDO::LOG_LEVEL_ERROR, print_r($properties, true)); } else { if ($response->isError()) { $error = $response->getMessage(); $this->modx->log(xPDO::LOG_LEVEL_ERROR, __CLASS__ . " - {$error}"); $this->modx->log(xPDO::LOG_LEVEL_ERROR, print_r($this->getProperties(), true)); $this->modx->log(xPDO::LOG_LEVEL_ERROR, print_r($response->getResponse(), true)); } else { $l['quantity'] = $quantity; } } } } } return $list; }