Add substitution
This commit is contained in:
@@ -214,6 +214,7 @@ class Category extends BaseI18nLoop implements PropelSearchLoopInterface, Search
|
||||
->set("DESCRIPTION" , $category->getVirtualColumn('i18n_DESCRIPTION'))
|
||||
->set("POSTSCRIPTUM" , $category->getVirtualColumn('i18n_POSTSCRIPTUM'))
|
||||
->set("PARENT" , $category->getParent())
|
||||
->set("ROOT" , $category->getRoot($category->getId()))
|
||||
->set("URL" , $category->getUrl($this->locale))
|
||||
->set("META_TITLE" , $category->getVirtualColumn('i18n_META_TITLE'))
|
||||
->set("META_DESCRIPTION" , $category->getVirtualColumn('i18n_META_DESCRIPTION'))
|
||||
|
||||
@@ -175,6 +175,7 @@ class Folder extends BaseI18nLoop implements PropelSearchLoopInterface, SearchLo
|
||||
->set("DESCRIPTION" , $folder->getVirtualColumn('i18n_DESCRIPTION'))
|
||||
->set("POSTSCRIPTUM" , $folder->getVirtualColumn('i18n_POSTSCRIPTUM'))
|
||||
->set("PARENT" , $folder->getParent())
|
||||
->set("ROOT" , $folder->getRoot($folder->getId()))
|
||||
->set("URL" , $folder->getUrl($this->locale))
|
||||
->set("META_TITLE" , $folder->getVirtualColumn('i18n_META_TITLE'))
|
||||
->set("META_DESCRIPTION" , $folder->getVirtualColumn('i18n_META_DESCRIPTION'))
|
||||
|
||||
@@ -56,6 +56,28 @@ class Category extends BaseCategory
|
||||
return $countProduct;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the root category
|
||||
* @param int $categoryId
|
||||
* @return mixed
|
||||
*/
|
||||
public function getRoot($categoryId)
|
||||
{
|
||||
|
||||
$category = CategoryQuery::create()->findOneById($categoryId);
|
||||
|
||||
if(0 !== $category->getParent()) {
|
||||
$parentCategory = CategoryQuery::create()->findOneById($category->getParent());
|
||||
|
||||
if (null !== $parentCategory) {
|
||||
$categoryId = $this->getRoot($parentCategory->getId());
|
||||
}
|
||||
}
|
||||
|
||||
return $categoryId;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate next position relative to our parent
|
||||
*/
|
||||
|
||||
@@ -55,6 +55,28 @@ class Folder extends BaseFolder
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the root folder
|
||||
* @param int $folderId
|
||||
* @return mixed
|
||||
*/
|
||||
public function getRoot($folderId)
|
||||
{
|
||||
|
||||
$folder = FolderQuery::create()->findOneById($folderId);
|
||||
|
||||
if(0 !== $folder->getParent()) {
|
||||
$parentFolder = FolderQuery::create()->findOneById($folder->getParent());
|
||||
|
||||
if (null !== $parentFolder) {
|
||||
$folderId = $this->getRoot($parentFolder->getId());
|
||||
}
|
||||
}
|
||||
|
||||
return $folderId;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate next position relative to our parent
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user