Files
kupshop/class/Query/XMLFeed.php
2025-08-02 16:30:27 +02:00

40 lines
985 B
PHP

<?php
namespace Query;
class XMLFeed
{
public static function categorizedProducts()
{
return function (QueryBuilder $qb) {
return $qb->expr()->isNotNull('ps.id_section');
};
}
public static function productsInFeed()
{
return function (QueryBuilder $qb) {
return $qb->expr()->eq('p.show_in_feed', '1');
};
}
public static function showInStore($in_store_only)
{
return function (QueryBuilder $qb) use ($in_store_only) {
if ($in_store_only && !findModule(\Modules::PRODUCTS_SUPPLIERS)) {
$qb->expr()->gt('COALESCE(pv.in_store, p.in_store)', 0);
}
};
}
public static function limit($count, $offset = null)
{
return function (QueryBuilder $qb) use ($count, $offset) {
if (isset($offset)) {
$qb->setFirstResult($offset);
}
$qb->setMaxResults($count);
};
}
}