/** * Match the opened page to a category * * @param \XLite\Model\Category $category Category * * @return void * @access protected * @since 1.0.0 */ protected function doCategoryPageTesting(\XLite\Model\Category $category) { // Title $titleSelector = "h1#page-title.title"; if ($category->getShowTitle()) { $this->assertElementPresent("css={$titleSelector}", "A category title is missing (" . $category->getCategoryId() . ")"); $title = $this->getJSExpression("jQuery('{$titleSelector}').html()"); $this->assertEquals($category->getName(), $title, "A category displays a wrong title (" . $category->getCategoryId() . ")"); } else { $this->assertElementNotPresent("css={$titleSelector}", "A category title is exists (" . $category->getCategoryId() . ")"); } // Description $method = $category->getDescription() ? "assertElementPresent" : "assertElementNotPresent"; $this->{$method}("css=.category-description", "Wrong category description ({$method}, " . $category->getCategoryId() . ")"); }
/** * Assemble list item link class name * * @param integer $i Item number * @param integer $count Items count * @param \XLite\Model\Category $category Current category * * @return string */ protected function assembleLinkClassName($i, $count, \XLite\Model\Category $category) { return \XLite\Core\Request::getInstance()->category_id == $category->getCategoryId() ? 'active' : ''; }
/** * Return link to category page * * @param \XLite\Model\Category $category Category model object to use * * @return string */ protected function getCategoryURL(\XLite\Model\Category $category) { return $this->buildURL('category', '', array('category_id' => $category->getCategoryId())); }
/** * Define the Doctrine query * * @param \XLite\Model\Category $category Category * @param boolean $hasSelf Flag to include itself OPTIONAL * * @return \Doctrine\ORM\QueryBuilder */ protected function defineSiblingsQuery(\XLite\Model\Category $category, $hasSelf = false) { $result = $this->defineSubcategoriesQuery($category->getParentId()); if (!$hasSelf) { $result->andWhere('c.category_id <> :category_id')->setParameter('category_id', $category->getCategoryId()); } return $result; }
/** * {@inheritDoc} */ public function getCategoryId() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getCategoryId', array()); return parent::getCategoryId(); }
/** * Assemble category data * * @param \XLite\Model\Category $category Category * * @return array */ protected function assembleCategoryData(\XLite\Model\Category $category) { return array('loc' => array('target' => 'category', 'category_id' => $category->getCategoryId()), 'lastmod' => \XLite\Core\Converter::time(), 'changefreq' => \XLite\Core\Config::getInstance()->CDev->XMLSitemap->category_changefreq, 'priority' => $this->processPriority(\XLite\Core\Config::getInstance()->CDev->XMLSitemap->category_priority)); }