Сейчас я беру с таблицы oc_order всю информацию о заказе, это: адрес, телефон, и т.к.
$result_for_sal = $this->db->query("SELECT * FROM oc_order_product WHERE order_id = (SELECT order_id FROM oc_order_product ORDER BY order_product_id DESC LIMIT 1)");
$fileName = $result_for_sal->row['order_id'].".sal";
$id = $result_for_sal->row['order_id'];
$result_for_base_sm = $this->db->query("SELECT * FROM oc_order WHERE order_id = '$id'");
$firstname = $result_for_base_sm->row["payment_firstname"].' '.$result_for_base_sm->row["payment_lastname"];
$telephone = $result_for_base_sm->row["telephone"];
$country = $result_for_base_sm->row["payment_country"];
$region = $result_for_base_sm->row["payment_zone"];
$city = $result_for_base_sm->row["payment_city"];
$address = $result_for_base_sm->row["payment_address_1"];
$email = $result_for_base_sm->row["email"];
$comment = $result_for_base_sm->row["comment"];
$points = $result_for_sals->row["points"];
$points = $result_for_salss->row["price"];
$sale_for = $result_for_base_sm->row["payment_method"];
$sale_for = strip_tags($sale_for);
$str = <<<EOD
[Client]
Name= $firstname
MPhone= $telephone
CPhone=
ZIP=
Country= $country
Region= $region
City= $city
Address= $address
EMail= $email
[Options]
SaleType=1
Comment= $comment
OrderNumber= $id
DeliveryCondition= $sale_for
ReserveDate=
EOD;
for($i = 0; $i<count($result_for_sal->rows); $i++) {
$points = $result_for_sal->rows[$i]['points'];
$price = $result_for_sal->rows[$i]['price'];
$counts = $result_for_sal->rows[$i]['quantity'];
$str .= <<<EOD
\n[$i]
GoodID=$points
Price=$price
Count=$counts
EOD;
}
$str = iconv("UTF-8", "Windows-1251", $str);
file_put_contents('Orders/'.$fileName,$str);
Только вот сюда нужно вывести информацию уже с другой таблицы :
$points = $result_for_sal->rows[$i]['points'];
$price = $result_for_sal->rows[$i]['price'];
points - это баллы в OC
price - это цена опции в OC
Или как это правильно организовать? Points - это я выбрал как уникальный ID опции, чтобы не создавать доп., поле.