本文整理汇总了PHP中Cabinet::get_a_detailed_specifications方法的典型用法代码示例。如果您正苦于以下问题:PHP Cabinet::get_a_detailed_specifications方法的具体用法?PHP Cabinet::get_a_detailed_specifications怎么用?PHP Cabinet::get_a_detailed_specifications使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cabinet
的用法示例。
在下文中一共展示了Cabinet::get_a_detailed_specifications方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: die
//.........这里部分代码省略.........
}
}
}
}
}
if (isset($reload['flag']) && $reload['flag'] == true) {
header('Location:' . HOST . '/?' . $_SERVER['QUERY_STRING']);
exit;
}
// Вставляем ряд в таблицу KP_MAIN_ROWS
$query = "SELECT*FROM `" . RT_MAIN_ROWS . "` WHERE id = '" . $key . "'";
//echo $query;
$rt_main_row_id = $key;
$result = $mysqli->query($query) or die($mysqli->error);
if ($result->num_rows > 0) {
$row = $result->fetch_assoc();
$description = $row['description'] != '' ? 'описание: ' . $row['description'] : '';
if ($row['characteristics'] != '') {
$arr = json_decode($row['characteristics'], TRUE);
$ch_arr = array();
foreach ($arr as $key => $data) {
if ($key == 'colors') {
$ch_arr[] = 'цвет: ' . implode(', ', $data);
}
if ($key == 'materials') {
$ch_arr[] = 'материал: ' . implode(', ', $data);
}
}
$characteristics = count($ch_arr) > 0 ? implode('<br>', $ch_arr) : '';
} else {
$characteristics = '';
}
$query2 = "INSERT INTO `" . KP_MAIN_ROWS . "` \n\t\t\t\t\t\t\t SET \n\t\t\t\t\t\t\t `kp_id` = '" . $kp_id . "',\n\t\t\t\t\t\t\t `sort` = '" . $row['sort'] . "',\n\t\t\t\t\t\t\t `art` = '" . $row['art'] . "',\n\t\t\t\t\t\t\t `type` = '" . $row['type'] . "',\n\t\t\t\t\t\t\t `art_id` = '" . $row['art_id'] . "',\n\t\t\t\t\t\t\t `name` = '" . $row['name'] . "',\n\t\t\t\t\t\t\t `description` = '" . $row['description'] . "',\n\t\t\t\t\t\t\t `characteristics` = '" . mysql_real_escape_string($characteristics) . "',\n\t\t\t\t\t\t\t `img_folder` = '" . ($row['img_type'] == 'g_std' ? 'img' : $row['img_folder']) . "'\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t ";
$result2 = $mysqli->query($query2) or die($mysqli->error);
$row_id = $mysqli->insert_id;
// копируем выбранные для КП изображения
$query7 = "SELECT * FROM `" . RT_MAIN_ROWS_GALLERY . "` WHERE `parent_id` = '" . $rt_main_row_id . "';";
$result7 = $mysqli->query($query7) or die($mysqli->error);
// echo $query7.'<br>';
// echo '<pre>';
// print_r($result7);
// echo '</pre>';
$choosen_img_arr = array();
if ($result7->num_rows > 0) {
while ($row7 = $result7->fetch_assoc()) {
// $row7 = $result7->fetch_assoc();
$choosen_img_arr[] = $row7;
}
}
// echo '<pre>';
// print_r($choosen_img_arr);
// echo '</pre>';
foreach ($choosen_img_arr as $key => $row7) {
$query8 = "INSERT INTO `" . KP_MAIN_ROWS_GALLERY . "` \n\t\t\t\t\t\t\t SET \n\t\t\t\t\t\t\t `parent_id` = '" . $row_id . "',\n\t\t\t\t\t\t\t `img_name` = '" . $row7['img_name'] . "',\n\t\t\t\t\t\t\t `folder` = '" . $row7['folder'] . "',\n\t\t\t\t\t\t\t `on` = '" . $row7['on'] . "',\n\t\t\t\t\t\t\t `sort` = '" . $row7['sort'] . "'\n\t\t\t\t\t\t\t ";
// echo $query8.'<br>';
$result8 = $mysqli->query($query8) or die($mysqli->error);
}
// Проходим по второму уровню массива
foreach ($dop_data as $dop_key => $dop_val) {
//echo $dop_key.',';
// Вставляем ряд в таблицу KP_DOP_DATA
$query3 = "SELECT*FROM `" . RT_DOP_DATA . "` WHERE id = '" . $dop_key . "'";
//echo $query;
$result3 = $mysqli->query($query3) or die($mysqli->error);
if ($result3->num_rows > 0) {
$row3 = $result3->fetch_assoc();
if ($row['type'] != 'cat') {
include_once ROOT . "/libs/php/classes/os_form_class.php";
include_once ROOT . "/libs/php/classes/cabinet/cabinet_class.php";
//os_form_class.php
$cabinet = new Cabinet();
$details = $cabinet->get_a_detailed_specifications($row['type'], $row3['no_cat_json']);
$details = strip_tags($details, '<div><br><br/><br />');
$details = str_replace(array('<div>', '</div>'), array('<br>', ''), $details);
$details = str_replace(array("\n", "\r", "\t"), '', $details);
$details = str_replace('<br><br>', '<br>', $details);
$details = preg_replace('/<div[^<]+>/', '', $details);
$details = $row['name'] . '<br>' . $details;
} else {
$details = '';
}
$query4 = "INSERT INTO `" . KP_DOP_DATA . "` \n\t\t\t\t\t\t\t\t\t SET \n\t\t\t\t\t\t\t\t\t `row_id` = '" . $row_id . "',\n\t\t\t\t\t\t\t\t\t `expel` = '" . $row3['expel'] . "',\n\t\t\t\t\t\t\t\t\t `shipping_time` = '" . $row3['shipping_time'] . "',\n\t\t\t\t\t\t\t\t\t `shipping_date` = '" . $row3['shipping_date'] . "',\n\t\t\t\t\t\t\t\t\t `quantity` = '" . $row3['quantity'] . "',\n\t\t\t\t\t\t\t\t\t `price_in` = '" . $row3['price_in'] . "',\n\t\t\t\t\t\t\t\t\t `price_out` = '" . $row3['price_out'] . "',\n\t\t\t\t\t\t\t\t\t `discount` = '" . $row3['discount'] . "',\n\t\t\t\t\t\t\t\t\t `details` = '" . $details . "',\n\t\t\t\t\t\t\t\t\t `dop_men_text_details` = '" . $row['id'] . "|" . $dop_key . "',\n\t\t\t\t\t\t\t\t\t `tirage_str` = '" . Com_pred::convertTirageJSON($row3['tirage_json']) . "' \n\t\t\t\t\t\t\t\t\t ";
$result4 = $mysqli->query($query4) or die($mysqli->error);
$dop_row_id = $mysqli->insert_id;
// Вставляем ряд в таблицу KP_DOP_USLUGI
$query5 = "SELECT*FROM `" . RT_DOP_USLUGI . "` WHERE dop_row_id = '" . $row3['id'] . "'";
//echo $query;
$result5 = $mysqli->query($query5) or die($mysqli->error);
if ($result5->num_rows > 0) {
while ($row5 = $result5->fetch_assoc()) {
$query6 = "INSERT INTO `" . KP_DOP_USLUGI . "` \n\t\t\t\t\t\t\t\t\t\t SET \n\t\t\t\t\t\t\t\t\t\t `dop_row_id` = '" . $dop_row_id . "',\n\t\t\t\t\t\t\t\t\t\t `uslugi_id` = '" . $row5['uslugi_id'] . "',\n\t\t\t\t\t\t\t\t\t\t `glob_type` = '" . $row5['glob_type'] . "',\n\t\t\t\t\t\t\t\t\t\t `type` = '" . $row5['type'] . "',\n\t\t\t\t\t\t\t\t\t\t `quantity` = '" . $row5['quantity'] . "',\n\t\t\t\t\t\t\t\t\t\t `price_in` = '" . $row5['price_in'] . "',\n\t\t\t\t\t\t\t\t\t\t `price_out` = '" . $row5['price_out'] . "',\n\t\t\t\t\t\t\t\t\t\t `discount` = '" . $row5['discount'] . "',\n\t\t\t\t\t\t\t\t\t\t `for_how` = '" . $row5['for_how'] . "',\n\t\t\t\t\t\t\t\t\t\t `other_name` = '" . $row5['other_name'] . "',\n\t\t\t\t\t\t\t\t\t\t `print_details` = '" . $row5['print_details'] . "' \n\t\t\t\t\t\t\t\t\t\t ";
$result6 = $mysqli->query($query6) or die($mysqli->error);
}
}
}
}
}
}
return '1';
}
示例2: MAX
static function add_items_for_specification($dateDataObj, $specification_num, $rows_data, $client_id, $agreement_id, $agreement_date, $our_firm_acting_manegement_face, $client_firm_acting_manegement_face, $date, $short_description, $address, $prepayment)
{
global $mysqli;
// print_r($dateDataObj);
// exit;
if (!$specification_num) {
$query = "SELECT MAX(specification_num) specification_num FROM `" . GENERATED_SPECIFICATIONS_TBL . "` WHERE agreement_id = '" . $agreement_id . "'";
$result = $mysqli->query($query) or die($mysqli->error);
if ($result->num_rows > 0) {
$row = $result->fetch_assoc();
$specification_num = $row['specification_num'] + 1;
} else {
$specification_num = 1;
}
}
$date_arr = explode('.', $date);
$date = $date_arr[2] . '-' . $date_arr[1] . '-' . $date_arr[0];
$rows_data_arr = json_decode($rows_data);
// echo $specification_num.'<pre>'; print_r($rows_data_arr); echo '</pre>';//
// exit;
// настройки в завасимости от типа спецификации
$dates_data = self::date_terms_convert($dateDataObj);
$shipping = '0000-00-00 00:00:00';
foreach ($rows_data_arr as $data_arr) {
if (count($data_arr) == 0) {
continue;
}
$summ_out = 0;
$uslugi_summ_out = 0;
$main_id = $data_arr->pos_id;
$dop_id = $data_arr->row_id;
$query = "SELECT*FROM `" . RT_MAIN_ROWS . "` WHERE `id` = '" . $main_id . "'";
// echo $query."\r\n";
$result = $mysqli->query($query) or die($mysqli->error);
if ($result->num_rows > 0) {
// 1). main_data
$main_data = $result->fetch_assoc();
$query2 = "SELECT*FROM `" . RT_DOP_DATA . "` WHERE `id` = '" . $dop_id . "'";
// echo $query."\r\n";
$result2 = $mysqli->query($query2) or die($mysqli->error);
if ($result2->num_rows > 0) {
// 2). dop_data
$dop_data = $result2->fetch_assoc();
$expel = array("main" => 0, "print" => 0, "dop" => 0);
if (@$dop_data['expel'] != '') {
$obj = @json_decode($dop_data['expel']);
foreach ($obj as $expel_key => $expel_val) {
$expel[$expel_key] = $expel_val;
}
}
$summ_out = $dop_data['quantity'] * $dop_data['price_out'];
$name = ($main_data['art'] != '' ? 'арт.' . $main_data['art'] : '') . " " . $main_data['name'];
$price = $dop_data['price_out'];
// прежде чем записать ряд в спецификацию сверим совпадает ли количество в расчете и в услугах
// для этого делаем дополнительный запрос к таблице RT_DOP_USLUGI, далее после добавления ряда
// будет такойже запрос к таблице RT_DOP_USLUGI но уже чтобы добавить доп услуги в спецификацию
$query2_dop = "SELECT*FROM `" . RT_DOP_USLUGI . "` WHERE `dop_row_id` = '" . $dop_id . "' ORDER BY glob_type";
// echo $query."\r\n";
$result2_dop = $mysqli->query($query2_dop) or die($mysqli->error);
if ($result2_dop->num_rows > 0) {
while ($uslugi_data = $result2_dop->fetch_assoc()) {
if ($uslugi_data['glob_type'] == 'print' && $uslugi_data['quantity'] != $dop_data['quantity']) {
$reload['flag'] = true;
//echo $dop_data['quantity'];
include_once ROOT . "/libs/php/classes/rt_calculators_class.php";
$json_out = rtCalculators::change_quantity_and_calculators($dop_data['quantity'], $dop_data['id'], 'true', 'false');
$json_out_obj = json_decode($json_out);
// если расчет не может быть произведен по причине outOfLimit или needIndividCalculation
// сбрасываем количество тиража и нанесения до 1шт.
if (isset($json_out_obj->print->outOfLimit) || isset($json_out_obj->print->needIndividCalculation)) {
rtCalculators::change_quantity_and_calculators(1, $dop_data['id'], 'true', 'false');
$query = "UPDATE `" . RT_DOP_DATA . "` SET `quantity` = '1' WHERE `id` = '" . $dop_data['id'] . "'";
$result = $mysqli->query($query) or die($mysqli->error);
}
}
/**/
if ($uslugi_data['glob_type'] == 'extra' && $uslugi_data['quantity'] != $dop_data['quantity']) {
$query = "UPDATE `" . RT_DOP_USLUGI . "` SET `quantity` = '" . $dop_data['quantity'] . "' WHERE `id` = '" . $uslugi_data['id'] . "'";
$result = $mysqli->query($query) or die($mysqli->error);
$uslugi_data['quantity'] = $dop_data['quantity'];
}
}
}
if (isset($reload['flag']) && $reload['flag'] == true) {
header('Location:' . HOST . '/?' . $_SERVER['QUERY_STRING']);
exit;
}
if ($main_data['type'] != 'cat') {
include_once ROOT . "/libs/php/classes/os_form_class.php";
include_once ROOT . "/libs/php/classes/cabinet/cabinet_class.php";
//os_form_class.php
$cabinet = new Cabinet();
$details = $cabinet->get_a_detailed_specifications($main_data['type'], $dop_data['no_cat_json']);
$details = strip_tags($details, '<div><br><br/><br />');
$details = str_replace(array('<div>', '</div>'), array('<br>', ''), $details);
$details = str_replace(array("\n", "\r", "\t"), '', $details);
$details = str_replace('<br><br>', '<br>', $details);
$details = preg_replace('/<div[^<]+>/', '', $details);
$name .= $details;
}
//.........这里部分代码省略.........