function output() { global $application; $this->msg_res =& $application->getInstance('MessageResources'); $this->category_id = modApiFunc('CProductListFilter', 'getCurrentCategoryId'); loadClass('CCategoryInfo'); $cat_info = new CCategoryInfo($this->category_id); $this->_Current_Category =& $cat_info; $i_w = $cat_info->getCategoryTagValue('SmallImageWidth'); $i_h = $cat_info->getCategoryTagValue('SmallImageHeight'); $i_url = $cat_info->getCategoryTagValue('SmallImageSrc'); if ($i_url == '' || $i_w == 0 || $i_h == 0) { $i_w = 100; $i_h = 100; $i_url = $this->no_image_url; } $cat_info->setAdditionalCategoryTag('AttributeImageWidth', $i_w); $cat_info->setAdditionalCategoryTag('AttributeImageHeight', $i_h); $cat_info->setAdditionalCategoryTag('AttributeImageURL', $i_url); $cat_info->setAdditionalCategoryTag('CategoryStatus', $cat_info->getCategoryTagValue('status', CATEGORYINFO_LOCALIZED_DATA)); $application->registerAttributes($cat_info->getAdditionalCategoryTagList()); $application->registerAttributes(array('CategoryProducts', 'CategoryProductsRec', 'FeaturedProducts', 'BestsellersProducts')); return modApiFunc('TmplFiller', 'fill', "catalog/category_review/", "review.tpl.html", array()); }
/** * Returns the Catalog Category Info view. * * @ finish the functions on this page */ function output() { global $application; $obj =& $application->getInstance('MessageResources'); $CatID = modApiFunc('Catalog', 'getEditableCategoryID'); if ($CatID == NULL) { } else { $catInfo = new CCategoryInfo($CatID); $request = new Request(); $request->setView('EditCategory'); $request->setAction('SetEditableCategory'); $request->setKey('category_id', $CatID); $catInfo->setAdditionalCategoryTag('EditCatHref', $request->getURL()); $cat_status = ""; switch ($catInfo->getCategoryTagValue("Status")) { case CATEGORY_STATUS_ONLINE: $cat_status = getMsg('SYS', 'CAT_STATUS_ONLINE'); break; case CATEGORY_STATUS_OFFLINE: $cat_status = getMsg('SYS', 'CAT_STATUS_OFFLINE'); break; default: //: report error $cat_status = ""; } $this->_Current_Category = $catInfo; $this->_Current_Category->setAdditionalCategoryTag('ShowProductsRecursivelyStatus', $catInfo->getCategoryTagValue('showproductsrecursivelystatus', CATEGORYINFO_LOCALIZED_DATA)); $this->_Current_Category->setAdditionalCategoryTag('CategoryStatus', $catInfo->getCategoryTagValue('status', CATEGORYINFO_LOCALIZED_DATA)); $this->_Current_Category->setAdditionalCategoryTag('AttributeImageWidth', $catInfo->getCategoryTagValue('LargeImageWidth')); $this->_Current_Category->setAdditionalCategoryTag('AttributeImageHeight', $catInfo->getCategoryTagValue('LargeImageHeight')); $this->_Current_Category->setAdditionalCategoryTag('AttributeImageURL', $catInfo->getCategoryTagValue('LargeImageSrc')); $this->_Current_Category->setAdditionalCategoryTag('largeimage', $obj->getMessage(new ActionMessage('INFO_CTGR_NO_IMG'))); $application->registerAttributes($this->_Current_Category->getAdditionalCategoryTagList()); $application->registerAttributes(array('SmallImage')); if ($this->_Current_Category->getCategoryTagValue('largeimagesrc') != '') { $this->_Current_Category->setAdditionalCategoryTag('largeimage', modApiFunc('TmplFiller', 'fill', "catalog/view_cat/", "attr-large-image.tpl.html", array())); } $retval = modApiFunc('TmplFiller', 'fill', "catalog/view_cat/", "list.tpl.html", array()); } return $retval; }
/** * Returns the HTML code of the deleted object list. * * @return HTML code */ function outputListItems($CatID) { global $application; $catitems = ''; /* Get a list of all subcategories without paginator. */ $SubcategoriesFullList = modApiFunc('Catalog', 'getSubcategoriesFullListWithParent', $CatID); /* Look through the list of categories and: - save each of them in the array of the $this->CatsId ID category, - get a product list in each category, without paginator, i.e. the whole list - save each of them in the array of the $this->ProdsId ID of each product - generate HTML to output one category */ $i = 0; foreach ($SubcategoriesFullList as $catInfo) { /* This array of the categories ID will be outputted in the form of the hidden field. These very categories will be deleted from the catalog. */ array_push($this->CatsId, $catInfo['id']); /* Execute a query for optimization. */ $result = modApiFunc('Catalog', 'selectCatgoryProducts', $catInfo['id']); foreach ($result as $productid) { /* This array of the products ID will be outputted in the form of the hidden field. These very products will be deleted from the catalog. */ array_push($this->ProdsId, $productid['id']); } /* HTML */ $categoryInfo = new CCategoryInfo($catInfo['id']); $ProductsCountTotal = $categoryInfo->getCategoryTagValue("productsnumberrecursively"); $ProductsCountInCat = $categoryInfo->getCategoryTagValue("productsnumber"); $full_subcat_path_arr = modApiFunc('Catalog', 'getCategoryFullPath', $catInfo['id']); $categoryInfo->setAdditionalCategoryTag('N', $i + 1); $categoryInfo->setAdditionalCategoryTag('Category_Full_Name', $this->outputLocationBreadcrumb($full_subcat_path_arr, false)); $categoryInfo->setAdditionalCategoryTag('Products_Count_In_Cat', $ProductsCountInCat); $categoryInfo->setAdditionalCategoryTag('Products_Count_Total', $ProductsCountTotal); $this->_Current_Category = $categoryInfo; $application->registerAttributes($this->_Current_Category->getAdditionalCategoryTagList()); $catitems .= modApiFunc('TmplFiller', 'fill', "catalog/del_cat/", "list_item.tpl.html", array()); $i++; } return $catitems; }