Показ
товаров, у которых есть
модификации со
скидкой $shop_id = 1;
$Shop_Controller_Show = new Shop_Controller_Show(
Core_Entity::factory('Shop', $shop_id)
);
$Shop_Controller_Show
->xsl(
Core_Entity::factory('Xsl')->getByName('МагазинКаталогТоваровНаГлавнойСпецПред')
)
->groupsMode('none')
->group(FALSE)
->limit(3);
$Shop_Controller_Show
->shopItems()
->queryBuilder()
->where('shop_items.id', '=', Core_QueryBuilder::select('shop_items.modification_id')
->from('shop_items')
->where('shop_items.modification_id', '!=', 0)
->where('shop_items.shop_id', '=', $shop_id)
->join('shop_item_discounts', 'shop_item_discounts.shop_item_id', '=', 'shop_items.id')
->join('shop_discounts', 'shop_discounts.id', '=', 'shop_item_discounts.shop_discount_id')
->where('shop_discounts.active', '=', 1)
->where('shop_discounts.start_datetime', '<', Core_Date::timestamp2sql(time()))
->where('shop_discounts.end_datetime', '>', Core_Date::timestamp2sql(time()))
->where('shop_discounts.deleted', '=', 0)
->limit(3)
)
->clearOrderBy()
->orderBy('RAND()');
$Shop_Controller_Show->show();