当前位置: 首页>>代码示例>>PHP>>正文


PHP Products::SetProductsList4SuppliersCSV方法代码示例

本文整理汇总了PHP中Products::SetProductsList4SuppliersCSV方法的典型用法代码示例。如果您正苦于以下问题:PHP Products::SetProductsList4SuppliersCSV方法的具体用法?PHP Products::SetProductsList4SuppliersCSV怎么用?PHP Products::SetProductsList4SuppliersCSV使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Products的用法示例。


在下文中一共展示了Products::SetProductsList4SuppliersCSV方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Products

<?php

//setlocale(LC_ALL, 'ru_RU');
// ---- center ----
unset($parsed_res);
//$Page = new Page();
//$Page->PagesList();
$tpl->Assign('list_menu', $Page->list);
$Products = new Products();
$plist = $Products->SetProductsList4SuppliersCSV($_GET['orders'], $_GET['supplier']);
foreach ($plist as $key => $row) {
    $id_order[$key] = $row['id_order'];
    $art[$key] = $row['art'];
}
array_multisort($id_order, SORT_ASC, $art, SORT_ASC, $plist);
//$handle = fopen('php://output', 'w');
$handle = $GLOBALS['CONFIG']['csv_path'] . $_GET['supplier_article'] . ".csv";
//header("Content-type: application/csv; charset=Windows-1251");
//header("Content-Disposition: attachment; filename=".$_GET['supplier_article'].".csv");
//header("Pragma: no-cache");
//header("Expires: 0");
file_put_contents($handle, array(mb_convert_encoding('№ заказа', "windows-1251", "utf-8"), ';', mb_convert_encoding('арт. сайт', "windows-1251", "utf-8"), ';', mb_convert_encoding('арт. поставщика', "windows-1251", "utf-8"), ';', mb_convert_encoding('Цена', "windows-1251", "utf-8"), ';', mb_convert_encoding('Количество', "windows-1251", "utf-8"), ';', mb_convert_encoding('Ед. измерения', "windows-1251", "utf-8"), ';', mb_convert_encoding('Название', "windows-1251", "utf-8"), ';', mb_convert_encoding('Примечание', "windows-1251", "utf-8"), "\r\n"));
foreach ($plist as $p) {
    $art = explode('арт.', $p['name']);
    if ($p['id_supplier'] == $_GET['supplier']) {
        file_put_contents($handle, array(mb_convert_encoding($p['id_order'], "windows-1251", "utf-8"), ';', mb_convert_encoding($p['art'], "windows-1251", "utf-8"), ';', mb_convert_encoding(isset($art[1]) ? $art[1] : null, "windows-1251", "utf-8"), ';', mb_convert_encoding($p['price_opt_otpusk'], "windows-1251", "utf-8"), ';', mb_convert_encoding($p['opt_qty'], "windows-1251", "utf-8"), ';', mb_convert_encoding($p['units'], "windows-1251", "utf-8"), ';', mb_convert_encoding($p['name'], "windows-1251", "utf-8"), ';', mb_convert_encoding($p['note_opt'], "windows-1251", "utf-8"), "\r\n"), FILE_APPEND);
    }
    if ($p['id_supplier_mopt'] == $_GET['supplier']) {
        file_put_contents($handle, array(mb_convert_encoding($p['id_order'], "windows-1251", "utf-8"), ';', mb_convert_encoding($p['art'], "windows-1251", "utf-8"), ';', mb_convert_encoding(isset($art[1]) ? $art[1] : null, "windows-1251", "utf-8"), ';', mb_convert_encoding($p['price_mopt_otpusk'], "windows-1251", "utf-8"), ';', mb_convert_encoding($p['mopt_qty'], "windows-1251", "utf-8"), ';', mb_convert_encoding($p['units'], "windows-1251", "utf-8"), ';', mb_convert_encoding($p['name'], "windows-1251", "utf-8"), ';', mb_convert_encoding($p['note_mopt'], "windows-1251", "utf-8"), "\r\n"), FILE_APPEND);
    }
}
开发者ID:Arikito,项目名称:webking.xt,代码行数:31,代码来源:csv_suppliers.php

示例2: GenerateCSVForSupplier

 public function GenerateCSVForSupplier($orders, $supplier, $real_phone)
 {
     $Products = new Products();
     $plist = $Products->SetProductsList4SuppliersCSV($orders, $supplier);
     if (!empty($plist)) {
         foreach ($plist as $key => $row) {
             $id_order[$key] = $row['id_order'];
             $art[$key] = $row['art'];
         }
         array_multisort($id_order, SORT_ASC, $art, SORT_ASC, $plist);
     }
     $handle = $_SERVER['DOCUMENT_ROOT'] . "/temp/" . $real_phone . ".csv";
     file_put_contents($handle, array('"', mb_convert_encoding('№ заказа', "windows-1251", "utf-8"), '"', ',', '"', mb_convert_encoding('арт. сайт', "windows-1251", "utf-8"), '"', ',', '"', mb_convert_encoding('арт. поставщика', "windows-1251", "utf-8"), '"', ',', mb_convert_encoding('Цена', "windows-1251", "utf-8"), ',', mb_convert_encoding('Количество', "windows-1251", "utf-8"), ',', '"', mb_convert_encoding('Ед. измерения', "windows-1251", "utf-8"), '"', ',', mb_convert_encoding('Название', "windows-1251", "utf-8"), ',', mb_convert_encoding('Примечание', "windows-1251", "utf-8"), "\r\n"));
     if (!empty($plist)) {
         foreach ($plist as $p) {
             $art = explode('арт.', $p['name']);
             if ($p['id_supplier'] == $supplier) {
                 file_put_contents($handle, array(mb_convert_encoding($p['id_order'], "windows-1251", "utf-8"), ',', mb_convert_encoding($p['art'], "windows-1251", "utf-8"), ',', mb_convert_encoding(isset($art[1]) ? $art[1] : null, "windows-1251", "utf-8"), ',', mb_convert_encoding($p['price_opt_otpusk'], "windows-1251", "utf-8"), ',', mb_convert_encoding($p['opt_qty'], "windows-1251", "utf-8"), ',', mb_convert_encoding($p['units'], "windows-1251", "utf-8"), ',', '"', mb_convert_encoding($p['name'] = str_replace('"', '""', $p['name']), "windows-1251", "utf-8"), '"', ',', mb_convert_encoding($p['note_opt'], "windows-1251", "utf-8"), "\r\n"), FILE_APPEND);
             }
             if ($p['id_supplier_mopt'] == $supplier) {
                 file_put_contents($handle, array(mb_convert_encoding($p['id_order'], "windows-1251", "utf-8"), ',', mb_convert_encoding($p['art'], "windows-1251", "utf-8"), ',', mb_convert_encoding(isset($art[1]) ? $art[1] : null, "windows-1251", "utf-8"), ',', mb_convert_encoding($p['price_mopt_otpusk'], "windows-1251", "utf-8"), ',', mb_convert_encoding($p['mopt_qty'], "windows-1251", "utf-8"), ',', mb_convert_encoding($p['units'], "windows-1251", "utf-8"), ',', '"', mb_convert_encoding($p['name'] = str_replace('"', '""', $p['name']), "windows-1251", "utf-8"), '"', ',', mb_convert_encoding($p['note_mopt'], "windows-1251", "utf-8"), "\r\n"), FILE_APPEND);
             }
         }
     }
     return true;
 }
开发者ID:Arikito,项目名称:webking.xt,代码行数:26,代码来源:mailer_c.php


注:本文中的Products::SetProductsList4SuppliersCSV方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。