start rewriting

This commit is contained in:
Etienne Roudeix
2013-08-29 08:49:48 +02:00
parent 253a0b76d8
commit 696b871acd
27 changed files with 173 additions and 43 deletions

View File

@@ -4,6 +4,7 @@ namespace Thelia\Model;
use Thelia\Model\Base\Category as BaseCategory;
use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Tools\URL;
class Category extends BaseCategory
{
@@ -15,8 +16,9 @@ class Category extends BaseCategory
return CategoryQuery::countChild($this->getId());
}
public function getUrl()
public function getUrl($locale)
{
return URL::retrieve('category', $this->getId(), $locale);
}
/**

View File

@@ -22,4 +22,14 @@ class ConfigQuery extends BaseConfigQuery {
return $value ? $value->getValue() : $default;
}
public static function getDefaultLangWhenNoTranslationAvailable()
{
return ConfigQuery::read("default_lang_without_translation", 1);
}
public static function isRewritingEnable()
{
return self::read("rewriting_enable") == 1;
}
} // ConfigQuery

View File

@@ -3,11 +3,12 @@
namespace Thelia\Model;
use Thelia\Model\Base\Content as BaseContent;
use Thelia\Tools\URL;
class Content extends BaseContent
{
public function getUrl()
public function getUrl($locale)
{
return URL::retrieve('content', $this->getId(), $locale);
}
}

View File

@@ -3,6 +3,7 @@
namespace Thelia\Model;
use Thelia\Model\Base\Folder as BaseFolder;
use Thelia\Tools\URL;
class Folder extends BaseFolder
{
@@ -14,9 +15,9 @@ class Folder extends BaseFolder
return FolderQuery::countChild($this->getId());
}
public function getUrl()
public function getUrl($locale)
{
return URL::retrieve('folder', $this->getId(), $locale);
}
/**

View File

@@ -3,12 +3,12 @@
namespace Thelia\Model;
use Thelia\Model\Base\Product as BaseProduct;
use Thelia\Model\ProductSaleElements;
use Thelia\Tools\URL;
class Product extends BaseProduct
{
public function getUrl()
public function getUrl($locale)
{
return URL::retrieve('product', $this->getId(), $locale);
}
}

View File

@@ -109,10 +109,14 @@ class ModelCriteriaTools
}
}
$askedLocale = $lang === null ? $currentLocale : $localeSearch->getLocale();
if($backendContext) {
self::getBackEndI18n($search, $lang === null ? $currentLocale : $localeSearch->getLocale(), $columns, $foreignTable, $foreignKey);
self::getBackEndI18n($search, $askedLocale, $columns, $foreignTable, $foreignKey);
} else {
self::getFrontEndI18n($search, $defaultLangWithoutTranslation, $lang === null ? $currentLocale : $localeSearch->getLocale(), $columns, $foreignTable, $foreignKey);
self::getFrontEndI18n($search, $defaultLangWithoutTranslation, $askedLocale, $columns, $foreignTable, $foreignKey);
}
return $askedLocale;
}
}