/** * Get children * * @param string $type Page type * @param integer $id Page ID * * @return array */ protected function getChildren($type, $id) { $result = parent::getChildren($type, $id); if ($type == static::PAGE_CATEGORY && $id == \XLite\Core\Database::getRepo('XLite\\Model\\Category')->getRootCategoryId()) { array_unshift($result, array('type' => static::PAGE_STATIC, 'id' => '997', 'name' => static::t('Sale'), 'url' => static::buildURL('sale_products'))); } return $result; }
/** * Get children * * @param string $type Page type * @param integer $id Page ID * * @return array */ protected function getChildren($type, $id) { $result = parent::getChildren($type, $id); if ($type == static::PAGE_CATEGORY && $id == \XLite\Core\Database::getRepo('XLite\\Model\\Category')->getRootCategoryId()) { array_unshift($result, array('type' => static::PAGE_STATIC, 'id' => '998', 'name' => static::t('New arrivals'), 'url' => static::buildURL('new_arrivals'))); array_unshift($result, array('type' => static::PAGE_STATIC, 'id' => '999', 'name' => static::t('Coming soon'), 'url' => static::buildURL('coming_soon'))); } return $result; }
/** * Get children * * @param string $type Page type * @param integer $id Page ID * * @return array */ protected function getChildren($type, $id) { if (static::PAGE_STATIC_PAGE == $type) { $result = array(); if (!$id) { $pages = \XLite\Core\Database::getRepo('XLite\\Module\\CDev\\SimpleCMS\\Model\\Page')->findBy(array('enabled' => true)); foreach ($pages as $page) { $result[] = array('type' => static::PAGE_STATIC_PAGE, 'id' => $page->getId(), 'name' => $page->getName(), 'url' => static::buildURL('page', null, array('id' => $page->getId()))); } } } else { $result = parent::getChildren($type, $id); if (empty($type)) { $result[] = array('type' => static::PAGE_STATIC_PAGE, 'id' => 0, 'name' => static::t('Static pages')); } } return $result; }