first commit

This commit is contained in:
2025-08-02 16:30:27 +02:00
commit 23646bfcee
14851 changed files with 1750626 additions and 0 deletions

52
class/class.WinShop.php Normal file
View File

@@ -0,0 +1,52 @@
<?php
class WinShop
{
public function export()
{
$orders = sqlQuery('SELECT id, order_no FROM orders WHERE date_created > DATE_SUB(NOW(), INTERVAL 30 DAY)');
foreach ($orders as $order) {
$this->export_order($order['id'], $order['order_no']);
}
}
public function export_order($order_id, $code)
{
$file = "data/import/Import/{$code}.xml";
if (file_exists($file)) {
return false;
}
$xml = $this->get_order_xml($order_id);
$handle = fopen($file, 'w');
fwrite($handle, $xml);
fclose($handle);
return true;
}
public function get_order_xml($order_id)
{
$order = new Order();
$order->createFromDB($order_id, true, false, true);
$order->fetchRawDates();
$order->fetchItems();
$smarty = createSmarty(true);
$smarty->assign([
'order' => $order,
'winshop' => $this,
]);
return $smarty->fetch('export/order.WinShop.tpl');
}
public function get_order_item_variation($item)
{
preg_match('/\(Velikost.*?: ([^\)]+)/i', $item['descr'], $matches);
return $matches[1];
}
}