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

View File

@@ -0,0 +1,65 @@
<?php
/*
* Smarty plugin
* -------------------------------------------------------------
* Type: function
* Name: get_product_info
* Purpose: returns various information about order
* -------------------------------------------------------------
*/
use KupShop\OrderingBundle\Util\Order\OrderInfo;
function smarty_function_get_order_info($params, &$smarty)
{
$type = null;
$id = null;
/** @var Order $order */
$order = null;
$result = null;
extract($params);
if (empty($type)) {
trigger_error("Chybějící parametr 'type'");
}
if (empty($id) && empty($order)) {
trigger_error("Chybějící parametr 'id' nebo 'order'");
}
if (empty($id)) {
$id = $order->id;
}
switch ($type) {
case 'conversion_sent':
if ($order->getData('conversion_sent')) {
$result = false;
} else {
$order->setData('conversion_sent', 1);
$result = true;
}
break;
case 'heurekaDisagree':
$result = $order->getData('heurekaDisagree');
break;
case 'getUsedCoupons':
if ($coupons = OrderInfo::getUsedCoupons($order)) {
$result = $coupons;
}
break;
default:
trigger_error("Neexistující 'type': {$type}");
}
if (!empty($params['assign'])) {
$smarty->assign($params['assign'], $result);
} else {
return $result;
}
}