Добрый день форумчане. Подскажите пожалуйста как можно добавить новое поле в массив $products в cart.tpl.
Это поле находиться в oc_cart столбик option. Пытался добавить его в \system\library\cart.php но после добавление нового поля не видно. выглядит примерно так:
cart.php -> функция getproducts()
$product_data[] = array(
'design_file' => $cart['option'],
'cart_id' => $cart['cart_id'],
'product_id' => $product_query->row['product_id'],
'name' => $product_query->row['name'],
'model' => $product_query->row['model'],
'shipping' => $product_query->row['shipping'],
'image' => $product_query->row['image'],
'option' => $option_data,
'download' => $download_data,
'quantity' => $cart['quantity'],
'minimum' => $product_query->row['minimum'],
'subtract' => $product_query->row['subtract'],
'stock' => $stock,
'price' => ($price + $option_price),
'total' => ($price + $option_price) * $cart['quantity'],
'reward' => $reward * $cart['quantity'],
'points' => ($product_query->row['points'] ? ($product_query->row['points'] + $option_points) * $cart['quantity'] : 0),
'tax_class_id' => $product_query->row['tax_class_id'],
'weight' => ($product_query->row['weight'] + $option_weight) * $cart['quantity'],
'weight_class_id' => $product_query->row['weight_class_id'],
'length' => $product_query->row['length'],
'width' => $product_query->row['width'],
'height' => $product_query->row['height'],
'length_class_id' => $product_query->row['length_class_id'],
'recurring' => $recurring
);
тут поле option я заполняю сам, своими значениями и названием полей. Стоит ли создать отдельный столбик в oc_cart для этого?
cart.tpl :
<?php print_r($products[0]); ?>
результат такой:
Array ( [cart_id] => 29 [thumb] => http://104.236.136.140/image/cache/catalog/Products/dg-designer-d210cf37146247065412058767810826745-47x47.png [name] => TshirtDanil [model] => TshirtDanil [option] => Array ( ) [recurring] => [quantity] => 3 [stock] => 1 [reward] => [price] => $21.00 [total] => $63.00 [href] => http://104.236.136.140/index.php?route=product/product&product_id=89 )
А ожидаю такое:
Array ([design_file] => usersdesign-12343434.png [cart_id] => 29 [thumb] => http://104.236.136.140/image/cache/catalog/Products/dg-designer-d210cf37146247065412058767810826745-47x47.png [name] => TshirtDanil [model] => TshirtDanil [option] => Array ( ) [recurring] => [quantity] => 3 [stock] => 1 [reward] => [price] => $21.00 [total] => $63.00 [href] => http://104.236.136.140/index.php?route=product/product&product_id=89 )
Вот так выглядит запись в БД:
Заранее спасибо за помощь :oops: .
P.S. как ни странно такой вариант работает:
$product_data[] = array(
'cart_id' => $cart['option'],
'product_id' => $product_query->row['product_id'],
'name' => $product_query->row['name'],
.........................
);