12121

← разместить еще код

Расшаренный код:

<?php
$msoptionsprice = $modx->getService('msoptionsprice');
$msoptionsprice->initialize('web');

$modifications = array(
    array(
        'name'    => 'R20x10 charcoal 72',
        'price'   => '1000',
        'options' => array(
            'wheel_size' => 'R20',
            'wheel_width' => '10.0',
            'wheel_ET' => '40',
            'wheel_PCD' => '5 x 120',
            'wheel_DIA' => '72.6',
            'wheel_color' => 'satin charcoal'
        )
    ),
    array(
        'name'    => 'R20x10 charcoal 74',
        'price'   => '2000',
        'options' => array(
            'wheel_size' => 'R20',
            'wheel_width' => '10.0',
            'wheel_ET' => '40',
            'wheel_PCD' => '5 x 120',
            'wheel_DIA' => '74.1',
            'wheel_color' => 'satin charcoal'
        )
    ),
);

/* идентификатор продукта */
$rid = 16;

$modifications = $modx->call('msopModification', 'saveProductModification', array(&$modx, $rid, $modifications));