[products] => Array
(
[0] => Array
(
[id] => 193
[qty] => 11
)
[1] => Array
(
[id] => 193
[qty] => 11
)
)
[items] => Array
(
[0] => Array
(
[PRODUCT_ID] => 193
[OPTIONS] => Array
(
[OPTION_1] => 0
[OPTION_2] => 0
)
[AMOUNT] => 11
[SECTION_ID] => 6
[HISTORY_PRICE] =>
)
[1] => Array
(
[id] => 193
[qty] => 11
)
)
unction tb_send_order_to_frontpad( $order ) {
$products = [];
$products_mods = [];
$items = unserialize( $order[ 'BASKET_CONTENT' ] );
$items = array_values( $items );
$order_date = tb_get_preorder_date( $order );
$description = [];
$delivery_price = intval( $order[ 'DELIVERY_PRICE' ] );
foreach ($items as &$item) {
if ($item['PRODUCT_ID'] == 'gift' && !empty($item['GIFT_ID'])) {
$item['PRODUCT_ID'] = $item['GIFT_ID'];
}
}
foreach ( $items as $key => $item ) {
if ( empty( $item[ 'PRODUCT_ID' ] ) ) {
continue;
}
$basket_options = $item[ 'OPTIONS' ];
$product_id = str_replace('gift', '' , $item[ 'PRODUCT_ID' ]);
$gift_id = $item[ 'GIFT_ID' ];
$prop_1 = tb_get_bd_prop( $product_id, $basket_options[ 'OPTION_1' ], 0 );
$products[ $key ][ 'id' ] = $product_id . $gift_id;
if ( ! empty( $prop_1[ 'value' ] ) ) {
$products[ $key ][ 'qty' ] = $prop_1[ 'value' ];
} else {
$products[ $key ][ 'qty' ] = 1;
}
if ( ! empty( $item[ 'AMOUNT' ] ) ) {
$products[ $key ][ 'qty' ] = $products[ $key ][ 'qty' ] * $item[ 'AMOUNT' ];
}
if ( ! empty( $item[ 'OPTIONS' ][ 'OPTION_2' ] ) ) {
$prop_2 = tb_get_bd_prop( $product_id, $basket_options[ 'OPTION_2' ], 1 );
$addon_id = tb_get_addon_id( $product_id );
$products[ $key ][ 'addons' ][] = [
'id' => $addon_id,
'qty' => $prop_2[ 'value' ]
];
$products_mods[ $addon_id ] = $product_id;
}
}
$gift = unserialize( $order[ 'BASKET_CONTENT' ] );
foreach ( $gift as $key => $item ) {
$product_id = $item[ 'GIFT_ID' ];
}