Trying to unload goods from the store's basket using PHPExcel
$export_cart_products = $_SESSION['cart']['products']; foreach ($export_cart_products as $key => $row) { $phpexcel->getActiveSheet()->setCellValue("A$i", $row['product_id']); $string = $row['product']; $phpexcel->getActiveSheet()->setCellValueExplicit("B$i", $string, PHPExcel_Cell_DataType::TYPE_STRING); $phpexcel->getActiveSheet()->setCellValue("C$i", $row['price']); $phpexcel->getActiveSheet()->setCellValue("D$i", $row['amount']); $result_array = array(); foreach ($row['product_options'] as $option_id => $variant_id) { $option_name = db_get_fields("SELECT option_name FROM ?:product_options_descriptions WHERE option_id = ?i", $option_id, $variant_id, CART_LANGUAGE); $variant_name = db_get_fields("SELECT variant_name FROM ?:product_option_variants_descriptions WHERE variant_id = ?i", $variant_id, $option_id, CART_LANGUAGE); }; __ placeholders?: replaced by the value of cscart_
in the second foreach I try to display options for the product, options come in the form of an array
array = [4] => 34, [3] => 12 each key and each value is the name of "color", "size", "XXL (large size)", "Blue", "Red", etc. accordingly, you need a query to the database in order to display them (I suspect that my query to the database is not entirely correct). Now we only get the version with one pair "Color: Blue" or "size: XL", but the product has several such values (color, size ...).
How to make it so that it displays all the options of the goods.
Completely confused, but the project must be done. xls is correctly stored, only without options, and options are needed.