first commit
This commit is contained in:
39
class/Query/XMLFeed.php
Normal file
39
class/Query/XMLFeed.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?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);
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user