本文整理汇总了PHP中app\models\Product::updatingListProducts方法的典型用法代码示例。如果您正苦于以下问题:PHP Product::updatingListProducts方法的具体用法?PHP Product::updatingListProducts怎么用?PHP Product::updatingListProducts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Product
的用法示例。
在下文中一共展示了Product::updatingListProducts方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
//.........这里部分代码省略.........
foreach ($childs as $child) {
$res[$child['product_id']]['MK.price'] = $res[$element['id']]['MK.price'] * $child['multiplicator'];
$res[$child['product_id']]['MK.to_export'] = 1;
}
}
}
//MK_price_currency
if ($element['MK_price_currency']['new'] != $element['MK_price_currency']['old']) {
$res[$element['id']]['MK.currency'] = $element['MK_price_currency']['new'];
if ($childs) {
foreach ($childs as $child) {
$res[$child['product_id']]['MK.currency'] = $res[$element['id']]['MK.currency'];
$res[$child['product_id']]['MK.to_export'] = 1;
}
}
}
//MK update
if (isset($res[$element['id']]['products.in_stock']) or isset($res[$element['id']]['MK.enabled']) or isset($res[$element['id']]['MK.yandex_enabled']) or isset($res[$element['id']]['MK.price']) or isset($res[$element['id']]['MK.currency'])) {
$res[$element['id']]['MK.to_export'] = 1;
$res[$element['id']]['MK.updated_at'] = date('Y-m-d H:i:s');
$res[$element['id']]['MK.user_id'] = Auth::User()->id;
$res[$element['id']]['products.updated_at'] = date('Y-m-d H:i:s');
$res[$element['id']]['products.user_id'] = Auth::User()->id;
}
}
//product update
if (isset($res[$element['id']]['products.status']) or isset($res[$element['id']]['products.name']) or isset($res[$element['id']]['products.article']) or isset($res[$element['id']]['products.in_stock']) or isset($res[$element['id']]['products.mrc']) or isset($res[$element['id']]['products.mrc_currency']) or isset($res[$element['id']]['products.mrc_relation']) or isset($res[$element['id']]['products.mrc_raise_relation']) or isset($res[$element['id']]['products.price']) or isset($res[$element['id']]['products.price_currency']) or isset($res[$element['id']]['products.price_relation']) or isset($res[$element['id']]['products.price_raise_relation']) or isset($res[$element['id']]['products.target_margin']) or isset($res[$element['id']]['products.common_price'])) {
$res[$element['id']]['products.updated_at'] = date('Y-m-d H:i:s');
$res[$element['id']]['products.user_id'] = Auth::User()->id;
}
}
}
if (count($res) > 0) {
$productModel->updatingListProducts($res);
$historyModel->saveHistory('update_products', $res);
if ($reViewAbsents) {
$absentModel = new Absent();
$absents = $productModel->getAbsentsList();
$absentModel->addAbsentsList($absents);
}
Session::flash('message', GetMessages("SUCCESS_DATA_PRODUCTS_UPDATE"));
return redirect($_SERVER['HTTP_REFERER']);
} else {
Session::flash('message', GetMessages("ERROR_NO_DATA_FOR_UPDATE"));
return redirect($_SERVER['HTTP_REFERER']);
}
}
if (isset($_POST['update_product'])) {
if (!right('EditProduct')) {
abort(404);
}
//pr($_POST);
$res = array();
//status
!isset($_POST['status']['new']) ? $_POST['status']['new'] = 0 : ($_POST['status']['new'] = 1);
if ($_POST['status']['new'] != $_POST['status']['old']) {
$res[$_POST['id']]['products.status'] = $_POST['status']['new'];
}
//name
if ($_POST['name']['new'] != $_POST['name']['old']) {
$res[$_POST['id']]['products.name'] = trim($_POST['name']['new']);
}
//article
if ($_POST['article']['new'] != $_POST['article']['old']) {
$res[$_POST['id']]['products.article'] = trim($_POST['article']['new']);
}
示例2: store
//.........这里部分代码省略.........
}
//pr($res);
$i++;
}
//pr($res);
$count = [];
if (isset($res['update_prod'])) {
$count['update_prod'] = count($res['update_prod']);
}
if (isset($res['add_prod'])) {
$count['add_prod'] = count($res['add_prod']);
}
if (isset($res['add_to_GK'])) {
$count['add_to_GK'] = count($res['add_to_GK']);
}
if (isset($res['add_to_TV'])) {
$count['add_to_TV'] = count($res['add_to_TV']);
}
if (isset($res['add_to_MK'])) {
$count['add_to_MK'] = count($res['add_to_MK']);
}
if (isset($res['update_purch'])) {
$count['update_purch'] = count($res['update_purch']);
}
if (isset($res['add_purch'])) {
$count['add_purch'] = count($res['add_purch']);
}
Session::put('count', $count);
Session::put('res', $res);
//pr($res);
$cloudModel->addFile('import', $filename, $real_filename);
return redirect()->route('cloud.index');
}
} else {
Session::flash('message', GetMessages("ERROR_NO_CSV_FILE"));
return redirect()->route('cloud.index');
}
} else {
Session::flash('message', GetMessages("ERROR_NO_CSV_FILE"));
return redirect()->route('cloud.index');
}
}
if (isset($_POST['end_import'])) {
if (!right('Import')) {
abort(404);
}
$count = Session::pull('count', null);
$res = Session::pull('res', null);
//pr($res);
//pr($count);
if (isset($res['update_prod']) and count($res['update_prod']) > 0) {
$productModel->updatingListProducts($res['update_prod']);
}
if (isset($res['add_prod']) and count($res['add_prod']) > 0) {
$idsNewProducts = $productModel->createProducts($res['add_prod']);
Session::put('idsNewProducts', $idsNewProducts);
}
if (isset($res['add_to_GK']) and count($res['add_to_GK']) > 0) {
$productModel->addsToSite($res['add_to_GK'], 'GK');
}
if (isset($res['add_to_TV']) and count($res['add_to_TV']) > 0) {
$productModel->addsToSite($res['add_to_TV'], 'TV');
}
if (isset($res['add_to_MK']) and count($res['add_to_MK']) > 0) {
$productModel->addsToSite($res['add_to_MK'], 'MK');
}
if (isset($res['update_purch']) and count($res['update_purch']) > 0) {
$purchaseModel->updatePurchase($res['update_purch']);
}
if (isset($res['add_purch']) and count($res['add_purch']) > 0) {
$purchaseModel->addPurchases($res['add_purch']);
}
$historyModel->saveHistory('import', $count);
Session::flash('message', GetMessages("SUCCESS_IMPORT_COMPLETED"));
return redirect()->route('cloud.index');
}
if (isset($_POST['send_to_site'])) {
if (!right('Import')) {
abort(404);
}
//pr($_POST);
if (isset($_POST['sent_to_'])) {
$externalModel = new External();
if (isset($_POST['sent_to_']['GK'])) {
$externalModel->send('GK');
}
if (isset($_POST['sent_to_']['TV'])) {
$externalModel->send('TV');
}
if (isset($_POST['sent_to_']['GK'])) {
$externalModel->send('MK');
}
}
if (isset($_POST['clear_list'])) {
$productModel->deleteAllExport();
}
Session::flash('message', GetMessages("SUCCESS_EXTERNAL_EXPORT"));
return redirect()->route('cloud.index');
}
}