Exemple #1
0
 public function __construct()
 {
     $this->filename = 'log_commerceml.txt';
     list($this->path, $url_commerceml, $url_images) = RusEximCommerceml::getDirCommerceML();
     if (!is_dir($this->path)) {
         fn_mkdir($this->path);
         @chmod($this->path, 0777);
     }
     $file_is_new = !file_exists($this->path . $this->filename);
     $this->file = fopen($this->path . $this->filename, 'ab');
     if ($file_is_new) {
         fwrite($this->file, 'Message: ' . PHP_EOL);
         @chmod($this->file, 0777);
     }
 }
Exemple #2
0
                RusEximCommerceml::importDataOffersFile($xml, $service_exchange, $lang_code);
            }
        }
        fn_echo("success\n");
    }
} elseif ($type == 'sale' && $user_data['user_type'] != 'V' && $s_commerceml['exim_1c_check_prices'] != 'Y') {
    if ($mode == 'checkauth') {
        RusEximCommerceml::exportDataCheckauth();
    } elseif ($mode == 'init') {
        RusEximCommerceml::exportDataInit();
    } elseif ($mode == 'file') {
        if (RusEximCommerceml::createImportFile($filename) === false) {
            fn_echo("failure");
            exit;
        }
        if ($s_commerceml['exim_1c_import_statuses'] == 'Y' && strpos($filename, 'orders') == 0) {
            $xml = RusEximCommerceml::getFileCommerceml($filename);
            if ($xml === false) {
                fn_echo("failure");
                exit;
            }
            RusEximCommerceml::importFileOrders($xml, $lang_code);
        }
        fn_echo("success\n");
    } elseif ($mode == 'query') {
        RusEximCommerceml::exportDataOrders($lang_code);
    } elseif ($mode == 'success') {
        fn_echo("success");
    }
}
exit;
Exemple #3
0
         } else {
             $prices[] = $price;
         }
     }
     Tygh::$app['view']->assign('list_price_1c', trim($list_price_1c, ','));
     Tygh::$app['view']->assign('base_price_1c', trim($base_price_1c, ','));
     Tygh::$app['view']->assign('prices_data', $prices);
     if ($s_commerceml['exim_1c_check_prices'] == 'Y') {
         list($path_commerceml, $url_commerceml, $url_images) = RusEximCommerceml::getDirCommerceML();
         $result = array();
         $file_offers = glob($path_commerceml . "offers*");
         if (!empty($file_offers)) {
             $filename = fn_basename(reset($file_offers));
             $xml = RusEximCommerceml::getFileCommerceml($filename);
             if (isset($xml->{$cml}['packages']->{$cml}['offers']->{$cml}['offer'])) {
                 $result = RusEximCommerceml::checkPricesOffers($xml->{$cml}['packages']);
             }
         } else {
             fn_set_notification('W', __('warning'), __('offers_not_found'));
         }
         Tygh::$app['view']->assign('resul_test', $result);
     }
 }
 if ($s_commerceml['exim_1c_add_tax'] == 'Y') {
     $taxes = fn_get_taxes();
     $taxes_data = db_get_array("SELECT * FROM ?:rus_exim_1c_taxes");
     Tygh::$app['view']->assign('taxes_data', $taxes_data);
     Tygh::$app['view']->assign('taxes', $taxes);
 }
 $data_currencies = Registry::get('currencies');
 $commerceml_currencies = db_get_array("SELECT * FROM ?:rus_commerceml_currencies");