if (!empty($thumbsSelect)) { $select .= ',' . implode(',', $thumbsSelect); } $default = array('class' => 'msOrderProduct', 'where' => '{"msOrderProduct.order_id":"' . $id . '"}', 'leftJoin' => '[' . $leftJoin . ']', 'select' => '{' . $select . '}', 'sortby' => 'id', 'sortdir' => 'ASC', 'groupby' => 'msOrderProduct.id', 'fastMode' => false, 'limit' => 0, 'return' => 'data', 'nestedChunkPrefix' => 'minishop2_'); // Merge all properties and run! $scriptProperties['tpl'] = $scriptProperties['tplRow']; $pdoFetch->setConfig(array_merge($default, $scriptProperties)); $rows = $pdoFetch->run(); /* @var msOrderProduct $row */ foreach ($rows as $row) { $outer['cart_count'] += $row['count']; $row['old_price'] = $miniShop2->formatPrice($row['original_price'] != $row['price'] ? $row['original_price'] : $row['old_price']); $row['price'] = $miniShop2->formatPrice($row['price']); $row['cost'] = $miniShop2->formatPrice($row['cost']); $row['weight'] = $miniShop2->formatWeight($row['weight']); // Additional properties of product $options = !is_array($row['options']) ? $modx->fromJSON($row['options']) : $row['options']; if (!empty($options) && is_array($options)) { foreach ($options as $key => $value) { $row['option.' . $key] = $value; } } $row['idx'] = $pdoFetch->idx++; $tplRow = $pdoFetch->defineChunk($row); $outer['goods'] .= empty($tplRow) ? $pdoFetch->getChunk('', $row) : $pdoFetch->getChunk($tplRow, $row, $pdoFetch->config['fastMode']); } if (empty($tplOuter)) { $modx->setPlaceholders($outer); } else { return $pdoFetch->getChunk($tplOuter, $outer); }