Здравствуйте. Подскажите, пожалуйста, как вывести последние купленные товары?
В 5 версии было так:
<?php
$shop = & singleton('shop');
$param = array();
// Заполняем первое условие
$element['type'] = 0;
$element['prefix'] = ' and ';
$element['name'] = 'shop_items_catalog_date_time';
$element['if'] = '>';
$DateClass = new DateClass();
// Вместо 30 подставить нужное число дней
$time = time() - 60 * 60 * 24 * 30;
$element['value'] = $DateClass->DateUnixToSQL($time);
$element['sufix'] = '';
$param['select'][] = $element;
$param['current_group_id'] = false;
$param['items_begin'] = 0;
$param['items_on_page'] = 4;
$param['items_order'] = 'rand';
$param['xml_show_group_type'] = 'all';
$shop->ShowShop(3, 'XSLШАБЛОН', $param);
?>
И еще хотел узнать, как в коде вывода Новинок задать временной промежуток, за который отбирать Новинки?
<?php
// НОВИНКИ
if (Core::moduleIsActive('shop'))
{
$Shop_Controller_Show = new Shop_Controller_Show(
Core_Entity::factory('Shop', 1)
);
$Shop_Controller_Show
->xsl(
Core_Entity::factory('Xsl')->getByName('Новинки')
)
->groupsMode('none')
//->itemsForbiddenTags(array('text'))
->group(FALSE)
->limit(1);
$Shop_Controller_Show
->shopItems()
->queryBuilder()
->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)
->clearOrderBy()
->orderBy('RAND()');
$Shop_Controller_Show->show();
}
?>