diff --git a/core/lib/Thelia/Action/BaseAction.php b/core/lib/Thelia/Action/BaseAction.php index e207a624e..ece8b376b 100755 --- a/core/lib/Thelia/Action/BaseAction.php +++ b/core/lib/Thelia/Action/BaseAction.php @@ -95,7 +95,7 @@ class BaseAction ->setLocale($event->getLocale()) ->setMetaTitle($event->getMetaTitle()) ->setMetaDescription($event->getMetaDescription()) - ->setMetaKeyword($event->getMetaKeyword()) + ->setMetaKeywords($event->getMetaKeywords()) ->save() ; diff --git a/core/lib/Thelia/Action/Category.php b/core/lib/Thelia/Action/Category.php index ac68baa6a..9d895c7de 100755 --- a/core/lib/Thelia/Action/Category.php +++ b/core/lib/Thelia/Action/Category.php @@ -25,8 +25,7 @@ namespace Thelia\Action; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Thelia\Exception\UrlRewritingException; -use Thelia\Form\Exception\FormValidationException; +use Thelia\Core\Event\UpdateSeoEvent; use Thelia\Model\CategoryQuery; use Thelia\Model\Category as CategoryModel; @@ -74,8 +73,6 @@ class Category extends BaseAction implements EventSubscriberInterface */ public function update(CategoryUpdateEvent $event) { - $search = CategoryQuery::create(); - if (null !== $category = CategoryQuery::create()->findPk($event->getCategoryId())) { $category @@ -92,17 +89,22 @@ class Category extends BaseAction implements EventSubscriberInterface ->save(); - // Update the rewritten URL, if required - try { - $category->setRewrittenUrl($event->getLocale(), $event->getUrl()); - } catch(UrlRewritingException $e) { - throw new FormValidationException($e->getMessage(), $e->getCode()); - } - $event->setCategory($category); } } + /** + * Change a Category SEO + * + * @param \Thelia\Core\Event\UpdateSeoEvent $event + * + * @return mixed + */ + public function updateSeo(UpdateSeoEvent $event) + { + return $this->genericUpdateSeo(CategoryQuery::create(), $event); + } + /** * Delete a category entry * @@ -190,6 +192,7 @@ class Category extends BaseAction implements EventSubscriberInterface TheliaEvents::CATEGORY_TOGGLE_VISIBILITY => array("toggleVisibility", 128), TheliaEvents::CATEGORY_UPDATE_POSITION => array("updatePosition", 128), + TheliaEvents::CATEGORY_UPDATE_SEO => array("updateSeo", 128), TheliaEvents::CATEGORY_ADD_CONTENT => array("addContent", 128), TheliaEvents::CATEGORY_REMOVE_CONTENT => array("removeContent", 128), diff --git a/core/lib/Thelia/Action/Content.php b/core/lib/Thelia/Action/Content.php index d3dbdbba8..986698220 100644 --- a/core/lib/Thelia/Action/Content.php +++ b/core/lib/Thelia/Action/Content.php @@ -32,8 +32,7 @@ use Thelia\Core\Event\Content\ContentToggleVisibilityEvent; use Thelia\Core\Event\Content\ContentUpdateEvent; use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\UpdatePositionEvent; -use Thelia\Exception\UrlRewritingException; -use Thelia\Form\Exception\FormValidationException; +use Thelia\Core\Event\UpdateSeoEvent; use Thelia\Model\ContentFolder; use Thelia\Model\ContentFolderQuery; use Thelia\Model\ContentQuery; @@ -81,19 +80,24 @@ class Content extends BaseAction implements EventSubscriberInterface ->save() ; - // Update the rewritten URL, if required - try { - $content->setRewrittenUrl($event->getLocale(), $event->getUrl()); - } catch(UrlRewritingException $e) { - throw new FormValidationException($e->getMessage(), $e->getCode()); - } - $content->updateDefaultFolder($event->getDefaultFolder()); $event->setContent($content); } } + /** + * Change Content SEO + * + * @param \Thelia\Core\Event\UpdateSeoEvent $event + * + * @return mixed + */ + public function updateSeo(UpdateSeoEvent $event) + { + return $this->genericUpdateSeo(ContentQuery::create(), $event); + } + public function updatePosition(UpdatePositionEvent $event) { if (null !== $content = ContentQuery::create()->findPk($event->getObjectId())) { @@ -203,6 +207,7 @@ class Content extends BaseAction implements EventSubscriberInterface TheliaEvents::CONTENT_TOGGLE_VISIBILITY => array('toggleVisibility', 128), TheliaEvents::CONTENT_UPDATE_POSITION => array('updatePosition', 128), + TheliaEvents::CONTENT_UPDATE_SEO => array('updateSeo', 128), TheliaEvents::CONTENT_ADD_FOLDER => array('addFolder', 128), TheliaEvents::CONTENT_REMOVE_FOLDER => array('removeFolder', 128), diff --git a/core/lib/Thelia/Action/Folder.php b/core/lib/Thelia/Action/Folder.php index df849898c..2eece4095 100644 --- a/core/lib/Thelia/Action/Folder.php +++ b/core/lib/Thelia/Action/Folder.php @@ -29,8 +29,7 @@ use Thelia\Core\Event\Folder\FolderToggleVisibilityEvent; use Thelia\Core\Event\Folder\FolderUpdateEvent; use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\UpdatePositionEvent; -use Thelia\Exception\UrlRewritingException; -use Thelia\Form\Exception\FormValidationException; +use Thelia\Core\Event\UpdateSeoEvent; use Thelia\Model\FolderQuery; use Thelia\Model\Folder as FolderModel; @@ -58,17 +57,22 @@ class Folder extends BaseAction implements EventSubscriberInterface ->save(); ; - // Update the rewritten URL, if required - try { - $folder->setRewrittenUrl($event->getLocale(), $event->getUrl()); - } catch(UrlRewritingException $e) { - throw new FormValidationException($e->getMessage(), $e->getCode()); - } - $event->setFolder($folder); } } + /** + * Change Folder SEO + * + * @param \Thelia\Core\Event\UpdateSeoEvent $event + * + * @return mixed + */ + public function updateSeo(UpdateSeoEvent $event) + { + return $this->genericUpdateSeo(FolderQuery::create(), $event); + } + public function delete(FolderDeleteEvent $event) { if (null !== $folder = FolderQuery::create()->findPk($event->getFolderId())) { @@ -158,6 +162,7 @@ class Folder extends BaseAction implements EventSubscriberInterface TheliaEvents::FOLDER_TOGGLE_VISIBILITY => array("toggleVisibility", 128), TheliaEvents::FOLDER_UPDATE_POSITION => array("updatePosition", 128), + TheliaEvents::FOLDER_UPDATE_SEO => array('updateSeo', 128) ); } } diff --git a/core/lib/Thelia/Config/Resources/routing/admin.xml b/core/lib/Thelia/Config/Resources/routing/admin.xml index b821e775c..30238fdac 100755 --- a/core/lib/Thelia/Config/Resources/routing/admin.xml +++ b/core/lib/Thelia/Config/Resources/routing/admin.xml @@ -211,6 +211,10 @@ Thelia\Controller\Admin\CategoryController::processUpdateAction + + Thelia\Controller\Admin\CategoryController::processUpdateSeoAction + + Thelia\Controller\Admin\CategoryController::setToggleVisibilityAction @@ -418,6 +422,10 @@ Thelia\Controller\Admin\FolderController::processUpdateAction + + Thelia\Controller\Admin\FolderController::processUpdateSeoAction + + Thelia\Controller\Admin\FolderController::deleteAction @@ -440,6 +448,10 @@ Thelia\Controller\Admin\ContentController::processUpdateAction + + Thelia\Controller\Admin\ContentController::processUpdateSeoAction + + Thelia\Controller\Admin\ContentController::updatePositionAction diff --git a/core/lib/Thelia/Controller/Admin/AbstractSeoCrudController.php b/core/lib/Thelia/Controller/Admin/AbstractSeoCrudController.php index 744c4af17..241809399 100644 --- a/core/lib/Thelia/Controller/Admin/AbstractSeoCrudController.php +++ b/core/lib/Thelia/Controller/Admin/AbstractSeoCrudController.php @@ -121,13 +121,37 @@ abstract class AbstractSeoCrudController extends AbstractCrudController ->setLocale($formData['locale']) ->setMetaTitle($formData['meta_title']) ->setMetaDescription($formData['meta_description']) - ->setMetaKeyword($formData['meta_keyword']) + ->setMetaKeywords($formData['meta_keywords']) ; // Create and dispatch the change event return $updateSeoEvent; } + /** + * Hydrate the SEO form for this object, before passing it to the update template + * + * @param unknown $object + */ + protected function hydrateSeoForm($object){ + // The "SEO" tab form + $locale = $object->getLocale(); + $data = array( + 'id' => $object->getId(), + 'locale' => $locale, + 'url' => $object->getRewrittenUrl($this->getCurrentEditionLocale()), + 'meta_title' => $object->getMetaTitle(), + 'meta_description' => $object->getMetaDescription(), + 'meta_keywords' => $object->getMetaKeywords() + ); + + $seoForm = new SeoForm($this->getRequest(), "form", $data); + $this->getParserContext()->addForm($seoForm); + + // URL based on the language + $this->getParserContext()->set('url_language', $this->getUrlLanguage($locale)); + } + /** * Update SEO modification, and either go back to the object list, or stay on the edition page. * diff --git a/core/lib/Thelia/Controller/Admin/CategoryController.php b/core/lib/Thelia/Controller/Admin/CategoryController.php index 3a8428766..bb37c046f 100755 --- a/core/lib/Thelia/Controller/Admin/CategoryController.php +++ b/core/lib/Thelia/Controller/Admin/CategoryController.php @@ -47,7 +47,7 @@ use Thelia\Model\CategoryAssociatedContentQuery; * * @author Franck Allimant */ -class CategoryController extends AbstractCrudController +class CategoryController extends AbstractSeoCrudController { public function __construct() { @@ -62,7 +62,8 @@ class CategoryController extends AbstractCrudController TheliaEvents::CATEGORY_UPDATE, TheliaEvents::CATEGORY_DELETE, TheliaEvents::CATEGORY_TOGGLE_VISIBILITY, - TheliaEvents::CATEGORY_UPDATE_POSITION + TheliaEvents::CATEGORY_UPDATE_POSITION, + TheliaEvents::CATEGORY_UPDATE_SEO ); } @@ -102,7 +103,6 @@ class CategoryController extends AbstractCrudController ->setDescription($formData['description']) ->setPostscriptum($formData['postscriptum']) ->setVisible($formData['visible']) - ->setUrl($formData['url']) ->setParent($formData['parent']) ; @@ -130,7 +130,10 @@ class CategoryController extends AbstractCrudController protected function hydrateObjectForm($object) { - // Prepare the data that will hydrate the form + // Hydrate the "SEO" tab form + $this->hydrateSeoForm($object); + + // The "General" tab form $data = array( 'id' => $object->getId(), 'locale' => $object->getLocale(), @@ -139,7 +142,6 @@ class CategoryController extends AbstractCrudController 'description' => $object->getDescription(), 'postscriptum' => $object->getPostscriptum(), 'visible' => $object->getVisible(), - 'url' => $object->getRewrittenUrl($this->getCurrentEditionLocale()), 'parent' => $object->getParent() ); diff --git a/core/lib/Thelia/Controller/Admin/ContentController.php b/core/lib/Thelia/Controller/Admin/ContentController.php index 82d9ec8bd..bcb588800 100644 --- a/core/lib/Thelia/Controller/Admin/ContentController.php +++ b/core/lib/Thelia/Controller/Admin/ContentController.php @@ -41,7 +41,7 @@ use Thelia\Model\ContentQuery; * @package Thelia\Controller\Admin * @author manuel raynaud */ -class ContentController extends AbstractCrudController +class ContentController extends AbstractSeoCrudController { public function __construct() @@ -57,7 +57,8 @@ class ContentController extends AbstractCrudController TheliaEvents::CONTENT_UPDATE, TheliaEvents::CONTENT_DELETE, TheliaEvents::CONTENT_TOGGLE_VISIBILITY, - TheliaEvents::CONTENT_UPDATE_POSITION + TheliaEvents::CONTENT_UPDATE_POSITION, + TheliaEvents::CONTENT_UPDATE_SEO ); } @@ -140,6 +141,9 @@ class ContentController extends AbstractCrudController */ protected function hydrateObjectForm($object) { + // Hydrate the "SEO" tab form + $this->hydrateSeoForm($object); + // Prepare the data that will hydrate the form $data = array( 'id' => $object->getId(), @@ -148,8 +152,7 @@ class ContentController extends AbstractCrudController 'chapo' => $object->getChapo(), 'description' => $object->getDescription(), 'postscriptum' => $object->getPostscriptum(), - 'visible' => $object->getVisible(), - 'url' => $object->getRewrittenUrl($this->getCurrentEditionLocale()), + 'visible' => $object->getVisible() ); // Setup the object form @@ -191,7 +194,6 @@ class ContentController extends AbstractCrudController ->setDescription($formData['description']) ->setPostscriptum($formData['postscriptum']) ->setVisible($formData['visible']) - ->setUrl($formData['url']) ->setDefaultFolder($formData['default_folder']); return $contentUpdateEvent; diff --git a/core/lib/Thelia/Controller/Admin/FolderController.php b/core/lib/Thelia/Controller/Admin/FolderController.php index e35d659d1..779af2306 100644 --- a/core/lib/Thelia/Controller/Admin/FolderController.php +++ b/core/lib/Thelia/Controller/Admin/FolderController.php @@ -38,7 +38,7 @@ use Thelia\Model\FolderQuery; * @package Thelia\Controller\Admin * @author Manuel Raynaud */ -class FolderController extends AbstractCrudController +class FolderController extends AbstractSeoCrudController { public function __construct() @@ -54,7 +54,8 @@ class FolderController extends AbstractCrudController TheliaEvents::FOLDER_UPDATE, TheliaEvents::FOLDER_DELETE, TheliaEvents::FOLDER_TOGGLE_VISIBILITY, - TheliaEvents::FOLDER_UPDATE_POSITION + TheliaEvents::FOLDER_UPDATE_POSITION, + TheliaEvents::FOLDER_UPDATE_SEO ); } @@ -81,6 +82,9 @@ class FolderController extends AbstractCrudController */ protected function hydrateObjectForm($object) { + // Hydrate the "SEO" tab form + $this->hydrateSeoForm($object); + // Prepare the data that will hydrate the form $data = array( 'id' => $object->getId(), @@ -90,7 +94,6 @@ class FolderController extends AbstractCrudController 'description' => $object->getDescription(), 'postscriptum' => $object->getPostscriptum(), 'visible' => $object->getVisible(), - 'url' => $object->getRewrittenUrl($this->getCurrentEditionLocale()), 'parent' => $object->getParent() ); @@ -132,7 +135,6 @@ class FolderController extends AbstractCrudController ->setDescription($formData['description']) ->setPostscriptum($formData['postscriptum']) ->setVisible($formData['visible']) - ->setUrl($formData['url']) ->setParent($formData['parent']) ; diff --git a/core/lib/Thelia/Controller/Admin/ProductController.php b/core/lib/Thelia/Controller/Admin/ProductController.php index 18fd5abad..b971f00c2 100644 --- a/core/lib/Thelia/Controller/Admin/ProductController.php +++ b/core/lib/Thelia/Controller/Admin/ProductController.php @@ -68,7 +68,6 @@ use Thelia\Form\ProductModificationForm; use Thelia\Form\ProductSaleElementUpdateForm; use Thelia\Form\ProductDefaultSaleElementUpdateForm; use Thelia\Form\ProductCombinationGenerationForm; -use Thelia\Form\SeoForm; use Thelia\TaxEngine\Calculator; use Thelia\Tools\NumberFormat; @@ -314,23 +313,8 @@ class ProductController extends AbstractSeoCrudController $this->getParserContext()->addForm($combinationPseForm); } - // The "SEO" tab form - $locale = $object->getLocale(); - $data = array( - 'id' => $object->getId(), - 'locale' => $locale, - 'url' => $object->getRewrittenUrl($this->getCurrentEditionLocale()), - 'meta_title' => $object->getMetaTitle(), - 'meta_description' => $object->getMetaDescription(), - 'meta_keyword' => $object->getMetaKeyword() - ); - - $seoForm = new SeoForm($this->getRequest(), "form", $data); - $this->getParserContext()->addForm($seoForm); - - // URL based on the language - $this->getParserContext()->set('url_language', $this->getUrlLanguage($locale)); - + // Hydrate the "SEO" tab form + $this->hydrateSeoForm($object); // The "General" tab form $data = array( diff --git a/core/lib/Thelia/Core/Event/Category/CategoryUpdateEvent.php b/core/lib/Thelia/Core/Event/Category/CategoryUpdateEvent.php index d04e8da08..1ed2c5fe4 100644 --- a/core/lib/Thelia/Core/Event/Category/CategoryUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/Category/CategoryUpdateEvent.php @@ -33,7 +33,6 @@ class CategoryUpdateEvent extends CategoryCreateEvent protected $description; protected $postscriptum; - protected $url; protected $parent; public function __construct($category_id) @@ -89,18 +88,6 @@ class CategoryUpdateEvent extends CategoryCreateEvent return $this; } - public function getUrl() - { - return $this->url; - } - - public function setUrl($url) - { - $this->url = $url; - - return $this; - } - public function getParent() { return $this->parent; diff --git a/core/lib/Thelia/Core/Event/Content/ContentUpdateEvent.php b/core/lib/Thelia/Core/Event/Content/ContentUpdateEvent.php index fb5bdfb5e..3cab32425 100644 --- a/core/lib/Thelia/Core/Event/Content/ContentUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/Content/ContentUpdateEvent.php @@ -36,8 +36,6 @@ class ContentUpdateEvent extends ContentCreateEvent protected $description; protected $postscriptum; - protected $url; - public function __construct($content_id) { $this->content_id = $content_id; @@ -123,24 +121,4 @@ class ContentUpdateEvent extends ContentCreateEvent return $this->postscriptum; } - /** - * @param mixed $url - * - * @return $this - */ - public function setUrl($url) - { - $this->url = $url; - - return $this; - } - - /** - * @return mixed - */ - public function getUrl() - { - return $this->url; - } - } diff --git a/core/lib/Thelia/Core/Event/Folder/FolderUpdateEvent.php b/core/lib/Thelia/Core/Event/Folder/FolderUpdateEvent.php index bb4234d6c..e88026b85 100644 --- a/core/lib/Thelia/Core/Event/Folder/FolderUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/Folder/FolderUpdateEvent.php @@ -37,8 +37,6 @@ class FolderUpdateEvent extends FolderCreateEvent protected $description; protected $postscriptum; - protected $url; - public function __construct($folder_id) { $this->folder_id = $folder_id; @@ -116,22 +114,4 @@ class FolderUpdateEvent extends FolderCreateEvent return $this->postscriptum; } - /** - * @param mixed $url - */ - public function setUrl($url) - { - $this->url = $url; - - return $this; - } - - /** - * @return mixed - */ - public function getUrl() - { - return $this->url; - } - } diff --git a/core/lib/Thelia/Core/Event/TheliaEvents.php b/core/lib/Thelia/Core/Event/TheliaEvents.php index 7e22dc938..cba6bb6c2 100755 --- a/core/lib/Thelia/Core/Event/TheliaEvents.php +++ b/core/lib/Thelia/Core/Event/TheliaEvents.php @@ -181,6 +181,7 @@ final class TheliaEvents const FOLDER_DELETE = "action.deleteFolder"; const FOLDER_TOGGLE_VISIBILITY = "action.toggleFolderVisibility"; const FOLDER_UPDATE_POSITION = "action.updateFolderPosition"; + const FOLDER_UPDATE_SEO = "action.updateFolderSeo"; const BEFORE_CREATEFOLDER = "action.before_createFolder"; const AFTER_CREATEFOLDER = "action.after_createFolder"; diff --git a/core/lib/Thelia/Core/Event/UpdateSeoEvent.php b/core/lib/Thelia/Core/Event/UpdateSeoEvent.php index 99b19efe8..0c81a3469 100644 --- a/core/lib/Thelia/Core/Event/UpdateSeoEvent.php +++ b/core/lib/Thelia/Core/Event/UpdateSeoEvent.php @@ -30,25 +30,40 @@ class UpdateSeoEvent extends ActionEvent protected $url; protected $meta_title; protected $meta_description; - protected $meta_keyword; + protected $meta_keywords; protected $object; - public function __construct($object_id, $locale = null, $url = null, $meta_title = null, $meta_description = null, $meta_keyword = null) + /** + * @param $object_id + * @param null $locale + * @param null $url + * @param null $meta_title + * @param null $meta_description + * @param null $meta_keywords + */ + public function __construct($object_id, $locale = null, $url = null, $meta_title = null, $meta_description = null, $meta_keywords = null) { $this->object_id = $object_id; $this->locale = $locale; $this->url = $url; $this->meta_title = $meta_title; $this->meta_description = $meta_description; - $this->meta_keyword = $meta_keyword; + $this->meta_keywords = $meta_keywords; } + /** + * @return mixed + */ public function getObjectId() { return $this->object_id; } + /** + * @param $object_id + * @return $this + */ public function setObjectId($object_id) { $this->object_id = $object_id; @@ -56,11 +71,18 @@ class UpdateSeoEvent extends ActionEvent return $this; } + /** + * @return null + */ public function getLocale() { return $this->locale; } + /** + * @param $locale + * @return $this + */ public function setLocale($locale) { $this->locale = $locale; @@ -68,11 +90,18 @@ class UpdateSeoEvent extends ActionEvent return $this; } + /** + * @return null + */ public function getUrl() { return $this->url; } + /** + * @param $url + * @return $this + */ public function setUrl($url) { $this->url = $url; @@ -80,23 +109,18 @@ class UpdateSeoEvent extends ActionEvent return $this; } - public function getParent() - { - return $this->parent; - } - - public function setParent($parent) - { - $this->parent = $parent; - - return $this; - } - + /** + * @return null + */ public function getMetaTitle() { return $this->meta_title; } + /** + * @param $meta_title + * @return $this + */ public function setMetaTitle($meta_title) { $this->meta_title = $meta_title; @@ -104,11 +128,18 @@ class UpdateSeoEvent extends ActionEvent return $this; } + /** + * @return null + */ public function getMetaDescription() { return $this->meta_description; } + /** + * @param $meta_description + * @return $this + */ public function setMetaDescription($meta_description) { $this->meta_description = $meta_description; @@ -116,14 +147,21 @@ class UpdateSeoEvent extends ActionEvent return $this; } - public function getMetaKeyword() + /** + * @return null + */ + public function getMetaKeywords() { - return $this->meta_keyword; + return $this->meta_keywords; } - public function setMetaKeyword($meta_keyword) + /** + * @param $meta_keywords + * @return $this + */ + public function setMetaKeywords($meta_keywords) { - $this->meta_keyword = $meta_keyword; + $this->meta_keywords = $meta_keywords; return $this; } diff --git a/core/lib/Thelia/Core/Template/Loop/Category.php b/core/lib/Thelia/Core/Template/Loop/Category.php index b03f6dbb0..922f3161b 100755 --- a/core/lib/Thelia/Core/Template/Loop/Category.php +++ b/core/lib/Thelia/Core/Template/Loop/Category.php @@ -96,7 +96,7 @@ class Category extends BaseI18nLoop implements PropelSearchLoopInterface $search = CategoryQuery::create(); /* manage translations */ - $this->configureI18nProcessing($search); + $this->configureI18nProcessing($search, array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM', 'META_TITLE', 'META_DESCRIPTION', 'META_KEYWORDS')); $id = $this->getId(); @@ -213,25 +213,28 @@ class Category extends BaseI18nLoop implements PropelSearchLoopInterface $loopResultRow = new LoopResultRow($category); $loopResultRow - ->set("ID", $category->getId()) - ->set("IS_TRANSLATED",$category->getVirtualColumn('IS_TRANSLATED')) - ->set("LOCALE",$this->locale) - ->set("TITLE", $category->getVirtualColumn('i18n_TITLE')) - ->set("CHAPO", $category->getVirtualColumn('i18n_CHAPO')) - ->set("DESCRIPTION", $category->getVirtualColumn('i18n_DESCRIPTION')) - ->set("POSTSCRIPTUM", $category->getVirtualColumn('i18n_POSTSCRIPTUM')) - ->set("PARENT", $category->getParent()) - ->set("URL", $category->getUrl($this->locale)) - ->set("PRODUCT_COUNT", $category->countAllProducts()) - ->set("CHILD_COUNT", $category->countChild()) - ->set("VISIBLE", $category->getVisible() ? "1" : "0") - ->set("POSITION", $category->getPosition()) + ->set("ID" , $category->getId()) + ->set("IS_TRANSLATED" ,$category->getVirtualColumn('IS_TRANSLATED')) + ->set("LOCALE" ,$this->locale) + ->set("TITLE" , $category->getVirtualColumn('i18n_TITLE')) + ->set("CHAPO" , $category->getVirtualColumn('i18n_CHAPO')) + ->set("DESCRIPTION" , $category->getVirtualColumn('i18n_DESCRIPTION')) + ->set("POSTSCRIPTUM" , $category->getVirtualColumn('i18n_POSTSCRIPTUM')) + ->set("PARENT" , $category->getParent()) + ->set("URL" , $category->getUrl($this->locale)) + ->set("META_TITLE" , $category->getVirtualColumn('i18n_META_TITLE')) + ->set("META_DESCRIPTION" , $category->getVirtualColumn('i18n_META_DESCRIPTION')) + ->set("META_KEYWORDS" , $category->getVirtualColumn('i18n_META_KEYWORDS')) + ->set("PRODUCT_COUNT" , $category->countAllProducts()) + ->set("CHILD_COUNT" , $category->countChild()) + ->set("VISIBLE" , $category->getVisible() ? "1" : "0") + ->set("POSITION" , $category->getPosition()) - ->set("HAS_PREVIOUS", $previous != null ? 1 : 0) - ->set("HAS_NEXT" , $next != null ? 1 : 0) + ->set("HAS_PREVIOUS" , $previous != null ? 1 : 0) + ->set("HAS_NEXT" , $next != null ? 1 : 0) - ->set("PREVIOUS", $previous != null ? $previous->getId() : -1) - ->set("NEXT" , $next != null ? $next->getId() : -1) + ->set("PREVIOUS" , $previous != null ? $previous->getId() : -1) + ->set("NEXT" , $next != null ? $next->getId() : -1) ; $loopResult->addRow($loopResultRow); diff --git a/core/lib/Thelia/Core/Template/Loop/Content.php b/core/lib/Thelia/Core/Template/Loop/Content.php index bbf9e2c78..ee028e16d 100755 --- a/core/lib/Thelia/Core/Template/Loop/Content.php +++ b/core/lib/Thelia/Core/Template/Loop/Content.php @@ -85,7 +85,7 @@ class Content extends BaseI18nLoop implements PropelSearchLoopInterface $search = ContentQuery::create(); /* manage translations */ - $this->configureI18nProcessing($search); + $this->configureI18nProcessing($search, array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM', 'META_TITLE', 'META_DESCRIPTION', 'META_KEYWORDS')); $id = $this->getId(); @@ -215,17 +215,21 @@ class Content extends BaseI18nLoop implements PropelSearchLoopInterface foreach ($loopResult->getResultDataCollection() as $content) { $loopResultRow = new LoopResultRow($content); - $loopResultRow->set("ID", $content->getId()) - ->set("IS_TRANSLATED",$content->getVirtualColumn('IS_TRANSLATED')) - ->set("LOCALE",$this->locale) - ->set("TITLE",$content->getVirtualColumn('i18n_TITLE')) - ->set("CHAPO", $content->getVirtualColumn('i18n_CHAPO')) - ->set("DESCRIPTION", $content->getVirtualColumn('i18n_DESCRIPTION')) - ->set("POSTSCRIPTUM", $content->getVirtualColumn('i18n_POSTSCRIPTUM')) - ->set("POSITION", $content->getPosition()) - ->set("DEFAULT_FOLDER", $content->getDefaultFolderId()) - ->set("URL", $content->getUrl($this->locale)) - ->set("VISIBLE", $content->getVisible()) + $loopResultRow->set("ID" , $content->getId()) + ->set("IS_TRANSLATED" , $content->getVirtualColumn('IS_TRANSLATED')) + ->set("LOCALE" , $this->locale) + ->set("TITLE" , $content->getVirtualColumn('i18n_TITLE')) + ->set("CHAPO" , $content->getVirtualColumn('i18n_CHAPO')) + ->set("DESCRIPTION" , $content->getVirtualColumn('i18n_DESCRIPTION')) + ->set("POSTSCRIPTUM" , $content->getVirtualColumn('i18n_POSTSCRIPTUM')) + ->set("URL" , $content->getUrl($this->locale)) + ->set("META_TITLE" , $content->getVirtualColumn('i18n_META_TITLE')) + ->set("META_DESCRIPTION" , $content->getVirtualColumn('i18n_META_DESCRIPTION')) + ->set("META_KEYWORDS" , $content->getVirtualColumn('i18n_META_KEYWORDS')) + ->set("POSITION" , $content->getPosition()) + ->set("DEFAULT_FOLDER" , $content->getDefaultFolderId()) + + ->set("VISIBLE" , $content->getVisible()) ; $loopResult->addRow($loopResultRow); diff --git a/core/lib/Thelia/Core/Template/Loop/Folder.php b/core/lib/Thelia/Core/Template/Loop/Folder.php index 539436983..84dee9f82 100755 --- a/core/lib/Thelia/Core/Template/Loop/Folder.php +++ b/core/lib/Thelia/Core/Template/Loop/Folder.php @@ -78,7 +78,7 @@ class Folder extends BaseI18nLoop implements PropelSearchLoopInterface $search = FolderQuery::create(); /* manage translations */ - $this->configureI18nProcessing($search); + $this->configureI18nProcessing($search, array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM', 'META_TITLE', 'META_DESCRIPTION', 'META_KEYWORDS')); $id = $this->getId(); @@ -164,19 +164,22 @@ class Folder extends BaseI18nLoop implements PropelSearchLoopInterface $loopResultRow = new LoopResultRow($folder); $loopResultRow - ->set("ID", $folder->getId()) - ->set("IS_TRANSLATED",$folder->getVirtualColumn('IS_TRANSLATED')) - ->set("LOCALE",$this->locale) - ->set("TITLE",$folder->getVirtualColumn('i18n_TITLE')) - ->set("CHAPO", $folder->getVirtualColumn('i18n_CHAPO')) - ->set("DESCRIPTION", $folder->getVirtualColumn('i18n_DESCRIPTION')) - ->set("POSTSCRIPTUM", $folder->getVirtualColumn('i18n_POSTSCRIPTUM')) - ->set("PARENT", $folder->getParent()) - ->set("URL", $folder->getUrl($this->locale)) - ->set("CHILD_COUNT", $folder->countChild()) - ->set("CONTENT_COUNT", $folder->countAllContents()) - ->set("VISIBLE", $folder->getVisible() ? "1" : "0") - ->set("POSITION", $folder->getPosition()) + ->set("ID" , $folder->getId()) + ->set("IS_TRANSLATED" , $folder->getVirtualColumn('IS_TRANSLATED')) + ->set("LOCALE" , $this->locale) + ->set("TITLE" , $folder->getVirtualColumn('i18n_TITLE')) + ->set("CHAPO" , $folder->getVirtualColumn('i18n_CHAPO')) + ->set("DESCRIPTION" , $folder->getVirtualColumn('i18n_DESCRIPTION')) + ->set("POSTSCRIPTUM" , $folder->getVirtualColumn('i18n_POSTSCRIPTUM')) + ->set("PARENT" , $folder->getParent()) + ->set("URL" , $folder->getUrl($this->locale)) + ->set("META_TITLE" , $folder->getVirtualColumn('i18n_META_TITLE')) + ->set("META_DESCRIPTION" , $folder->getVirtualColumn('i18n_META_DESCRIPTION')) + ->set("META_KEYWORDS" , $folder->getVirtualColumn('i18n_META_KEYWORDS')) + ->set("CHILD_COUNT" , $folder->countChild()) + ->set("CONTENT_COUNT" , $folder->countAllContents()) + ->set("VISIBLE" , $folder->getVisible() ? "1" : "0") + ->set("POSITION" , $folder->getPosition()) ; $loopResult->addRow($loopResultRow); diff --git a/core/lib/Thelia/Core/Template/Loop/Product.php b/core/lib/Thelia/Core/Template/Loop/Product.php index 09aff4479..c780ee40e 100755 --- a/core/lib/Thelia/Core/Template/Loop/Product.php +++ b/core/lib/Thelia/Core/Template/Loop/Product.php @@ -222,7 +222,7 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL } /* manage translations */ - $this->configureI18nProcessing($search); + $this->configureI18nProcessing($search, array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM', 'META_TITLE', 'META_DESCRIPTION', 'META_KEYWORDS')); $id = $this->getId(); @@ -518,6 +518,9 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL ->set("DESCRIPTION" , $product->getVirtualColumn('i18n_DESCRIPTION')) ->set("POSTSCRIPTUM" , $product->getVirtualColumn('i18n_POSTSCRIPTUM')) ->set("URL" , $product->getUrl($this->locale)) + ->set("META_TITLE" , $product->getVirtualColumn('i18n_META_TITLE')) + ->set("META_DESCRIPTION" , $product->getVirtualColumn('i18n_META_DESCRIPTION')) + ->set("META_KEYWORDS" , $product->getVirtualColumn('i18n_META_KEYWORDS')) ->set("BEST_PRICE" , $product->getVirtualColumn('is_promo') ? $promoPrice : $price) ->set("BEST_PRICE_TAX" , $taxedPrice - $product->getVirtualColumn('is_promo') ? $taxedPromoPrice - $promoPrice : $taxedPrice - $price) ->set("BEST_TAXED_PRICE" , $product->getVirtualColumn('is_promo') ? $taxedPromoPrice : $taxedPrice) @@ -569,7 +572,7 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL $search = ProductQuery::create(); /* manage translations */ - $this->configureI18nProcessing($search); + $this->configureI18nProcessing($search, array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM', 'META_TITLE', 'META_DESCRIPTION', 'META_KEYWORDS')); $attributeNonStrictMatch = $this->getAttribute_non_strict_match(); $isPSELeftJoinList = array(); @@ -1025,6 +1028,9 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL ->set("DESCRIPTION" , $product->getVirtualColumn('i18n_DESCRIPTION')) ->set("POSTSCRIPTUM" , $product->getVirtualColumn('i18n_POSTSCRIPTUM')) ->set("URL" , $product->getUrl($this->locale)) + ->set("META_TITLE" , $product->getVirtualColumn('i18n_META_TITLE')) + ->set("META_DESCRIPTION" , $product->getVirtualColumn('i18n_META_DESCRIPTION')) + ->set("META_KEYWORDS" , $product->getVirtualColumn('i18n_META_KEYWORDS')) ->set("BEST_PRICE" , $price) ->set("BEST_PRICE_TAX" , $taxedPrice - $price) ->set("BEST_TAXED_PRICE" , $taxedPrice) diff --git a/core/lib/Thelia/Form/CategoryModificationForm.php b/core/lib/Thelia/Form/CategoryModificationForm.php index 567f9e41f..a4463126d 100644 --- a/core/lib/Thelia/Form/CategoryModificationForm.php +++ b/core/lib/Thelia/Form/CategoryModificationForm.php @@ -23,8 +23,6 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints\GreaterThan; -use Thelia\Core\Translation\Translator; -use Symfony\Component\Validator\Constraints\NotBlank; class CategoryModificationForm extends CategoryCreationForm { @@ -36,12 +34,6 @@ class CategoryModificationForm extends CategoryCreationForm $this->formBuilder ->add("id", "hidden", array("constraints" => array(new GreaterThan(array('value' => 0))))) - - ->add("url", "text", array( - "label" => Translator::getInstance()->trans("Rewritten URL *"), - "constraints" => array(new NotBlank()), - "label_attr" => array("for" => "rewriten_url") - )) ; // Add standard description fields, excluding title and locale, which a re defined in parent class diff --git a/core/lib/Thelia/Form/ContentModificationForm.php b/core/lib/Thelia/Form/ContentModificationForm.php index c3887b88e..b0130b2d2 100644 --- a/core/lib/Thelia/Form/ContentModificationForm.php +++ b/core/lib/Thelia/Form/ContentModificationForm.php @@ -24,8 +24,6 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints\GreaterThan; -use Symfony\Component\Validator\Constraints\NotBlank; -use Thelia\Core\Translation\Translator; use Thelia\Form\StandardDescriptionFieldsTrait; /** @@ -43,12 +41,6 @@ class ContentModificationForm extends ContentCreationForm $this->formBuilder ->add("id", "hidden", array("constraints" => array(new GreaterThan(array('value' => 0))))) - - ->add("url", "text", array( - "label" => Translator::getInstance()->trans("Rewritten URL *"), - "constraints" => array(new NotBlank()), - "label_attr" => array("for" => "rewritten_url") - )) ; // Add standard description fields, excluding title and locale, which a re defined in parent class diff --git a/core/lib/Thelia/Form/FolderModificationForm.php b/core/lib/Thelia/Form/FolderModificationForm.php index 9c4e4c601..daab3b5ad 100644 --- a/core/lib/Thelia/Form/FolderModificationForm.php +++ b/core/lib/Thelia/Form/FolderModificationForm.php @@ -23,8 +23,6 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints\GreaterThan; -use Thelia\Core\Translation\Translator; -use Symfony\Component\Validator\Constraints\NotBlank; class FolderModificationForm extends FolderCreationForm { @@ -36,12 +34,6 @@ class FolderModificationForm extends FolderCreationForm $this->formBuilder ->add("id", "hidden", array("constraints" => array(new GreaterThan(array('value' => 0))))) - - ->add("url", "text", array( - "label" => Translator::getInstance()->trans("Rewritten URL *"), - "constraints" => array(new NotBlank()), - "label_attr" => array("for" => "rewriten_url") - )) ; // Add standard description fields, excluding title and locale, which a re defined in parent class diff --git a/core/lib/Thelia/Form/SeoFieldsTrait.php b/core/lib/Thelia/Form/SeoFieldsTrait.php index dd66324d8..5b3270793 100644 --- a/core/lib/Thelia/Form/SeoFieldsTrait.php +++ b/core/lib/Thelia/Form/SeoFieldsTrait.php @@ -75,12 +75,12 @@ trait SeoFieldsTrait ) ); - if (! in_array('meta_keyword', $exclude)) + if (! in_array('meta_keywords', $exclude)) $this->formBuilder - ->add('meta_keyword', 'text', array( - 'label' => Translator::getInstance()->trans('Meta Keyword'), + ->add('meta_keywords', 'text', array( + 'label' => Translator::getInstance()->trans('Meta Keywords'), 'label_attr' => array( - 'for' => 'meta_keyword' + 'for' => 'meta_keywords' ), 'required' => false ) diff --git a/templates/backOffice/default/category-edit.html b/templates/backOffice/default/category-edit.html index 7225ddf6e..546fd7a74 100755 --- a/templates/backOffice/default/category-edit.html +++ b/templates/backOffice/default/category-edit.html @@ -42,6 +42,7 @@