public function init() { // Zend_Debug::dump($this->_request->getParams()); $categories = new Catalog_Model_Mapper_Categories(); $this->_current_category_id = $this->_getParam('category'); if (!is_null($this->_getParam('headers'))) { $this->setShowHeaders($this->_getParam('headers')); } $this->view->headers = $this->getShowHeaders(); if ($this->getCurrentCategoryId() != 0) { $this->_current_category = $categories->find($this->getCurrentCategoryId(), new Catalog_Model_Categories()); $this->_parent_category = $categories->find($this->_current_category->getParentId(), new Catalog_Model_Categories()); } $this->_auth = Zend_Auth::getInstance()->hasIdentity(); }
/** * @param Zend_Db_Table_Rowset $row * @param Catalog_Model_Categories $entry * @return Catalog_Model_Categories */ protected function _setDbData($row, Catalog_Model_Categories $entry) { $info = $this->getDbTable()->info(); $properties = $info['cols']; foreach ($properties as $property) { $entry->__set($this->_normaliseName($property), $row->{$property}); } return $entry; }
/** * @param $id * @param Catalog_Model_Categories $categories * @return Catalog_Model_Categories|null */ public function findCategoryRel($id, Catalog_Model_Categories $categories) { $result = $this->getDbTable()->find($id); if (0 == count($result)) { return null; } $row = $result->current(); $categoryRow = $row->findManyToManyRowset('Catalog_Model_DbTable_Categories', 'Catalog_Model_DbTable_CategoriesXref', 'ProductsRel')->current(); $categories->setId($categoryRow->id)->setParentId($categoryRow->parent_id)->setName($categoryRow->name)->setImage($categoryRow->image)->setUploadPath($categoryRow->upload_path)->setDescription($categoryRow->description)->setAddDate($categoryRow->add_date)->setModDate($categoryRow->mod_date)->setMetaTitle($categoryRow->meta_title)->setMetaDescription($categoryRow->meta_description)->setMetaKeywords($categoryRow->meta_keywords)->setPath($categoryRow->path)->setFullPath($categoryRow->full_path)->setOrder($categoryRow->order)->setSorting($categoryRow->sorting)->setGenerate($categoryRow->generate)->setActive($categoryRow->active)->setDeleted($categoryRow->deleted); return $categories; }
/** * @param Catalog_Model_Categories $category * @return mixed|string */ public function setMetaDescription(Catalog_Model_Categories $category) { if ($category->getMetaDescription() != '') { $meta_description = $category->getMetaDescription(); } else { $categoryMapper = new Catalog_Model_Mapper_Categories(); $parentCategories = $categoryMapper->fetchTreeParentCategories($category->getId()); $aDescription = array(); if (!empty($parentCategories)) { foreach ($parentCategories as $parentCategory) { $aDescription[] = $parentCategory->name; } } $aDescription[] = 'Альфа-Гидро - Каталог продукции'; $meta_description = implode(", ", array_reverse($aDescription)); } return $meta_description; }