コード例 #1
0
ファイル: yml.php プロジェクト: AlexanderWhi/tplshop2
<?php

ini_set('log_errors', 'On');
ini_set('error_log', dirname(__FILE__) . '/php_errors.log');
include "../config.php";
include "../core/function.php";
set_time_limit(1000);
//include("../core/lib/SQL.class.php");
include_once '../modules/catsrv/catsrv.properties.php';
include "../modules/catsrv/LibCatsrv.class.php";
chdir(ROOT);
$ST = new SQL(DB_HOST, DB_LOGIN, DB_PASSWORD, DB_BASE);
$r = $ST->select("SELECT UPPER(name) AS name,value FROM sc_config");
while ($r->next()) {
    if ($r->get('value')) {
        $CONFIG[$r->get('name')] = $r->get('value');
    }
}
//echo LibCatsrv::export1c();
echo LibCatsrv::makeYandexYML();
コード例 #2
0
 static function export1c()
 {
     global $CONFIG, $ST;
     set_time_limit(1000);
     $data = array('make_date' => date('Y-m-d'), 'make_time' => date('H:i:s'), 'document' => array());
     $date_from = date('Y-m-d');
     $date_to = date('Y-m-d', time() + 3600 * 24);
     if (isset($_GET['d']) && ($t = strtotime($_GET['d']))) {
         $date_from = date('Y-m-d', $t);
         $date_to = date('Y-m-d', $t + 3600 * 24);
     }
     //		if($get->get('date_from')){
     //			$date_from=$get->get('date_from');
     //		}
     //
     //		if($get->get('date_to')){
     //			$date_to=$get->get('date_to');
     //		}
     $q = "SELECT u.*,o.* FROM sc_shop_order o\r\n\t\tLEFT JOIN sc_users AS u ON u.u_id=o.userid\r\n\t\tWHERE \r\n\t\t o.create_time>='{$date_from}' AND o.create_time<='{$date_to}'\r\n\t\t";
     $rs = $ST->select($q);
     while ($rs->next()) {
         $d = array('id' => $rs->get('id'), 'num' => $rs->get('id'), 'date' => dte($rs->get('create_time'), 'Y-m-d'), 'summ' => $rs->get('total_price'), 'contragent' => array('id' => $rs->get('u_id') . '#' . $rs->get('login') . '#' . $rs->get('fullname') . '#' . $rs->get('phone'), 'name' => $rs->get('type') == 'user_jur' && trim($rs->get('company')) ? $rs->get('company') : $rs->get('fullname'), 'address' => $rs->get('address'), 'mail' => $rs->get('mail')), 'time' => dte($rs->get('create_time'), 'H:i:s'), 'additionally' => $rs->get('additionally'), 'goods' => array());
         $q = "SELECT *,ec.id AS ext_cat_id, oi.price AS price \t\r\n\t\t\tFROM sc_shop_order_item AS oi, sc_shop_item AS si\r\n\t\t\tLEFT JOIN sc_shop_srv_extcat AS ec ON ec.lnk=si.category\r\n\t\t\tWHERE\r\n\t\t\t\tsi.id=oi.itemid\r\n\t\t\t\tAND oi.orderid={$rs->get('id')} \r\n\t\t\t\t\r\n\t\t\t";
         $q = "SELECT *, oi.price AS price \t\r\n\t\t\tFROM sc_shop_order_item AS oi, sc_shop_item AS si\r\n\t\t\t\r\n\t\t\tWHERE\r\n\t\t\t\tsi.id=oi.itemid\r\n\t\t\t\tAND oi.orderid={$rs->get('id')} ";
         $rs1 = $ST->select($q);
         while ($rs1->next()) {
             $g = array('name' => $rs1->get('name'), 'id' => $rs1->get('ext_id'), 'price' => $rs1->get('price'), 'count' => $rs1->get('count'), 'summ' => $rs1->get('price') * $rs1->get('count'));
             if ($rs1->get('unit_sale') == 2) {
                 if ($rs1->getInt('pack_size') != 0) {
                     //03.02.2013
                     $g['count'] *= $rs1->getInt('pack_size');
                     $g['price'] /= $rs1->getInt('pack_size');
                     $g['price'] = round($g['price'], 2);
                 }
             }
             $d['goods'][] = $g;
         }
         $data['document'][] = $d;
     }
     $file = ROOT . '/' . CATALOG_EXPORT_DIR . '/' . 'order.xml';
     if (isset($_GET['d']) && ($t = strtotime($_GET['d']))) {
         $file = ROOT . '/' . CATALOG_EXPORT_DIR . '/' . date('Y_m_d', $t) . '.xml';
     }
     $out = '<?xml version="1.0" encoding="windows-1251"?>';
     $out .= LibCatsrv::render($data, dirname(__FILE__) . '/order1c.xml.php');
     if (isset($_GET['get'])) {
         return $out;
     } else {
         file_put_contents($file, $out);
         exit;
     }
 }
コード例 #3
0
ファイル: export1c.php プロジェクト: AlexanderWhi/tplshop2
<?php

ini_set('log_errors', 'On');
ini_set('error_log', dirname(__FILE__) . '/php_errors.log');
include "../../config.php";
include "../../core/function.php";
set_time_limit(1000);
include "../../core/lib/SQL.class.php";
include_once '../../modules/catsrv/catsrv.properties.php';
include "../../modules/catsrv/LibCatsrv.class.php";
chdir(ROOT);
$ST = new SQL(DB_HOST, DB_LOGIN, DB_PASSWORD, DB_BASE);
$r = $ST->select("SELECT UPPER(name) AS name,value FROM sc_config WHERE name LIKE 'SHOP_SRV%'");
while ($r->next()) {
    if ($r->get('value')) {
        $CONFIG[$r->get('name')] = $r->get('value');
    }
}
echo LibCatsrv::export1c();
//LibCatsrv::makeYandexYML();
コード例 #4
0
ファイル: import1c.php プロジェクト: AlexanderWhi/tplshop2
<?php

ini_set('memory_limit', '64M');
ini_set('log_errors', 'On');
ini_set('error_log', dirname(__FILE__) . '/php_errors_imp.log');
include dirname(__FILE__) . "/../../config.php";
include dirname(__FILE__) . "/../../core/function.php";
file_put_contents(dirname(__FILE__) . '/last_start.txt', date('Y-m-d H:i;s') . "\n", FILE_APPEND);
?>
Импорт каталога
<?php 
set_time_limit(1000);
include dirname(__FILE__) . "/../../core/lib/SQL.class.php";
include_once dirname(__FILE__) . '/../../modules/catsrv/catsrv.properties.php';
include dirname(__FILE__) . "/../../modules/catsrv/LibCatsrv.class.php";
chdir(ROOT);
$ST = new SQL(DB_HOST, DB_LOGIN, DB_PASSWORD, DB_BASE);
$r = $ST->select("SELECT UPPER(name) AS name,value FROM sc_config WHERE name LIKE 'SHOP_%'");
while ($r->next()) {
    if ($r->get('value')) {
        $CONFIG[$r->get('name')] = $r->get('value');
    }
}
//echo LibCatsrv::import1c();
//LibCatsrv::makeYandexYML();
$res = LibCatsrv::import('import', 11);
echo print_r($res, true);
file_put_contents('import.log', "GET-" . print_r($res, true), FILE_APPEND);
//33fecdef-0baa-11e2-bc36-00241d3e9178/7858
コード例 #5
0
 function actYML()
 {
     global $ST, $post, $CONFIG, $get;
     include 'LibCatsrv.class.php';
     LibCatsrv::makeYandexYML();
 }
コード例 #6
0
ファイル: import.php プロジェクト: AlexanderWhi/tplshop2
<?php

include_once "../config.php";
include_once "../core/function.php";
file_put_contents(dirname(__FILE__) . '/import.log', date('Y-m-d H:i:s') . "\r\n", FILE_APPEND);
$filename = date('Ymd_His') . ".xml";
file_put_contents($filename, file_get_contents("php://input"));
set_time_limit(1000);
include_once "../core/lib/SQL.class.php";
include_once '../modules/catsrv/catsrv.properties.php';
include_once "../modules/catsrv/LibCatsrv.class.php";
chdir(ROOT);
$ST = new SQL(DB_HOST, DB_LOGIN, DB_PASSWORD, DB_BASE);
$r = $ST->select("SELECT UPPER(name) AS name,value FROM sc_config");
while ($r->next()) {
    if ($r->get('value')) {
        $CONFIG[$r->get('name')] = $r->get('value');
    }
}
$res = LibCatsrv::import('import/' . $filename, 4);
file_put_contents(dirname(__FILE__) . '/import.log', print_r($res, true), FILE_APPEND);
echo print_r($res, true);