Место хранения переменных
Начинаю изучать HostCMS. Помогите разобраться с переменными и классами? Где хранится информация о них? Документацию на Host CMS читал, но там нет этого.
В частности мне нужно сделать отображение всех товаров в фиде для Яндекс Маркет не обращая внимание на свойство "Экспортировать в Яндекс.Маркет"
<?php
class avmShop_Controller_YandexMarket extends Shop_Controller_YandexMarket{
protected function _promos()
{
$dateTime = Core_Date::timestamp2sql(time());
$oShop = $this->getEntity();
$oShop_Discounts = $oShop->Shop_Discounts;
$oShop_Discounts->queryBuilder()
->where('shop_discounts.active', '=', 1)
->where('shop_discounts.coupon', '=', 1)
->where('shop_discounts.public', '=', 1)
->where('shop_discounts.coupon_text', '!=', ''
->open()
->where('shop_discounts.start_datetime', '<', $dateTime)
->setOr()
->where('shop_discounts.start_datetime', '=', '0000-00-00 00:00:00'
->close()
->setAnd()
->open()
->where('shop_discounts.end_datetime', '>', $dateTime)
->setOr()
->where('shop_discounts.end_datetime', '=', '0000-00-00 00:00:00'
->close()
->clearOrderBy()
->orderBy('shop_discounts.id'
;
$aShop_Discounts = $oShop_Discounts->findAll(FALSE);
//Блок выводить только если есть данные для него
if(count($aShop_Discounts) > 0){
$this->write("<promos>\n"
;
foreach ($aShop_Discounts as $oShop_Discount){
$this->_showPromo($oShop_Discount);
}
$this->write("</promos>\n"
;
}
return $this;
}
}
$oShop = Core_Entity::factory('Shop', Core_Array::get(Core_Page::instance()->libParams, 'shopId'
);
$Shop_Controller_YandexMarket = new avmShop_Controller_YandexMarket($oShop);
$Shop_Controller_YandexMarket
->model('DBS'
->itemsProperties(FALSE)
->modifications(TRUE)
->deliveryOptions(TRUE)
->itemsForbiddenProperties(array('description'
)
//->outlets(array(1 => 96490))
//->forbiddenTags(array('description'
)
->show();
exit();
В частности мне нужно сделать отображение всех товаров в фиде для Яндекс Маркет не обращая внимание на свойство "Экспортировать в Яндекс.Маркет"
<?php
class avmShop_Controller_YandexMarket extends Shop_Controller_YandexMarket{
protected function _promos()
{
$dateTime = Core_Date::timestamp2sql(time());
$oShop = $this->getEntity();
$oShop_Discounts = $oShop->Shop_Discounts;
$oShop_Discounts->queryBuilder()
->where('shop_discounts.active', '=', 1)
->where('shop_discounts.coupon', '=', 1)
->where('shop_discounts.public', '=', 1)
->where('shop_discounts.coupon_text', '!=', ''

->open()
->where('shop_discounts.start_datetime', '<', $dateTime)
->setOr()
->where('shop_discounts.start_datetime', '=', '0000-00-00 00:00:00'

->close()
->setAnd()
->open()
->where('shop_discounts.end_datetime', '>', $dateTime)
->setOr()
->where('shop_discounts.end_datetime', '=', '0000-00-00 00:00:00'

->close()
->clearOrderBy()
->orderBy('shop_discounts.id'
;$aShop_Discounts = $oShop_Discounts->findAll(FALSE);
//Блок выводить только если есть данные для него
if(count($aShop_Discounts) > 0){
$this->write("<promos>\n"
;foreach ($aShop_Discounts as $oShop_Discount){
$this->_showPromo($oShop_Discount);
}
$this->write("</promos>\n"
;}
return $this;
}
}
$oShop = Core_Entity::factory('Shop', Core_Array::get(Core_Page::instance()->libParams, 'shopId'
);$Shop_Controller_YandexMarket = new avmShop_Controller_YandexMarket($oShop);
$Shop_Controller_YandexMarket
->model('DBS'

->itemsProperties(FALSE)
->modifications(TRUE)
->deliveryOptions(TRUE)
->itemsForbiddenProperties(array('description'
)//->outlets(array(1 => 96490))
//->forbiddenTags(array('description'
)->show();
exit();
Вам нужно в ТДС унаследовать контроллер Shop_Controller_YandexMarket и переопределить метод:
class My_Shop_Controller_YandexMarket extends Shop_Controller_YandexMarket
{
/**
* Add conditions for Shop_Item
* @param Shop_Item_Model $oShop_Item
* @return self
* @hostcms-event Shop_Controller_YandexMarket.onBeforeSelectShopItems
*/
protected function _addShopItemConditions($oShop_Item)
{
$dateTime = Core_Date::timestamp2sql(time());
$oShop_Item
->queryBuilder()
->select('shop_items.*')
->leftJoin('shop_groups', 'shop_groups.id', '=', 'shop_items.shop_group_id'/*,
array(
array('AND' => array('shop_groups.active', '=', 1)),
array('OR' => array('shop_items.shop_group_id', '=', 0))
)*/
)
// Активность группы или группа корневая
->open()
->where('shop_groups.active', '=', 1)
->setOr()
->where('shop_groups.id', 'IS', NULL)
->close()
->where('shop_items.shortcut_id', '=', 0)
->where('shop_items.active', '=', 1)
->where('shop_items.siteuser_id', 'IN', $this->_aSiteuserGroups)
->open()
->where('shop_items.start_datetime', '<', $dateTime)
->setOr()
->where('shop_items.start_datetime', '=', '0000-00-00 00:00:00')
->close()
->setAnd()
->open()
->where('shop_items.end_datetime', '>', $dateTime)
->setOr()
->where('shop_items.end_datetime', '=', '0000-00-00 00:00:00')
->close()
->where('shop_items.yandex_market', '=', 1)
//->where('shop_items.price', '>', 0)
->where('shop_items.modification_id', '=', 0);
Core_Event::notify(get_class($this) . '.onBeforeSelectShopItems', $this, array($oShop_Item));
return $this;
}
}
В нем убрать
И в ТДС уже использовать My_Shop_Controller_YandexMarket
class My_Shop_Controller_YandexMarket extends Shop_Controller_YandexMarket
{
/**
* Add conditions for Shop_Item
* @param Shop_Item_Model $oShop_Item
* @return self
* @hostcms-event Shop_Controller_YandexMarket.onBeforeSelectShopItems
*/
protected function _addShopItemConditions($oShop_Item)
{
$dateTime = Core_Date::timestamp2sql(time());
$oShop_Item
->queryBuilder()
->select('shop_items.*')
->leftJoin('shop_groups', 'shop_groups.id', '=', 'shop_items.shop_group_id'/*,
array(
array('AND' => array('shop_groups.active', '=', 1)),
array('OR' => array('shop_items.shop_group_id', '=', 0))
)*/
)
// Активность группы или группа корневая
->open()
->where('shop_groups.active', '=', 1)
->setOr()
->where('shop_groups.id', 'IS', NULL)
->close()
->where('shop_items.shortcut_id', '=', 0)
->where('shop_items.active', '=', 1)
->where('shop_items.siteuser_id', 'IN', $this->_aSiteuserGroups)
->open()
->where('shop_items.start_datetime', '<', $dateTime)
->setOr()
->where('shop_items.start_datetime', '=', '0000-00-00 00:00:00')
->close()
->setAnd()
->open()
->where('shop_items.end_datetime', '>', $dateTime)
->setOr()
->where('shop_items.end_datetime', '=', '0000-00-00 00:00:00')
->close()
->where('shop_items.yandex_market', '=', 1)
//->where('shop_items.price', '>', 0)
->where('shop_items.modification_id', '=', 0);
Core_Event::notify(get_class($this) . '.onBeforeSelectShopItems', $this, array($oShop_Item));
return $this;
}
}
В нем убрать
->where('shop_items.yandex_market', '=', 1)
И в ТДС уже использовать My_Shop_Controller_YandexMarket
Вы только что начали читать предложение, чтение которого вы уже заканчиваете.
Авторизация