Merge branch 'master' into template
Conflicts: core/lib/Thelia/Controller/Front/AddressController.php
This commit is contained in:
@@ -22,10 +22,14 @@
|
|||||||
/*************************************************************************************/
|
/*************************************************************************************/
|
||||||
|
|
||||||
namespace Thelia\Action;
|
namespace Thelia\Action;
|
||||||
|
use Propel\Runtime\Exception\PropelException;
|
||||||
|
use Propel\Runtime\Propel;
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
use Thelia\Core\Event\AddressCreateOrUpdateEvent;
|
use Thelia\Core\Event\AddressCreateOrUpdateEvent;
|
||||||
|
use Thelia\Core\Event\AddressEvent;
|
||||||
use Thelia\Core\Event\TheliaEvents;
|
use Thelia\Core\Event\TheliaEvents;
|
||||||
use Thelia\Model\Address as AddressModel;
|
use Thelia\Model\Address as AddressModel;
|
||||||
|
use Thelia\Model\Map\AddressTableMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Address
|
* Class Address
|
||||||
@@ -49,31 +53,51 @@ class Address extends BaseAction implements EventSubscriberInterface
|
|||||||
$this->createOrUpdate($addressModel, $event);
|
$this->createOrUpdate($addressModel, $event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function delete(AddressEvent $event)
|
||||||
|
{
|
||||||
|
$address = $event->getAddress();
|
||||||
|
|
||||||
|
$address->delete();
|
||||||
|
}
|
||||||
|
|
||||||
protected function createOrUpdate(AddressModel $addressModel, AddressCreateOrUpdateEvent $event)
|
protected function createOrUpdate(AddressModel $addressModel, AddressCreateOrUpdateEvent $event)
|
||||||
{
|
{
|
||||||
$addressModel->setDispatcher($this->getDispatcher());
|
$addressModel->setDispatcher($this->getDispatcher());
|
||||||
|
$con = Propel::getWriteConnection(AddressTableMap::DATABASE_NAME);
|
||||||
|
$con->beginTransaction();
|
||||||
|
try {
|
||||||
|
if ($addressModel->isNew()) {
|
||||||
|
$addressModel->setLabel($event->getLabel());
|
||||||
|
}
|
||||||
|
|
||||||
if ($addressModel->isNew()) {
|
$addressModel
|
||||||
$addressModel->setLabel($event->getLabel());
|
->setTitleId($event->getTitle())
|
||||||
|
->setFirstname($event->getFirstname())
|
||||||
|
->setLastname($event->getLastname())
|
||||||
|
->setAddress1($event->getAddress1())
|
||||||
|
->setAddress2($event->getAddress2())
|
||||||
|
->setAddress3($event->getAddress3())
|
||||||
|
->setZipcode($event->getZipcode())
|
||||||
|
->setCity($event->getCity())
|
||||||
|
->setCountryId($event->getCountry())
|
||||||
|
->setCellphone($event->getCellphone())
|
||||||
|
->setPhone($event->getPhone())
|
||||||
|
->setCompany($event->getCompany())
|
||||||
|
->save()
|
||||||
|
;
|
||||||
|
|
||||||
|
if($event->getIsDefault()) {
|
||||||
|
$addressModel->makeItDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
$event->setAddress($addressModel);
|
||||||
|
$con->commit();
|
||||||
|
|
||||||
|
} catch(PropelException $e) {
|
||||||
|
$con->rollback();
|
||||||
|
throw $e;
|
||||||
}
|
}
|
||||||
|
|
||||||
$addressModel
|
|
||||||
->setTitleId($event->getTitle())
|
|
||||||
->setFirstname($event->getFirstname())
|
|
||||||
->setLastname($event->getLastname())
|
|
||||||
->setAddress1($event->getAddress1())
|
|
||||||
->setAddress2($event->getAddress2())
|
|
||||||
->setAddress3($event->getAddress3())
|
|
||||||
->setZipcode($event->getZipcode())
|
|
||||||
->setCity($event->getCity())
|
|
||||||
->setCountryId($event->getCountry())
|
|
||||||
->setCellphone($event->getCellphone())
|
|
||||||
->setPhone($event->getPhone())
|
|
||||||
->setCompany($event->getCompany())
|
|
||||||
->save()
|
|
||||||
;
|
|
||||||
|
|
||||||
$event->setAddress($addressModel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -100,7 +124,8 @@ class Address extends BaseAction implements EventSubscriberInterface
|
|||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
TheliaEvents::ADDRESS_CREATE => array("create", 128),
|
TheliaEvents::ADDRESS_CREATE => array("create", 128),
|
||||||
TheliaEvents::ADDRESS_UPDATE => array("update", 128)
|
TheliaEvents::ADDRESS_UPDATE => array("update", 128),
|
||||||
|
TheliaEvents::ADDRESS_DELETE => array("delete", 128)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ use Thelia\Model\ConfigQuery;
|
|||||||
use Thelia\Model\AttributeAv;
|
use Thelia\Model\AttributeAv;
|
||||||
use Thelia\Model\AttributeAvQuery;
|
use Thelia\Model\AttributeAvQuery;
|
||||||
use Thelia\Core\Event\UpdatePositionEvent;
|
use Thelia\Core\Event\UpdatePositionEvent;
|
||||||
|
use Thelia\Core\Event\CategoryEvent;
|
||||||
|
use Thelia\Core\Event\AttributeEvent;
|
||||||
|
|
||||||
class Attribute extends BaseAction implements EventSubscriberInterface
|
class Attribute extends BaseAction implements EventSubscriberInterface
|
||||||
{
|
{
|
||||||
@@ -133,6 +135,24 @@ class Attribute extends BaseAction implements EventSubscriberInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function addToAllTemplates(AttributeEvent $event)
|
||||||
|
{
|
||||||
|
$templates = ProductTemplateAttributeQuery::create()->find();
|
||||||
|
|
||||||
|
foreach($templates as $template) {
|
||||||
|
$pat = new ProductTemplateAttribute();
|
||||||
|
|
||||||
|
$pat->setTemplate($template->getId())
|
||||||
|
->setAttributeId($event->getAttribute()->getId())
|
||||||
|
->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeFromAllTemplates(AttributeEvent $event)
|
||||||
|
{
|
||||||
|
// Delete this attribute from all product templates
|
||||||
|
ProductTemplateAttributeQuery::create()->filterByAttributeId($event->getAttribute()->getId())->delete();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
@@ -144,6 +164,10 @@ class Attribute extends BaseAction implements EventSubscriberInterface
|
|||||||
TheliaEvents::ATTRIBUTE_UPDATE => array("update", 128),
|
TheliaEvents::ATTRIBUTE_UPDATE => array("update", 128),
|
||||||
TheliaEvents::ATTRIBUTE_DELETE => array("delete", 128),
|
TheliaEvents::ATTRIBUTE_DELETE => array("delete", 128),
|
||||||
TheliaEvents::ATTRIBUTE_UPDATE_POSITION => array("updatePosition", 128),
|
TheliaEvents::ATTRIBUTE_UPDATE_POSITION => array("updatePosition", 128),
|
||||||
|
|
||||||
|
TheliaEvents::ATTRIBUTE_REMOVE_FROM_ALL_TEMPLATES => array("removeFromAllTemplates", 128),
|
||||||
|
TheliaEvents::ATTRIBUTE_ADD_TO_ALL_TEMPLATES => array("addToAllTemplates", 128),
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -236,6 +236,14 @@
|
|||||||
<default key="_controller">Thelia\Controller\Admin\AttributeController::updatePositionAction</default>
|
<default key="_controller">Thelia\Controller\Admin\AttributeController::updatePositionAction</default>
|
||||||
</route>
|
</route>
|
||||||
|
|
||||||
|
<route id="admin.configuration.attributes.rem-from-all" path="/admin/configuration/attributes/remove-from-all-templates">
|
||||||
|
<default key="_controller">Thelia\Controller\Admin\AttributeController::removeFromAllTemplates</default>
|
||||||
|
</route>
|
||||||
|
|
||||||
|
<route id="admin.configuration.attributes.add-to-all" path="/admin/configuration/attributes/add-to-all-templates">
|
||||||
|
<default key="_controller">Thelia\Controller\Admin\AttributeController::addToAllTemplates</default>
|
||||||
|
</route>
|
||||||
|
|
||||||
|
|
||||||
<route id="admin.configuration.attributes-av.create" path="/admin/configuration/attributes-av/create">
|
<route id="admin.configuration.attributes-av.create" path="/admin/configuration/attributes-av/create">
|
||||||
<default key="_controller">Thelia\Controller\Admin\AttributeAvController::createAction</default>
|
<default key="_controller">Thelia\Controller\Admin\AttributeAvController::createAction</default>
|
||||||
|
|||||||
@@ -59,18 +59,29 @@
|
|||||||
<!-- end customer routes -->
|
<!-- end customer routes -->
|
||||||
|
|
||||||
<!-- customer address routes -->
|
<!-- customer address routes -->
|
||||||
<route id="address.create" path="/address/create" >
|
<route id="address.create.view" path="/address/create" methods="get">
|
||||||
|
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
|
||||||
|
<default key="_view">address</default>
|
||||||
|
</route>
|
||||||
|
|
||||||
|
<route id="address.create" path="/address/create" methods="post" >
|
||||||
<default key="_controller">Thelia\Controller\Front\AddressController::createAction</default>
|
<default key="_controller">Thelia\Controller\Front\AddressController::createAction</default>
|
||||||
<default key="_view">address</default>
|
<default key="_view">address</default>
|
||||||
</route>
|
</route>
|
||||||
|
|
||||||
<route id="address.edit" path="/address/edit/{address_id}">
|
<route id="address.edit" path="/address/update/{address_id}" methods="get">
|
||||||
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
|
<default key="_controller">Thelia\Controller\Front\AddressController::updateViewAction</default>
|
||||||
<default key="_view">address-edit</default>
|
<default key="_view">address-update</default>
|
||||||
</route>
|
</route>
|
||||||
|
|
||||||
<route id="address.update" path="/address/update" >
|
<route id="address.update" path="/address/update/{address_id}" methods="post" >
|
||||||
<default key="_controller">Thelia\Controller\Front\AddressController::updateAction</default>
|
<default key="_controller">Thelia\Controller\Front\AddressController::processUpdateAction</default>
|
||||||
|
<default key="_view">address-update</default>
|
||||||
|
</route>
|
||||||
|
|
||||||
|
<route id="address.delete" path="/address/delete/{address_id}">
|
||||||
|
<default key="_controller">Thelia\Controller\Front\AddressController::deleteAction</default>
|
||||||
|
<default key="_view">account</default>
|
||||||
</route>
|
</route>
|
||||||
|
|
||||||
<route id="address.generateModal" path="/address/modal/{address_id}" methods="get">
|
<route id="address.generateModal" path="/address/modal/{address_id}" methods="get">
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ abstract class AbstractCrudController extends BaseAdminController
|
|||||||
|
|
||||||
// List ordering
|
// List ordering
|
||||||
protected $defaultListOrder;
|
protected $defaultListOrder;
|
||||||
|
protected $orderRequestParameterName;
|
||||||
|
|
||||||
// Permissions
|
// Permissions
|
||||||
protected $viewPermissionIdentifier;
|
protected $viewPermissionIdentifier;
|
||||||
@@ -74,6 +75,7 @@ abstract class AbstractCrudController extends BaseAdminController
|
|||||||
$objectName,
|
$objectName,
|
||||||
|
|
||||||
$defaultListOrder = null,
|
$defaultListOrder = null,
|
||||||
|
$orderRequestParameterName = null,
|
||||||
|
|
||||||
$viewPermissionIdentifier,
|
$viewPermissionIdentifier,
|
||||||
$createPermissionIdentifier,
|
$createPermissionIdentifier,
|
||||||
@@ -89,8 +91,9 @@ abstract class AbstractCrudController extends BaseAdminController
|
|||||||
$this->objectName = $objectName;
|
$this->objectName = $objectName;
|
||||||
|
|
||||||
$this->defaultListOrder = $defaultListOrder;
|
$this->defaultListOrder = $defaultListOrder;
|
||||||
|
$this->orderRequestParameterName = $orderRequestParameterName;
|
||||||
|
|
||||||
$this->viewPermissionIdentifier = $viewPermissionIdentifier;
|
$this->viewPermissionIdentifier = $viewPermissionIdentifier;
|
||||||
$this->createPermissionIdentifier = $createPermissionIdentifier;
|
$this->createPermissionIdentifier = $createPermissionIdentifier;
|
||||||
$this->updatePermissionIdentifier = $updatePermissionIdentifier;
|
$this->updatePermissionIdentifier = $updatePermissionIdentifier;
|
||||||
$this->deletePermissionIdentifier = $deletePermissionIdentifier;
|
$this->deletePermissionIdentifier = $deletePermissionIdentifier;
|
||||||
@@ -194,36 +197,56 @@ abstract class AbstractCrudController extends BaseAdminController
|
|||||||
protected abstract function redirectToListTemplate();
|
protected abstract function redirectToListTemplate();
|
||||||
|
|
||||||
|
|
||||||
protected function createUpdatePositionEvent($positionChangeMode, $positionValue) {
|
protected function createUpdatePositionEvent($positionChangeMode, $positionValue)
|
||||||
|
{
|
||||||
throw new \LogicException ("Position Update is not supported for this object");
|
throw new \LogicException ("Position Update is not supported for this object");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function createToggleVisibilityEvent() {
|
protected function createToggleVisibilityEvent()
|
||||||
|
{
|
||||||
throw new \LogicException ("Toggle Visibility is not supported for this object");
|
throw new \LogicException ("Toggle Visibility is not supported for this object");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Put in this method post object creation processing if required.
|
||||||
|
*
|
||||||
|
* @param unknown $createdObject the created object
|
||||||
|
*/
|
||||||
|
protected function performAdditionalCreateAction($createdObject)
|
||||||
|
{
|
||||||
|
// Nothing to do
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Put in this method post object update processing if required.
|
||||||
|
*
|
||||||
|
* @param unknown $updatedObject the updated object
|
||||||
|
*/
|
||||||
|
protected function performAdditionalUpdateAction($updatedObject)
|
||||||
|
{
|
||||||
|
// Nothing to do
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Put in this method post object delete processing if required.
|
||||||
|
*
|
||||||
|
* @param unknown $deletedObject the deleted object
|
||||||
|
*/
|
||||||
|
protected function performAdditionalDeleteAction($deletedObject)
|
||||||
|
{
|
||||||
|
// Nothing to do
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the current list order identifier, updating it in the same time.
|
* Return the current list order identifier, updating it in the same time.
|
||||||
*/
|
*/
|
||||||
protected function getCurrentListOrder($update_session = true) {
|
protected function getCurrentListOrder($update_session = true)
|
||||||
|
{
|
||||||
$order = null;
|
return $this->getListOrderFromSession(
|
||||||
|
$this->objectName,
|
||||||
if ($this->defaultListOrder) {
|
$this->orderRequestParameterName,
|
||||||
|
$this->defaultListOrder
|
||||||
$orderSessionIdentifier = sprintf("admin.%s.currentListOrder", $this->objectName);
|
);
|
||||||
|
|
||||||
// Find the current order
|
|
||||||
$order = $this->getRequest()->get(
|
|
||||||
'order',
|
|
||||||
$this->getSession()->get($orderSessionIdentifier, $this->defaultListOrder)
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($update_session) $this->getSession()->set($orderSessionIdentifier, $order);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $order;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -283,6 +306,8 @@ abstract class AbstractCrudController extends BaseAdminController
|
|||||||
$this->adminLogAppend(sprintf("%s %s (ID %s) created", ucfirst($this->objectName), $this->getObjectLabel($createdObject), $this->getObjectId($createdObject)));
|
$this->adminLogAppend(sprintf("%s %s (ID %s) created", ucfirst($this->objectName), $this->getObjectLabel($createdObject), $this->getObjectId($createdObject)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->performAdditionalCreateAction($createdObject);
|
||||||
|
|
||||||
// Substitute _ID_ in the URL with the ID of the created object
|
// Substitute _ID_ in the URL with the ID of the created object
|
||||||
$successUrl = str_replace('_ID_', $this->getObjectId($createdObject), $creationForm->getSuccessUrl());
|
$successUrl = str_replace('_ID_', $this->getObjectId($createdObject), $creationForm->getSuccessUrl());
|
||||||
|
|
||||||
@@ -317,7 +342,7 @@ abstract class AbstractCrudController extends BaseAdminController
|
|||||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||||
|
|
||||||
// Load the object
|
// Load the object
|
||||||
$object = $this->getExistingObject($this->getRequest());
|
$object = $this->getExistingObject();
|
||||||
|
|
||||||
if ($object != null) {
|
if ($object != null) {
|
||||||
|
|
||||||
@@ -368,6 +393,8 @@ abstract class AbstractCrudController extends BaseAdminController
|
|||||||
$this->adminLogAppend(sprintf("%s %s (ID %s) modified", ucfirst($this->objectName), $this->getObjectLabel($changedObject), $this->getObjectId($changedObject)));
|
$this->adminLogAppend(sprintf("%s %s (ID %s) modified", ucfirst($this->objectName), $this->getObjectLabel($changedObject), $this->getObjectId($changedObject)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->performAdditionalUpdateAction($changedObject);
|
||||||
|
|
||||||
// If we have to stay on the same page, do not redirect to the succesUrl,
|
// If we have to stay on the same page, do not redirect to the succesUrl,
|
||||||
// just redirect to the edit page again.
|
// just redirect to the edit page again.
|
||||||
if ($this->getRequest()->get('save_mode') == 'stay') {
|
if ($this->getRequest()->get('save_mode') == 'stay') {
|
||||||
@@ -467,6 +494,7 @@ abstract class AbstractCrudController extends BaseAdminController
|
|||||||
$this->adminLogAppend(
|
$this->adminLogAppend(
|
||||||
sprintf("%s %s (ID %s) deleted", ucfirst($this->objectName), $this->getObjectLabel($deletedObject), $this->getObjectId($deletedObject)));
|
sprintf("%s %s (ID %s) deleted", ucfirst($this->objectName), $this->getObjectLabel($deletedObject), $this->getObjectId($deletedObject)));
|
||||||
}
|
}
|
||||||
|
$this->performAdditionalDeleteAction($deletedObject);
|
||||||
|
|
||||||
$this->redirectToListTemplate();
|
$this->redirectToListTemplate();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,10 +39,12 @@ use Thelia\Core\Event\UpdatePositionEvent;
|
|||||||
*/
|
*/
|
||||||
class AttributeAvController extends AbstractCrudController
|
class AttributeAvController extends AbstractCrudController
|
||||||
{
|
{
|
||||||
public function __construct() {
|
public function __construct()
|
||||||
|
{
|
||||||
parent::__construct(
|
parent::__construct(
|
||||||
'attribute',
|
'attributeav',
|
||||||
'manual',
|
'manual',
|
||||||
|
'order',
|
||||||
|
|
||||||
'admin.configuration.attributes-av.view',
|
'admin.configuration.attributes-av.view',
|
||||||
'admin.configuration.attributes-av.create',
|
'admin.configuration.attributes-av.create',
|
||||||
@@ -57,15 +59,18 @@ class AttributeAvController extends AbstractCrudController
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getCreationForm() {
|
protected function getCreationForm()
|
||||||
|
{
|
||||||
return new AttributeAvCreationForm($this->getRequest());
|
return new AttributeAvCreationForm($this->getRequest());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getUpdateForm() {
|
protected function getUpdateForm()
|
||||||
|
{
|
||||||
return new AttributeAvModificationForm($this->getRequest());
|
return new AttributeAvModificationForm($this->getRequest());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getCreationEvent($formData) {
|
protected function getCreationEvent($formData)
|
||||||
|
{
|
||||||
$createEvent = new AttributeAvCreateEvent();
|
$createEvent = new AttributeAvCreateEvent();
|
||||||
|
|
||||||
$createEvent
|
$createEvent
|
||||||
@@ -77,8 +82,8 @@ class AttributeAvController extends AbstractCrudController
|
|||||||
return $createEvent;
|
return $createEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getUpdateEvent($formData) {
|
protected function getUpdateEvent($formData)
|
||||||
|
{
|
||||||
$changeEvent = new AttributeAvUpdateEvent($formData['id']);
|
$changeEvent = new AttributeAvUpdateEvent($formData['id']);
|
||||||
|
|
||||||
// Create and dispatch the change event
|
// Create and dispatch the change event
|
||||||
@@ -93,8 +98,8 @@ class AttributeAvController extends AbstractCrudController
|
|||||||
return $changeEvent;
|
return $changeEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function createUpdatePositionEvent($positionChangeMode, $positionValue) {
|
protected function createUpdatePositionEvent($positionChangeMode, $positionValue)
|
||||||
|
{
|
||||||
return new UpdatePositionEvent(
|
return new UpdatePositionEvent(
|
||||||
$this->getRequest()->get('attributeav_id', null),
|
$this->getRequest()->get('attributeav_id', null),
|
||||||
$positionChangeMode,
|
$positionChangeMode,
|
||||||
@@ -102,16 +107,18 @@ class AttributeAvController extends AbstractCrudController
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getDeleteEvent() {
|
protected function getDeleteEvent()
|
||||||
|
{
|
||||||
return new AttributeAvDeleteEvent($this->getRequest()->get('attributeav_id'));
|
return new AttributeAvDeleteEvent($this->getRequest()->get('attributeav_id'));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function eventContainsObject($event) {
|
protected function eventContainsObject($event)
|
||||||
|
{
|
||||||
return $event->hasAttributeAv();
|
return $event->hasAttributeAv();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function hydrateObjectForm($object) {
|
protected function hydrateObjectForm($object)
|
||||||
|
{
|
||||||
$data = array(
|
$data = array(
|
||||||
'id' => $object->getId(),
|
'id' => $object->getId(),
|
||||||
'locale' => $object->getLocale(),
|
'locale' => $object->getLocale(),
|
||||||
@@ -125,32 +132,38 @@ class AttributeAvController extends AbstractCrudController
|
|||||||
return new AttributeAvModificationForm($this->getRequest(), "form", $data);
|
return new AttributeAvModificationForm($this->getRequest(), "form", $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getObjectFromEvent($event) {
|
protected function getObjectFromEvent($event)
|
||||||
|
{
|
||||||
return $event->hasAttributeAv() ? $event->getAttributeAv() : null;
|
return $event->hasAttributeAv() ? $event->getAttributeAv() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getExistingObject() {
|
protected function getExistingObject()
|
||||||
|
{
|
||||||
return AttributeAvQuery::create()
|
return AttributeAvQuery::create()
|
||||||
->joinWithI18n($this->getCurrentEditionLocale())
|
->joinWithI18n($this->getCurrentEditionLocale())
|
||||||
->findOneById($this->getRequest()->get('attributeav_id'));
|
->findOneById($this->getRequest()->get('attributeav_id'));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getObjectLabel($object) {
|
protected function getObjectLabel($object)
|
||||||
|
{
|
||||||
return $object->getTitle();
|
return $object->getTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getObjectId($object) {
|
protected function getObjectId($object)
|
||||||
|
{
|
||||||
return $object->getId();
|
return $object->getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getViewArguments() {
|
protected function getViewArguments()
|
||||||
|
{
|
||||||
return array(
|
return array(
|
||||||
'attribute_id' => $this->getRequest()->get('attribute_id'),
|
'attribute_id' => $this->getRequest()->get('attribute_id'),
|
||||||
'order' => $this->getCurrentListOrder()
|
'order' => $this->getCurrentListOrder()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function renderListTemplate($currentOrder) {
|
protected function renderListTemplate($currentOrder)
|
||||||
|
{
|
||||||
// We always return to the attribute edition form
|
// We always return to the attribute edition form
|
||||||
return $this->render(
|
return $this->render(
|
||||||
'attribute-edit',
|
'attribute-edit',
|
||||||
@@ -158,12 +171,14 @@ class AttributeAvController extends AbstractCrudController
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function renderEditionTemplate() {
|
protected function renderEditionTemplate()
|
||||||
|
{
|
||||||
// We always return to the attribute edition form
|
// We always return to the attribute edition form
|
||||||
return $this->render('attribute-edit', $this->getViewArguments());
|
return $this->render('attribute-edit', $this->getViewArguments());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function redirectToEditionTemplate() {
|
protected function redirectToEditionTemplate()
|
||||||
|
{
|
||||||
// We always return to the attribute edition form
|
// We always return to the attribute edition form
|
||||||
$this->redirectToRoute(
|
$this->redirectToRoute(
|
||||||
"admin.configuration.attributes.update",
|
"admin.configuration.attributes.update",
|
||||||
@@ -171,7 +186,8 @@ class AttributeAvController extends AbstractCrudController
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function redirectToListTemplate() {
|
protected function redirectToListTemplate()
|
||||||
|
{
|
||||||
$this->redirectToRoute(
|
$this->redirectToRoute(
|
||||||
"admin.configuration.attributes.update",
|
"admin.configuration.attributes.update",
|
||||||
$this->getViewArguments()
|
$this->getViewArguments()
|
||||||
|
|||||||
@@ -31,6 +31,10 @@ use Thelia\Model\AttributeQuery;
|
|||||||
use Thelia\Form\AttributeModificationForm;
|
use Thelia\Form\AttributeModificationForm;
|
||||||
use Thelia\Form\AttributeCreationForm;
|
use Thelia\Form\AttributeCreationForm;
|
||||||
use Thelia\Core\Event\UpdatePositionEvent;
|
use Thelia\Core\Event\UpdatePositionEvent;
|
||||||
|
use Thelia\Model\AttributeAv;
|
||||||
|
use Thelia\Model\AttributeAvQuery;
|
||||||
|
use Thelia\Core\Event\AttributeAvUpdateEvent;
|
||||||
|
use Thelia\Core\Event\AttributeEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages attributes sent by mail
|
* Manages attributes sent by mail
|
||||||
@@ -39,10 +43,12 @@ use Thelia\Core\Event\UpdatePositionEvent;
|
|||||||
*/
|
*/
|
||||||
class AttributeController extends AbstractCrudController
|
class AttributeController extends AbstractCrudController
|
||||||
{
|
{
|
||||||
public function __construct() {
|
public function __construct()
|
||||||
|
{
|
||||||
parent::__construct(
|
parent::__construct(
|
||||||
'attribute',
|
'attribute',
|
||||||
'manual',
|
'manual',
|
||||||
|
'order',
|
||||||
|
|
||||||
'admin.configuration.attributes.view',
|
'admin.configuration.attributes.view',
|
||||||
'admin.configuration.attributes.create',
|
'admin.configuration.attributes.create',
|
||||||
@@ -57,15 +63,18 @@ class AttributeController extends AbstractCrudController
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getCreationForm() {
|
protected function getCreationForm()
|
||||||
|
{
|
||||||
return new AttributeCreationForm($this->getRequest());
|
return new AttributeCreationForm($this->getRequest());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getUpdateForm() {
|
protected function getUpdateForm()
|
||||||
|
{
|
||||||
return new AttributeModificationForm($this->getRequest());
|
return new AttributeModificationForm($this->getRequest());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getCreationEvent($formData) {
|
protected function getCreationEvent($formData)
|
||||||
|
{
|
||||||
$createEvent = new AttributeCreateEvent();
|
$createEvent = new AttributeCreateEvent();
|
||||||
|
|
||||||
$createEvent
|
$createEvent
|
||||||
@@ -77,8 +86,8 @@ class AttributeController extends AbstractCrudController
|
|||||||
return $createEvent;
|
return $createEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getUpdateEvent($formData) {
|
protected function getUpdateEvent($formData)
|
||||||
|
{
|
||||||
$changeEvent = new AttributeUpdateEvent($formData['id']);
|
$changeEvent = new AttributeUpdateEvent($formData['id']);
|
||||||
|
|
||||||
// Create and dispatch the change event
|
// Create and dispatch the change event
|
||||||
@@ -93,8 +102,31 @@ class AttributeController extends AbstractCrudController
|
|||||||
return $changeEvent;
|
return $changeEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function createUpdatePositionEvent($positionChangeMode, $positionValue) {
|
/**
|
||||||
|
* Process the attributes values (fix it in future version to integrate it in the attribute form as a collection)
|
||||||
|
*
|
||||||
|
* @see \Thelia\Controller\Admin\AbstractCrudController::performAdditionalUpdateAction()
|
||||||
|
*/
|
||||||
|
protected function performAdditionalUpdateAction($updatedObject)
|
||||||
|
{
|
||||||
|
$attr_values = $this->getRequest()->get('attribute_values', null);
|
||||||
|
|
||||||
|
if ($attr_values !== null) {
|
||||||
|
|
||||||
|
foreach($attr_values as $id => $value) {
|
||||||
|
|
||||||
|
$event = new AttributeAvUpdateEvent($id);
|
||||||
|
|
||||||
|
$event->setTitle($value);
|
||||||
|
$event->setLocale($this->getCurrentEditionLocale());
|
||||||
|
|
||||||
|
$this->dispatch(TheliaEvents::ATTRIBUTE_AV_UPDATE, $event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function createUpdatePositionEvent($positionChangeMode, $positionValue)
|
||||||
|
{
|
||||||
return new UpdatePositionEvent(
|
return new UpdatePositionEvent(
|
||||||
$this->getRequest()->get('attribute_id', null),
|
$this->getRequest()->get('attribute_id', null),
|
||||||
$positionChangeMode,
|
$positionChangeMode,
|
||||||
@@ -102,15 +134,18 @@ class AttributeController extends AbstractCrudController
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getDeleteEvent() {
|
protected function getDeleteEvent()
|
||||||
|
{
|
||||||
return new AttributeDeleteEvent($this->getRequest()->get('attribute_id'));
|
return new AttributeDeleteEvent($this->getRequest()->get('attribute_id'));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function eventContainsObject($event) {
|
protected function eventContainsObject($event)
|
||||||
|
{
|
||||||
return $event->hasAttribute();
|
return $event->hasAttribute();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function hydrateObjectForm($object) {
|
protected function hydrateObjectForm($object)
|
||||||
|
{
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'id' => $object->getId(),
|
'id' => $object->getId(),
|
||||||
@@ -121,44 +156,132 @@ class AttributeController extends AbstractCrudController
|
|||||||
'postscriptum' => $object->getPostscriptum()
|
'postscriptum' => $object->getPostscriptum()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Setup attributes values
|
||||||
|
/*
|
||||||
|
* FIXME : doesn't work. "We get a This form should not contain extra fields." error
|
||||||
|
$attr_av_list = AttributeAvQuery::create()
|
||||||
|
->joinWithI18n($this->getCurrentEditionLocale())
|
||||||
|
->filterByAttributeId($object->getId())
|
||||||
|
->find();
|
||||||
|
|
||||||
|
$attr_array = array();
|
||||||
|
|
||||||
|
foreach($attr_av_list as $attr_av) {
|
||||||
|
$attr_array[$attr_av->getId()] = $attr_av->getTitle();
|
||||||
|
}
|
||||||
|
|
||||||
|
$data['attribute_values'] = $attr_array;
|
||||||
|
*/
|
||||||
|
|
||||||
// Setup the object form
|
// Setup the object form
|
||||||
return new AttributeModificationForm($this->getRequest(), "form", $data);
|
return new AttributeModificationForm($this->getRequest(), "form", $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getObjectFromEvent($event) {
|
protected function getObjectFromEvent($event)
|
||||||
|
{
|
||||||
return $event->hasAttribute() ? $event->getAttribute() : null;
|
return $event->hasAttribute() ? $event->getAttribute() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getExistingObject() {
|
protected function getExistingObject()
|
||||||
|
{
|
||||||
return AttributeQuery::create()
|
return AttributeQuery::create()
|
||||||
->joinWithI18n($this->getCurrentEditionLocale())
|
->joinWithI18n($this->getCurrentEditionLocale())
|
||||||
->findOneById($this->getRequest()->get('attribute_id'));
|
->findOneById($this->getRequest()->get('attribute_id'));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getObjectLabel($object) {
|
protected function getObjectLabel($object)
|
||||||
|
{
|
||||||
return $object->getTitle();
|
return $object->getTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getObjectId($object) {
|
protected function getObjectId($object)
|
||||||
|
{
|
||||||
return $object->getId();
|
return $object->getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function renderListTemplate($currentOrder) {
|
protected function renderListTemplate($currentOrder)
|
||||||
|
{
|
||||||
return $this->render('attributes', array('order' => $currentOrder));
|
return $this->render('attributes', array('order' => $currentOrder));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function renderEditionTemplate() {
|
protected function renderEditionTemplate()
|
||||||
return $this->render('attribute-edit', array('attribute_id' => $this->getRequest()->get('attribute_id')));
|
{
|
||||||
}
|
return $this->render(
|
||||||
|
'attribute-edit',
|
||||||
protected function redirectToEditionTemplate() {
|
array(
|
||||||
$this->redirectToRoute(
|
'attribute_id' => $this->getRequest()->get('attribute_id'),
|
||||||
"admin.configuration.attributes.update",
|
'attributeav_order' => $this->getAttributeAvListOrder()
|
||||||
array('attribute_id' => $this->getRequest()->get('attribute_id'))
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function redirectToListTemplate() {
|
protected function redirectToEditionTemplate()
|
||||||
|
{
|
||||||
|
$this->redirectToRoute(
|
||||||
|
"admin.configuration.attributes.update",
|
||||||
|
array(
|
||||||
|
'attribute_id' => $this->getRequest()->get('attribute_id'),
|
||||||
|
'attributeav_order' => $this->getAttributeAvListOrder()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function redirectToListTemplate()
|
||||||
|
{
|
||||||
$this->redirectToRoute('admin.configuration.attributes.default');
|
$this->redirectToRoute('admin.configuration.attributes.default');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the Attribute value list order.
|
||||||
|
*
|
||||||
|
* @return string the current list order
|
||||||
|
*/
|
||||||
|
protected function getAttributeAvListOrder()
|
||||||
|
{
|
||||||
|
return $this->getListOrderFromSession(
|
||||||
|
'attributeav',
|
||||||
|
'attributeav_order',
|
||||||
|
'manual'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add or Remove from all product templates
|
||||||
|
*/
|
||||||
|
protected function addRemoveFromAllTemplates($eventType)
|
||||||
|
{
|
||||||
|
// Check current user authorization
|
||||||
|
if (null !== $response = $this->checkAuth("admin.configuration.attributes.update")) return $response;
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (null !== $object = $this->getExistingObject()) {
|
||||||
|
|
||||||
|
$event = new AttributeEvent($object);
|
||||||
|
|
||||||
|
$this->dispatch($eventType, $event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (\Exception $ex) {
|
||||||
|
// Any error
|
||||||
|
return $this->errorPage($ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->redirectToListTemplate();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove from all product templates
|
||||||
|
*/
|
||||||
|
public function removeFromAllTemplates()
|
||||||
|
{
|
||||||
|
return $this->addRemoveFromAllTemplates(TheliaEvents::ATTRIBUTE_REMOVE_FROM_ALL_TEMPLATES);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add to all product templates
|
||||||
|
*/
|
||||||
|
public function addToAllTemplates()
|
||||||
|
{
|
||||||
|
return $this->addRemoveFromAllTemplates(TheliaEvents::ATTRIBUTE_ADD_TO_ALL_TEMPLATES);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -97,7 +97,7 @@ class BaseAdminController extends BaseController
|
|||||||
protected function errorPage($message)
|
protected function errorPage($message)
|
||||||
{
|
{
|
||||||
if ($message instanceof \Exception) {
|
if ($message instanceof \Exception) {
|
||||||
$message = sprintf($this->getTranslator()->trans("Sorry, an error occured: %msg"), array('msg' => $message->getMessage()));
|
$message = $this->getTranslator()->trans("Sorry, an error occured: %msg", array('%msg' => $message->getMessage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->render('general_error', array(
|
return $this->render('general_error', array(
|
||||||
@@ -273,6 +273,35 @@ class BaseAdminController extends BaseController
|
|||||||
return $this->getCurrentEditionLang()->getLocale();
|
return $this->getCurrentEditionLang()->getLocale();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the current list order identifier for a given object name,
|
||||||
|
* updating in using the current request.
|
||||||
|
*
|
||||||
|
* @param unknown $objectName the object name (e.g. 'attribute', 'message')
|
||||||
|
* @param unknown $requestParameterName the name of the request parameter that defines the list order
|
||||||
|
* @param unknown $defaultListOrder the default order to use, if none is defined
|
||||||
|
* @param string $updateSession if true, the session will be updated with the current order.
|
||||||
|
*
|
||||||
|
* @return String the current liste order.
|
||||||
|
*/
|
||||||
|
protected function getListOrderFromSession($objectName, $requestParameterName, $defaultListOrder, $updateSession = true) {
|
||||||
|
|
||||||
|
$order = $defaultListOrder;
|
||||||
|
|
||||||
|
$orderSessionIdentifier = sprintf("admin.%s.currentListOrder", $objectName);
|
||||||
|
|
||||||
|
// Find the current order
|
||||||
|
$order = $this->getRequest()->get(
|
||||||
|
$requestParameterName,
|
||||||
|
$this->getSession()->get($orderSessionIdentifier, $defaultListOrder)
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($updateSession) $this->getSession()->set($orderSessionIdentifier, $order);
|
||||||
|
|
||||||
|
return $order;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render the given template, and returns the result as an Http Response.
|
* Render the given template, and returns the result as an Http Response.
|
||||||
*
|
*
|
||||||
@@ -314,7 +343,7 @@ class BaseAdminController extends BaseController
|
|||||||
'edit_language_id' => $edition_language->getId(),
|
'edit_language_id' => $edition_language->getId(),
|
||||||
'edit_language_locale' => $edition_language->getLocale(),
|
'edit_language_locale' => $edition_language->getLocale(),
|
||||||
|
|
||||||
'current_url' => htmlspecialchars($this->getRequest()->getUri())
|
'current_url' => $this->getRequest()->getUri()
|
||||||
));
|
));
|
||||||
|
|
||||||
// Update the current edition language in session
|
// Update the current edition language in session
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ class ConfigController extends AbstractCrudController
|
|||||||
parent::__construct(
|
parent::__construct(
|
||||||
'variable',
|
'variable',
|
||||||
'name',
|
'name',
|
||||||
|
'order',
|
||||||
|
|
||||||
'admin.configuration.variables.view',
|
'admin.configuration.variables.view',
|
||||||
'admin.configuration.variables.create',
|
'admin.configuration.variables.create',
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ class CurrencyController extends AbstractCrudController
|
|||||||
parent::__construct(
|
parent::__construct(
|
||||||
'currency',
|
'currency',
|
||||||
'manual',
|
'manual',
|
||||||
|
'order',
|
||||||
|
|
||||||
'admin.configuration.currencies.view',
|
'admin.configuration.currencies.view',
|
||||||
'admin.configuration.currencies.create',
|
'admin.configuration.currencies.create',
|
||||||
|
|||||||
@@ -37,10 +37,12 @@ use Thelia\Form\MessageCreationForm;
|
|||||||
*/
|
*/
|
||||||
class MessageController extends AbstractCrudController
|
class MessageController extends AbstractCrudController
|
||||||
{
|
{
|
||||||
public function __construct() {
|
public function __construct()
|
||||||
|
{
|
||||||
parent::__construct(
|
parent::__construct(
|
||||||
'message',
|
'message',
|
||||||
null,
|
null, // no sort order change
|
||||||
|
null, // no sort order change
|
||||||
|
|
||||||
'admin.configuration.messages.view',
|
'admin.configuration.messages.view',
|
||||||
'admin.configuration.messages.create',
|
'admin.configuration.messages.create',
|
||||||
@@ -55,15 +57,18 @@ class MessageController extends AbstractCrudController
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getCreationForm() {
|
protected function getCreationForm()
|
||||||
|
{
|
||||||
return new MessageCreationForm($this->getRequest());
|
return new MessageCreationForm($this->getRequest());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getUpdateForm() {
|
protected function getUpdateForm()
|
||||||
|
{
|
||||||
return new MessageModificationForm($this->getRequest());
|
return new MessageModificationForm($this->getRequest());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getCreationEvent($formData) {
|
protected function getCreationEvent($formData)
|
||||||
|
{
|
||||||
$createEvent = new MessageCreateEvent();
|
$createEvent = new MessageCreateEvent();
|
||||||
|
|
||||||
$createEvent
|
$createEvent
|
||||||
@@ -76,7 +81,8 @@ class MessageController extends AbstractCrudController
|
|||||||
return $createEvent;
|
return $createEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getUpdateEvent($formData) {
|
protected function getUpdateEvent($formData)
|
||||||
|
{
|
||||||
$changeEvent = new MessageUpdateEvent($formData['id']);
|
$changeEvent = new MessageUpdateEvent($formData['id']);
|
||||||
|
|
||||||
// Create and dispatch the change event
|
// Create and dispatch the change event
|
||||||
@@ -93,16 +99,18 @@ class MessageController extends AbstractCrudController
|
|||||||
return $changeEvent;
|
return $changeEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getDeleteEvent() {
|
protected function getDeleteEvent()
|
||||||
|
{
|
||||||
return new MessageDeleteEvent($this->getRequest()->get('message_id'));
|
return new MessageDeleteEvent($this->getRequest()->get('message_id'));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function eventContainsObject($event) {
|
protected function eventContainsObject($event)
|
||||||
|
{
|
||||||
return $event->hasMessage();
|
return $event->hasMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function hydrateObjectForm($object) {
|
protected function hydrateObjectForm($object)
|
||||||
|
{
|
||||||
// Prepare the data that will hydrate the form
|
// Prepare the data that will hydrate the form
|
||||||
$data = array(
|
$data = array(
|
||||||
'id' => $object->getId(),
|
'id' => $object->getId(),
|
||||||
@@ -119,40 +127,48 @@ class MessageController extends AbstractCrudController
|
|||||||
return new MessageModificationForm($this->getRequest(), "form", $data);
|
return new MessageModificationForm($this->getRequest(), "form", $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getObjectFromEvent($event) {
|
protected function getObjectFromEvent($event)
|
||||||
|
{
|
||||||
return $event->hasMessage() ? $event->getMessage() : null;
|
return $event->hasMessage() ? $event->getMessage() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getExistingObject() {
|
protected function getExistingObject()
|
||||||
|
{
|
||||||
return MessageQuery::create()
|
return MessageQuery::create()
|
||||||
->joinWithI18n($this->getCurrentEditionLocale())
|
->joinWithI18n($this->getCurrentEditionLocale())
|
||||||
->findOneById($this->getRequest()->get('message_id'));
|
->findOneById($this->getRequest()->get('message_id'));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getObjectLabel($object) {
|
protected function getObjectLabel($object)
|
||||||
|
{
|
||||||
return $object->getName();
|
return $object->getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getObjectId($object) {
|
protected function getObjectId($object)
|
||||||
|
{
|
||||||
return $object->getId();
|
return $object->getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function renderListTemplate($currentOrder) {
|
protected function renderListTemplate($currentOrder)
|
||||||
|
{
|
||||||
return $this->render('messages');
|
return $this->render('messages');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function renderEditionTemplate() {
|
protected function renderEditionTemplate()
|
||||||
|
{
|
||||||
return $this->render('message-edit', array('message_id' => $this->getRequest()->get('message_id')));
|
return $this->render('message-edit', array('message_id' => $this->getRequest()->get('message_id')));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function redirectToEditionTemplate() {
|
protected function redirectToEditionTemplate()
|
||||||
|
{
|
||||||
$this->redirectToRoute(
|
$this->redirectToRoute(
|
||||||
"admin.configuration.messages.update",
|
"admin.configuration.messages.update",
|
||||||
array('message_id' => $this->getRequest()->get('message_id'))
|
array('message_id' => $this->getRequest()->get('message_id'))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function redirectToListTemplate() {
|
protected function redirectToListTemplate()
|
||||||
|
{
|
||||||
$this->redirectToRoute('admin.configuration.messages.default');
|
$this->redirectToRoute('admin.configuration.messages.default');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,11 +23,12 @@
|
|||||||
|
|
||||||
namespace Thelia\Controller\Front;
|
namespace Thelia\Controller\Front;
|
||||||
use Thelia\Core\Event\AddressCreateOrUpdateEvent;
|
use Thelia\Core\Event\AddressCreateOrUpdateEvent;
|
||||||
|
use Thelia\Core\Event\AddressEvent;
|
||||||
use Thelia\Core\Event\TheliaEvents;
|
use Thelia\Core\Event\TheliaEvents;
|
||||||
use Thelia\Form\AddressCreateForm;
|
use Thelia\Form\AddressCreateForm;
|
||||||
use Thelia\Form\AddressUpdateForm;
|
use Thelia\Form\AddressUpdateForm;
|
||||||
use Thelia\Form\Exception\FormValidationException;
|
use Thelia\Form\Exception\FormValidationException;
|
||||||
use Thelia\Model\Base\AddressQuery;
|
use Thelia\Model\AddressQuery;
|
||||||
use Thelia\Model\Customer;
|
use Thelia\Model\Customer;
|
||||||
use Thelia\Tools\URL;
|
use Thelia\Tools\URL;
|
||||||
|
|
||||||
@@ -46,14 +47,14 @@ class AddressController extends BaseFrontController
|
|||||||
*/
|
*/
|
||||||
public function generateModalAction($address_id)
|
public function generateModalAction($address_id)
|
||||||
{
|
{
|
||||||
if ($this->getSecurityContext()->hasCustomerUser() === false) {
|
|
||||||
$this->redirect(URL::getInstance()->getIndexPage());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
$this->checkAuth();
|
||||||
$this->checkXmlHttpRequest();
|
$this->checkXmlHttpRequest();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create controller.
|
* Create controller.
|
||||||
* Check if customer is logged in
|
* Check if customer is logged in
|
||||||
@@ -62,9 +63,8 @@ class AddressController extends BaseFrontController
|
|||||||
*/
|
*/
|
||||||
public function createAction()
|
public function createAction()
|
||||||
{
|
{
|
||||||
if ($this->getSecurityContext()->hasCustomerUser() === false) {
|
|
||||||
$this->redirect(URL::getInstance()->getIndexPage());
|
$this->checkAuth();
|
||||||
}
|
|
||||||
|
|
||||||
$addressCreate = new AddressCreateForm($this->getRequest());
|
$addressCreate = new AddressCreateForm($this->getRequest());
|
||||||
|
|
||||||
@@ -96,20 +96,28 @@ class AddressController extends BaseFrontController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateAction()
|
public function updateViewAction($address_id)
|
||||||
{
|
{
|
||||||
|
$this->checkAuth();
|
||||||
|
|
||||||
|
$customer = $this->getSecurityContext()->getCustomerUser();
|
||||||
|
$address = AddressQuery::create()->findPk($address_id);
|
||||||
|
|
||||||
|
if(!$address || $customer->getId() != $address->getCustomerId()) {
|
||||||
|
$this->redirectToRoute("home");
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->getParserContext()->set("address_id", $address_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function processUpdateAction($address_id)
|
||||||
|
{
|
||||||
|
$this->checkAuth();
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
|
|
||||||
if ($this->getSecurityContext()->hasCustomerUser() === false) {
|
|
||||||
$this->redirectToRoute("home");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (null === $address_id = $request->get("address_id")) {
|
|
||||||
$this->redirectToRoute("home");
|
|
||||||
}
|
|
||||||
|
|
||||||
$addressUpdate = new AddressUpdateForm($request);
|
$addressUpdate = new AddressUpdateForm($request);
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$customer = $this->getSecurityContext()->getCustomerUser();
|
$customer = $this->getSecurityContext()->getCustomerUser();
|
||||||
|
|
||||||
@@ -136,7 +144,7 @@ class AddressController extends BaseFrontController
|
|||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$message = sprintf("Sorry, an error occured: %s", $e->getMessage());
|
$message = sprintf("Sorry, an error occured: %s", $e->getMessage());
|
||||||
}
|
}
|
||||||
|
$this->getParserContext()->set("address_id", $address_id);
|
||||||
if ($message !== false) {
|
if ($message !== false) {
|
||||||
\Thelia\Log\Tlog::getInstance()->error(sprintf("Error during address creation process : %s", $message));
|
\Thelia\Log\Tlog::getInstance()->error(sprintf("Error during address creation process : %s", $message));
|
||||||
|
|
||||||
@@ -149,6 +157,22 @@ class AddressController extends BaseFrontController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function deleteAction($address_id)
|
||||||
|
{
|
||||||
|
$this->checkAuth();
|
||||||
|
|
||||||
|
$customer = $this->getSecurityContext()->getCustomerUser();
|
||||||
|
$address = AddressQuery::create()->findPk($address_id);
|
||||||
|
|
||||||
|
if(!$address || $customer->getId() != $address->getCustomerId()) {
|
||||||
|
$this->redirectToRoute("home");
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->dispatch(TheliaEvents::ADDRESS_DELETE, new AddressEvent($address));
|
||||||
|
|
||||||
|
$this->redirectToRoute("customer.account.view");
|
||||||
|
}
|
||||||
|
|
||||||
protected function createAddressEvent($form)
|
protected function createAddressEvent($form)
|
||||||
{
|
{
|
||||||
return new AddressCreateOrUpdateEvent(
|
return new AddressCreateOrUpdateEvent(
|
||||||
@@ -164,7 +188,8 @@ class AddressController extends BaseFrontController
|
|||||||
$form->get("country")->getData(),
|
$form->get("country")->getData(),
|
||||||
$form->get("cellphone")->getData(),
|
$form->get("cellphone")->getData(),
|
||||||
$form->get("phone")->getData(),
|
$form->get("phone")->getData(),
|
||||||
$form->get("company")->getData()
|
$form->get("company")->getData(),
|
||||||
|
$form->get("is_default")->getData()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,4 +50,11 @@ class BaseFrontController extends BaseController
|
|||||||
{
|
{
|
||||||
$this->redirect(URL::getInstance()->absoluteUrl($this->getRoute($routeId, array(), $referenceType), $urlParameters));
|
$this->redirect(URL::getInstance()->absoluteUrl($this->getRoute($routeId, array(), $referenceType), $urlParameters));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function checkAuth()
|
||||||
|
{
|
||||||
|
if($this->getSecurityContext()->hasCustomerUser() === false) {
|
||||||
|
$this->redirectToRoute("customer.login.view");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,7 +108,12 @@ class AddressCreateOrUpdateEvent extends ActionEvent
|
|||||||
*/
|
*/
|
||||||
protected $address;
|
protected $address;
|
||||||
|
|
||||||
public function __construct($label, $title, $firstname, $lastname, $address1, $address2, $address3, $zipcode, $city, $country, $cellphone, $phone, $company)
|
/**
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
protected $isDefault;
|
||||||
|
|
||||||
|
public function __construct($label, $title, $firstname, $lastname, $address1, $address2, $address3, $zipcode, $city, $country, $cellphone, $phone, $company, $isDefault = 0)
|
||||||
{
|
{
|
||||||
$this->address1 = $address1;
|
$this->address1 = $address1;
|
||||||
$this->address2 = $address2;
|
$this->address2 = $address2;
|
||||||
@@ -123,6 +128,7 @@ class AddressCreateOrUpdateEvent extends ActionEvent
|
|||||||
$this->phone = $phone;
|
$this->phone = $phone;
|
||||||
$this->title = $title;
|
$this->title = $title;
|
||||||
$this->zipcode = $zipcode;
|
$this->zipcode = $zipcode;
|
||||||
|
$this->isDefault = $isDefault;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -229,6 +235,16 @@ class AddressCreateOrUpdateEvent extends ActionEvent
|
|||||||
return $this->zipcode;
|
return $this->zipcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getIsDefault()
|
||||||
|
{
|
||||||
|
return $this->isDefault;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \Thelia\Model\Customer $customer
|
* @param \Thelia\Model\Customer $customer
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -129,6 +129,11 @@ final class TheliaEvents
|
|||||||
*/
|
*/
|
||||||
const ADDRESS_UPDATE = "action.updateAddress";
|
const ADDRESS_UPDATE = "action.updateAddress";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sent on address removal
|
||||||
|
*/
|
||||||
|
const ADDRESS_DELETE = "action.deleteAddress";
|
||||||
|
|
||||||
const BEFORE_CREATEADDRESS = "action.before_createAddress";
|
const BEFORE_CREATEADDRESS = "action.before_createAddress";
|
||||||
const AFTER_CREATEADDRESS = "action.after_createAddress";
|
const AFTER_CREATEADDRESS = "action.after_createAddress";
|
||||||
|
|
||||||
@@ -369,6 +374,9 @@ final class TheliaEvents
|
|||||||
const ATTRIBUTE_DELETE = "action.deleteAttribute";
|
const ATTRIBUTE_DELETE = "action.deleteAttribute";
|
||||||
const ATTRIBUTE_UPDATE_POSITION = "action.updateAttributePosition";
|
const ATTRIBUTE_UPDATE_POSITION = "action.updateAttributePosition";
|
||||||
|
|
||||||
|
const ATTRIBUTE_REMOVE_FROM_ALL_TEMPLATES = "action.addAttributeToAllTemplate";
|
||||||
|
const ATTRIBUTE_ADD_TO_ALL_TEMPLATES = "action.removeAttributeFromAllTemplate";
|
||||||
|
|
||||||
const BEFORE_CREATEATTRIBUTE = "action.before_createAttribute";
|
const BEFORE_CREATEATTRIBUTE = "action.before_createAttribute";
|
||||||
const AFTER_CREATEATTRIBUTE = "action.after_createAttribute";
|
const AFTER_CREATEATTRIBUTE = "action.after_createAttribute";
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ class AttributeAvailability extends BaseI18nLoop
|
|||||||
new Argument(
|
new Argument(
|
||||||
'order',
|
'order',
|
||||||
new TypeCollection(
|
new TypeCollection(
|
||||||
new Type\EnumListType(array('alpha', 'alpha_reverse', 'manual', 'manual_reverse'))
|
new Type\EnumListType(array('id', 'id_reverse', 'alpha', 'alpha_reverse', 'manual', 'manual_reverse'))
|
||||||
),
|
),
|
||||||
'manual'
|
'manual'
|
||||||
)
|
)
|
||||||
@@ -100,6 +100,12 @@ class AttributeAvailability extends BaseI18nLoop
|
|||||||
|
|
||||||
foreach ($orders as $order) {
|
foreach ($orders as $order) {
|
||||||
switch ($order) {
|
switch ($order) {
|
||||||
|
case 'id':
|
||||||
|
$search->orderById(Criteria::ASC);
|
||||||
|
break;
|
||||||
|
case 'id_reverse':
|
||||||
|
$search->orderById(Criteria::DESC);
|
||||||
|
break;
|
||||||
case "alpha":
|
case "alpha":
|
||||||
$search->addAscendingOrderByColumn('i18n_TITLE');
|
$search->addAscendingOrderByColumn('i18n_TITLE');
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -106,6 +106,9 @@ class AdminUtilities extends AbstractSmartyPlugin
|
|||||||
// The column label
|
// The column label
|
||||||
$label = $this->getParam($params, 'label');
|
$label = $this->getParam($params, 'label');
|
||||||
|
|
||||||
|
// The request parameter
|
||||||
|
$request_parameter_name = $this->getParam($params, 'request_parameter_name', 'order');
|
||||||
|
|
||||||
if ($current_order == $order) {
|
if ($current_order == $order) {
|
||||||
$icon = 'up';
|
$icon = 'up';
|
||||||
$order_change = $reverse_order;
|
$order_change = $reverse_order;
|
||||||
@@ -121,7 +124,7 @@ class AdminUtilities extends AbstractSmartyPlugin
|
|||||||
else
|
else
|
||||||
$output = '';
|
$output = '';
|
||||||
|
|
||||||
return sprintf('%s<a href="%s">%s</a>', $output, URL::getInstance()->absoluteUrl($path, array('order' => $order_change)), $label);
|
return sprintf('%s<a href="%s">%s</a>', $output, URL::getInstance()->absoluteUrl($path, array($request_parameter_name => $order_change)), $label);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -112,6 +112,37 @@ class Form extends AbstractSmartyPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function assignFieldValues($template, $fieldName, $fieldValue, $fieldVars)
|
||||||
|
{
|
||||||
|
$template->assign("name", $fieldName);
|
||||||
|
|
||||||
|
$template->assign("value", $fieldValue);
|
||||||
|
|
||||||
|
// If Checkbox input type
|
||||||
|
if ($fieldVars['checked'] !== null) {
|
||||||
|
$this->renderFormFieldCheckBox($template, $formFieldView['checked']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$template->assign("label", $fieldVars["label"]);
|
||||||
|
$template->assign("label_attr", $fieldVars["label_attr"]);
|
||||||
|
|
||||||
|
$errors = $fieldVars["errors"];
|
||||||
|
|
||||||
|
$template->assign("error", empty($errors) ? false : true);
|
||||||
|
|
||||||
|
if (! empty($errors)) {
|
||||||
|
$this->assignFieldErrorVars($template, $errors);
|
||||||
|
}
|
||||||
|
|
||||||
|
$attr = array();
|
||||||
|
|
||||||
|
foreach ($fieldVars["attr"] as $key => $value) {
|
||||||
|
$attr[] = sprintf('%s="%s"', $key, $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
$template->assign("attr", implode(" ", $attr));
|
||||||
|
}
|
||||||
|
|
||||||
public function renderFormField($params, $content, \Smarty_Internal_Template $template, &$repeat)
|
public function renderFormField($params, $content, \Smarty_Internal_Template $template, &$repeat)
|
||||||
{
|
{
|
||||||
if ($repeat) {
|
if ($repeat) {
|
||||||
@@ -120,32 +151,29 @@ class Form extends AbstractSmartyPlugin
|
|||||||
|
|
||||||
$template->assign("options", $formFieldView->vars);
|
$template->assign("options", $formFieldView->vars);
|
||||||
|
|
||||||
$template->assign("name", $formFieldView->vars["full_name"]);
|
$value = $formFieldView->vars["value"];
|
||||||
$template->assign("value", $formFieldView->vars["value"]);
|
/* FIXME: doesnt work. We got "This form should not contain extra fields." error.
|
||||||
|
// We have a collection
|
||||||
|
if (is_array($value)) {
|
||||||
|
|
||||||
// If Checkbox input type
|
$key = $this->getParam($params, 'value_key');
|
||||||
if ($formFieldView->vars['checked'] !== null) {
|
|
||||||
$this->renderFormFieldCheckBox($template, $formFieldView);
|
if ($key != null) {
|
||||||
|
|
||||||
|
if (isset($value[$key])) {
|
||||||
|
|
||||||
|
$name = sprintf("%s[%s]", $formFieldView->vars["full_name"], $key);
|
||||||
|
$val = $value[$key];
|
||||||
|
|
||||||
|
$this->assignFieldValues($template, $name, $val, $formFieldView->vars);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
$template->assign("label", $formFieldView->vars["label"]);
|
$this->assignFieldValues($template, $formFieldView->vars["full_name"], $fieldVars["value"], $formFieldView->vars);
|
||||||
$template->assign("label_attr", $formFieldView->vars["label_attr"]);
|
|
||||||
|
|
||||||
$errors = $formFieldView->vars["errors"];
|
|
||||||
|
|
||||||
$template->assign("error", empty($errors) ? false : true);
|
|
||||||
|
|
||||||
if (! empty($errors)) {
|
|
||||||
$this->assignFieldErrorVars($template, $errors);
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
$attr = array();
|
$this->assignFieldValues($template, $formFieldView->vars["full_name"], $formFieldView->vars["value"], $formFieldView->vars);
|
||||||
|
|
||||||
foreach ($formFieldView->vars["attr"] as $key => $value) {
|
|
||||||
$attr[] = sprintf('%s="%s"', $key, $value);
|
|
||||||
}
|
|
||||||
|
|
||||||
$template->assign("attr", implode(" ", $attr));
|
|
||||||
|
|
||||||
$formFieldView->setRendered();
|
$formFieldView->setRendered();
|
||||||
} else {
|
} else {
|
||||||
@@ -275,12 +303,12 @@ class Form extends AbstractSmartyPlugin
|
|||||||
* @param \Smarty_Internal_Template $template
|
* @param \Smarty_Internal_Template $template
|
||||||
* @param $formFieldView
|
* @param $formFieldView
|
||||||
*/
|
*/
|
||||||
public function renderFormFieldCheckBox(\Smarty_Internal_Template $template, $formFieldView)
|
public function renderFormFieldCheckBox(\Smarty_Internal_Template $template, $isChecked)
|
||||||
{
|
{
|
||||||
$template->assign("value", 0);
|
$template->assign("value", 0);
|
||||||
if ($formFieldView->vars['checked']) {
|
if ($isChecked) {
|
||||||
$template->assign("value", 1);
|
$template->assign("value", 1);
|
||||||
}
|
}
|
||||||
$template->assign("value", $formFieldView->vars['checked']);
|
$template->assign("value", $isChecked);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ class UrlGenerator extends AbstractSmartyPlugin
|
|||||||
$url = URL::getInstance()->absoluteUrl($path, $this->getArgsFromParam($params, array('path', 'target')));
|
$url = URL::getInstance()->absoluteUrl($path, $this->getArgsFromParam($params, array('path', 'target')));
|
||||||
|
|
||||||
if ($target != null) $url .= '#'.$target;
|
if ($target != null) $url .= '#'.$target;
|
||||||
|
|
||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class AddressCreateForm extends BaseForm
|
|||||||
"constraints" => array(
|
"constraints" => array(
|
||||||
new NotBlank()
|
new NotBlank()
|
||||||
),
|
),
|
||||||
"label" => Translator::getInstance()->trans("Address label *"),
|
"label" => Translator::getInstance()->trans("Address label"),
|
||||||
"label_attr" => array(
|
"label_attr" => array(
|
||||||
"for" => "label_create"
|
"for" => "label_create"
|
||||||
),
|
),
|
||||||
@@ -154,11 +154,17 @@ class AddressCreateForm extends BaseForm
|
|||||||
)
|
)
|
||||||
))
|
))
|
||||||
->add("company", "text", array(
|
->add("company", "text", array(
|
||||||
"label" => Translator::getInstance()->trans("Compagny"),
|
"label" => Translator::getInstance()->trans("Company"),
|
||||||
"label_attr" => array(
|
"label_attr" => array(
|
||||||
"for" => "company_create"
|
"for" => "company_create"
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
|
->add("is_default", "integer", array(
|
||||||
|
"label" => Translator::getInstance()->trans("Make this address has my primary address"),
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "default_address"
|
||||||
|
)
|
||||||
|
))
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,10 +43,12 @@ class AttributeModificationForm extends AttributeCreationForm
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
|
/* FIXME: doesn't work
|
||||||
->add('attribute_values', 'collection', array(
|
->add('attribute_values', 'collection', array(
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'options' => array('required' => false)
|
'options' => array('required' => false)
|
||||||
))
|
))
|
||||||
|
*/
|
||||||
;
|
;
|
||||||
|
|
||||||
// Add standard description fields
|
// Add standard description fields
|
||||||
|
|||||||
@@ -7,10 +7,24 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
|||||||
use Thelia\Core\Event\AddressEvent;
|
use Thelia\Core\Event\AddressEvent;
|
||||||
use Thelia\Core\Event\TheliaEvents;
|
use Thelia\Core\Event\TheliaEvents;
|
||||||
use Thelia\Model\Base\Address as BaseAddress;
|
use Thelia\Model\Base\Address as BaseAddress;
|
||||||
|
use Thelia\Model\AddressQuery;
|
||||||
|
|
||||||
class Address extends BaseAddress {
|
class Address extends BaseAddress {
|
||||||
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
|
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* put the the current address as default one
|
||||||
|
*/
|
||||||
|
public function makeItDefault()
|
||||||
|
{
|
||||||
|
|
||||||
|
AddressQuery::create()->filterByCustomerId($this->getCustomerId())
|
||||||
|
->update(array('IsDefault' => '0'));
|
||||||
|
|
||||||
|
$this->setIsDefault(1);
|
||||||
|
$this->save();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Code to be run before inserting to database
|
* Code to be run before inserting to database
|
||||||
* @param ConnectionInterface $con
|
* @param ConnectionInterface $con
|
||||||
|
|||||||
@@ -140,6 +140,10 @@ class URL
|
|||||||
|
|
||||||
if (! is_null($parameters)) {
|
if (! is_null($parameters)) {
|
||||||
foreach ($parameters as $name => $value) {
|
foreach ($parameters as $name => $value) {
|
||||||
|
|
||||||
|
// Remove this parameter from base URL to prevent duplicate parameters
|
||||||
|
$base = preg_replace('/([?&])'.$name.'=([^&])*(&|$)/', '$1', $base);
|
||||||
|
|
||||||
$queryString .= sprintf("%s=%s&", urlencode($name), urlencode($value));
|
$queryString .= sprintf("%s=%s&", urlencode($name), urlencode($value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,22 @@
|
|||||||
|
tfoot{
|
||||||
|
|
||||||
|
.pagination{
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-condensed {
|
||||||
|
tfoot {
|
||||||
|
> tr {
|
||||||
|
> th,
|
||||||
|
> td {
|
||||||
|
padding: 20px 5px 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.table-striped {
|
.table-striped {
|
||||||
|
|
||||||
caption {
|
caption {
|
||||||
@@ -55,6 +74,13 @@
|
|||||||
.table-left-aligned {
|
.table-left-aligned {
|
||||||
th, td {
|
th, td {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
|
|
||||||
|
&.text-center {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
&.text-right {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
select, textarea, input[type="text"], input[type="password"], input[type="datetime"], input[type="datetime-local"], input[type="date"], input[type="month"], input[type="time"], input[type="week"], input[type="number"], input[type="email"], input[type="url"], input[type="search"], input[type="tel"], input[type="color"], .uneditable-input {
|
select, textarea, input[type="text"], input[type="password"], input[type="datetime"], input[type="datetime-local"], input[type="date"], input[type="month"], input[type="time"], input[type="week"], input[type="number"], input[type="email"], input[type="url"], input[type="search"], input[type="tel"], input[type="color"], .uneditable-input {
|
||||||
|
|||||||
@@ -37,6 +37,10 @@
|
|||||||
|
|
||||||
<p class="title title-without-tabs">{intl l='Attribute information'}</p>
|
<p class="title title-without-tabs">{intl l='Attribute information'}</p>
|
||||||
|
|
||||||
|
{form_field form=$form field='id'}
|
||||||
|
<input type="hidden" name="{$name}" value="{$attribute_id}" />
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
{* Be sure to get the attribute ID, even if the form could not be validated *}
|
{* Be sure to get the attribute ID, even if the form could not be validated *}
|
||||||
<input type="hidden" name="attribute_id" value="{$attribute_id}" />
|
<input type="hidden" name="attribute_id" value="{$attribute_id}" />
|
||||||
|
|
||||||
@@ -52,7 +56,7 @@
|
|||||||
|
|
||||||
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
|
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
|
||||||
|
|
||||||
{include file="includes/standard-description-form-fields.html"}
|
{include file="includes/standard-description-form-fields.html" form=$form}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
@@ -79,9 +83,10 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th>
|
||||||
{admin_sortable_header
|
{admin_sortable_header
|
||||||
current_order=$order
|
current_order=$attributeav_order
|
||||||
order='id'
|
order='id'
|
||||||
reverse_order='id_reverse'
|
reverse_order='id_reverse'
|
||||||
|
request_parameter_name='attributeav_order'
|
||||||
path={url path='/admin/configuration/attributes/update' attribute_id=$attribute_id}
|
path={url path='/admin/configuration/attributes/update' attribute_id=$attribute_id}
|
||||||
label="{intl l='ID'}"
|
label="{intl l='ID'}"
|
||||||
}
|
}
|
||||||
@@ -89,9 +94,10 @@
|
|||||||
|
|
||||||
<th>
|
<th>
|
||||||
{admin_sortable_header
|
{admin_sortable_header
|
||||||
current_order=$order
|
current_order=$attributeav_order
|
||||||
order='alpha'
|
order='alpha'
|
||||||
reverse_order='alpha_reverse'
|
reverse_order='alpha_reverse'
|
||||||
|
request_parameter_name='attributeav_order'
|
||||||
path={url path='/admin/configuration/attributes/update' attribute_id=$attribute_id}
|
path={url path='/admin/configuration/attributes/update' attribute_id=$attribute_id}
|
||||||
label="{intl l='Value'}"
|
label="{intl l='Value'}"
|
||||||
}
|
}
|
||||||
@@ -99,9 +105,10 @@
|
|||||||
|
|
||||||
<th class="text-center">
|
<th class="text-center">
|
||||||
{admin_sortable_header
|
{admin_sortable_header
|
||||||
current_order=$order
|
current_order=$attributeav_order
|
||||||
order='manual'
|
order='manual'
|
||||||
reverse_order='manual_reverse'
|
reverse_order='manual_reverse'
|
||||||
|
request_parameter_name='attributeav_order'
|
||||||
path={url path='/admin/configuration/attributes/update' attribute_id=$attribute_id}
|
path={url path='/admin/configuration/attributes/update' attribute_id=$attribute_id}
|
||||||
label="{intl l="Position"}"
|
label="{intl l="Position"}"
|
||||||
}
|
}
|
||||||
@@ -114,12 +121,13 @@
|
|||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
{loop name="list" type="attribute_availability" attribute=$attribute_id backend_context="1" lang=$edit_language_id order=$order}
|
{loop name="list" type="attribute_availability" attribute=$attribute_id backend_context="1" lang=$edit_language_id order=$attributeav_order}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{$ID}</td>
|
<td>{$ID}</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<input class="js-edit form-control" type="text" name="" value="{$TITLE}" />
|
{* FIXME : integrate this in the encolsing form to provide standard form processing *}
|
||||||
|
<input class="js-edit form-control" type="text" name="attribute_values[{$ID}]" value="{$TITLE}" />
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
@@ -151,7 +159,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td colspan="4">
|
<td colspan="4">
|
||||||
<div class="alert alert-info">
|
<div class="alert alert-info">
|
||||||
{intl l="No product attribute has been created yet. Click the + button to create one."}
|
{intl l="No value has been created yet. Click the + button to create one."}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -97,6 +97,17 @@
|
|||||||
{module_include location='attributes_table_row'}
|
{module_include location='attributes_table_row'}
|
||||||
|
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
|
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.attributes.change"}
|
||||||
|
<div class="btn-group">
|
||||||
|
<a class="btn btn-default btn-xs attribute-remove-from-all" title="{intl l='Remove this attribute from all product templates'}" href="#remove_from_all_dialog" data-id="{$ID}" data-toggle="modal">
|
||||||
|
<span class="glyphicon glyphicon-minus"></span>
|
||||||
|
</a>
|
||||||
|
<a class="btn btn-default btn-xs attribute-add-to-all" title="{intl l='Add this attribute to all product templates'}" href="#add_to_all_dialog" data-id="{$ID}" data-toggle="modal">
|
||||||
|
<span class="glyphicon glyphicon-plus"></span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
{/loop}
|
||||||
|
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.attributes.change"}
|
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.attributes.change"}
|
||||||
<a class="btn btn-default btn-xs attribute-change" title="{intl l='Change this product attribute'}" href="{url path='/admin/configuration/attributes/update' attribute_id=$ID}"><span class="glyphicon glyphicon-edit"></span></a>
|
<a class="btn btn-default btn-xs attribute-change" title="{intl l='Change this product attribute'}" href="{url path='/admin/configuration/attributes/update' attribute_id=$ID}"><span class="glyphicon glyphicon-edit"></span></a>
|
||||||
@@ -213,10 +224,51 @@
|
|||||||
dialog_title = {intl l="Delete attribute"}
|
dialog_title = {intl l="Delete attribute"}
|
||||||
dialog_message = {intl l="Do you really want to delete this attribute ? It will be removed from all product templates."}
|
dialog_message = {intl l="Do you really want to delete this attribute ? It will be removed from all product templates."}
|
||||||
|
|
||||||
form_action = {url path='/admin/configuration/attributes/delete'}
|
form_action = {url path='/admin/configuration/attributes/remove_from-all-templates' attribute_id=$ID}
|
||||||
form_content = {$smarty.capture.delete_dialog nofilter}
|
form_content = {$smarty.capture.delete_dialog nofilter}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
{* Add to all dialog *}
|
||||||
|
|
||||||
|
{capture "add_to_all_dialog"}
|
||||||
|
<input type="hidden" name="attribute_id" id="attribute_add_to_all_id" value="" />
|
||||||
|
|
||||||
|
{module_include location='attribute_add_to_all_form'}
|
||||||
|
|
||||||
|
{/capture}
|
||||||
|
|
||||||
|
{include
|
||||||
|
file = "includes/generic-confirm-dialog.html"
|
||||||
|
|
||||||
|
dialog_id = "add_to_all_dialog"
|
||||||
|
dialog_title = {intl l="Add to all product templates"}
|
||||||
|
dialog_message = {intl l="Do you really want to add this attribute to all product templates ?"}
|
||||||
|
|
||||||
|
form_action = {url path='/admin/configuration/attributes/add-to-all-templates'}
|
||||||
|
form_content = {$smarty.capture.add_to_all_dialog nofilter}
|
||||||
|
}
|
||||||
|
|
||||||
|
{* Remove from all dialog *}
|
||||||
|
|
||||||
|
{capture "remove_from_all_dialog"}
|
||||||
|
<input type="hidden" name="attribute_id" id="attribute_remove_from_all_id" value="" />
|
||||||
|
|
||||||
|
{module_include location='attribute_add_to_all_form'}
|
||||||
|
|
||||||
|
{/capture}
|
||||||
|
|
||||||
|
{include
|
||||||
|
file = "includes/generic-confirm-dialog.html"
|
||||||
|
|
||||||
|
dialog_id = "remove_from_all_dialog"
|
||||||
|
dialog_title = {intl l="Remove from all product templates"}
|
||||||
|
dialog_message = {intl l="Do you really want to remove this attribute from all product templates ? You'll loose all product related data for this attribute."}
|
||||||
|
|
||||||
|
form_action = {url path='/admin/configuration/attributes/remove-from-all-templates'}
|
||||||
|
form_content = {$smarty.capture.remove_from_all_dialog nofilter}
|
||||||
|
}
|
||||||
|
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block name="javascript-initialization"}
|
{block name="javascript-initialization"}
|
||||||
@@ -233,6 +285,14 @@
|
|||||||
$('#attribute_delete_id').val($(this).data('id'));
|
$('#attribute_delete_id').val($(this).data('id'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('a.attribute-add-to-all').click(function(ev) {
|
||||||
|
$('#attribute_add_to_all_id').val($(this).data('id'));
|
||||||
|
});
|
||||||
|
|
||||||
|
$('a.attribute-remove-from-all').click(function(ev) {
|
||||||
|
$('#attribute_remove_from_all_id').val($(this).data('id'));
|
||||||
|
});
|
||||||
|
|
||||||
// JS stuff for creation form
|
// JS stuff for creation form
|
||||||
{include
|
{include
|
||||||
file = "includes/generic-js-dialog.html"
|
file = "includes/generic-js-dialog.html"
|
||||||
|
|||||||
@@ -82,7 +82,7 @@
|
|||||||
}
|
}
|
||||||
</th>
|
</th>
|
||||||
|
|
||||||
<th>{intl l='Actions'}</th>
|
<th class="actions">{intl l='Actions'}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
|
|||||||
@@ -111,7 +111,7 @@
|
|||||||
|
|
||||||
{module_include location='currencies_table_header'}
|
{module_include location='currencies_table_header'}
|
||||||
|
|
||||||
<th class="text-right">{intl l='Actions'}</th>
|
<th class="actions">{intl l='Actions'}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@
|
|||||||
|
|
||||||
<th>{intl l='order amount'}</th>
|
<th>{intl l='order amount'}</th>
|
||||||
|
|
||||||
<th>{intl l='Actions'}</th>
|
<th class="actions">{intl l='Actions'}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
@@ -102,6 +102,39 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{/loop}
|
{/loop}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<td colspan="6">
|
||||||
|
|
||||||
|
<div class="text-center">
|
||||||
|
<ul class="pagination pagination-centered">
|
||||||
|
{if $customer_page != 1}
|
||||||
|
<li><a href="{url path="/admin/customers" page="1"}">«</a></li>
|
||||||
|
{else}
|
||||||
|
<li class="disabled"><a href="#">«</a></li>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{pageloop rel="customer_list"}
|
||||||
|
{if $PAGE != $CURRENT}
|
||||||
|
<li><a href="{url path="/admin/customers" page="{$PAGE}"}">{$PAGE}</a></li>
|
||||||
|
|
||||||
|
{else}
|
||||||
|
<li class="active"><a href="#">{$PAGE}</a></li>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
|
||||||
|
{/pageloop}
|
||||||
|
{if $PAGE == $LAST && $LAST != $CURRENT}
|
||||||
|
<li><a href="{url path="/admin/customers" page="$PAGE"}">»</a></li>
|
||||||
|
{else}
|
||||||
|
<li class="disabled"><a href="#">»</a></li>
|
||||||
|
{/if}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
{/ifloop}
|
{/ifloop}
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@@ -110,35 +143,6 @@
|
|||||||
|
|
||||||
|
|
||||||
{module_include location='customer_bottom'}
|
{module_include location='customer_bottom'}
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12 text-center">
|
|
||||||
|
|
||||||
<ul class="pagination pagination-centered">
|
|
||||||
{if $customer_page != 1}
|
|
||||||
<li><a href="{url path="/admin/customers" page="1"}">«</a></li>
|
|
||||||
{else}
|
|
||||||
<li class="disabled"><a href="#">«</a></li>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{pageloop rel="customer_list"}
|
|
||||||
{if $PAGE != $CURRENT}
|
|
||||||
<li><a href="{url path="/admin/customers" page="{$PAGE}"}">{$PAGE}</a></li>
|
|
||||||
|
|
||||||
{else}
|
|
||||||
<li class="active"><a href="#">{$PAGE}</a></li>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
|
|
||||||
{/pageloop}
|
|
||||||
{if $PAGE == $LAST && $LAST != $CURRENT}
|
|
||||||
<li><a href="{url path="/admin/customers" page="$PAGE"}">»</a></li>
|
|
||||||
{else}
|
|
||||||
<li class="disabled"><a href="#">»</a></li>
|
|
||||||
{/if}
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{* Adding a new Category *}
|
{* Adding a new Category *}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<ul class="nav nav-pills">
|
<ul class="nav nav-pills">
|
||||||
{loop name="lang_list" type="lang" default_only={$default_only}}
|
{loop name="lang_list" type="lang" default_only={$default_only}}
|
||||||
<li {if $ID == $edit_language_id}class="active"{/if}>
|
<li {if $ID == $edit_language_id}class="active"{/if}>
|
||||||
<a href="{$current_url nofilter}&edit_language_id={$ID}" title="{intl l="Edit information in %lng" lng=$TITLE}">
|
<a href="{url path=$current_url edit_language_id=$ID}" title="{intl l="Edit information in %lng" lng=$TITLE}">
|
||||||
<img src="{image file="../assets/img/flags/{$CODE}.gif"}" alt="{intl l=$TITLE}" />
|
<img src="{image file="../assets/img/flags/{$CODE}.gif"}" alt="{intl l=$TITLE}" />
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
{form_field form=$form field='title'}
|
{form_field form=$form field='title'}
|
||||||
<div class="form-group {if $error}has-error{/if}">
|
<div class="form-group {if $error}has-error{/if}">
|
||||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||||
<input type="text" id="{$label_attr.for}" name="{$name}" required="required" title="{intl l='Title'}" placeholder="{intl l='Title'}" class="form-control" value="{$value|htmlspecialchars}">
|
<input type="text" id="{$label_attr.for}" name="{$name}" required="required" title="{intl l='Title'}" placeholder="{intl l='Title'}" class="form-control" value="{$value}">
|
||||||
</div>
|
</div>
|
||||||
{/form_field}
|
{/form_field}
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
<span class="label-help-block">{intl l="A short description, used when a summary or an introduction is required"}</span>
|
<span class="label-help-block">{intl l="A short description, used when a summary or an introduction is required"}</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<textarea name="{$name}" id="{$label_attr.for}" rows="3" title="{intl l='Short description'}" placeholder="{intl l='Short description'}" class="form-control">{$value|htmlspecialchars}</textarea>
|
<textarea name="{$name}" id="{$label_attr.for}" rows="3" title="{intl l='Short description'}" placeholder="{intl l='Short description'}" class="form-control">{$value}</textarea>
|
||||||
</div>
|
</div>
|
||||||
{/form_field}
|
{/form_field}
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
<span class="label-help-block">{intl l="The détailed description."}</span>
|
<span class="label-help-block">{intl l="The détailed description."}</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<textarea name="{$name}" id="{$label_attr.for}" rows="10" class="form-control">{$value|htmlspecialchars}</textarea>
|
<textarea name="{$name}" id="{$label_attr.for}" rows="10" class="form-control">{$value}</textarea>
|
||||||
</div>
|
</div>
|
||||||
{/form_field}
|
{/form_field}
|
||||||
|
|
||||||
@@ -36,6 +36,6 @@
|
|||||||
<span class="label-help-block">{intl l="A short post-description information"}</span>
|
<span class="label-help-block">{intl l="A short post-description information"}</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<textarea name="{$name}" id="{$label_attr.for}" rows="3" title="{intl l='Short conclusion'}" placeholder="{intl l='Short conclusion'}" class="form-control">{$value|htmlspecialchars}</textarea>
|
<textarea name="{$name}" id="{$label_attr.for}" rows="3" title="{intl l='Short conclusion'}" placeholder="{intl l='Short conclusion'}" class="form-control">{$value}</textarea>
|
||||||
</div>
|
</div>
|
||||||
{/form_field}
|
{/form_field}
|
||||||
@@ -4,7 +4,8 @@
|
|||||||
<div class="span4 feed-list-item">
|
<div class="span4 feed-list-item">
|
||||||
<h3>{$DATE}</h3>
|
<h3>{$DATE}</h3>
|
||||||
<h2><a href="{$URL}" target="_blank" title="{intl l='Lire la suite'}">{$TITLE|strip_tags nofilter}</a></h2>
|
<h2><a href="{$URL}" target="_blank" title="{intl l='Lire la suite'}">{$TITLE|strip_tags nofilter}</a></h2>
|
||||||
<p>{$DESCRIPTION|strip_tags|truncate:250:"...":true nofilter}</p>
|
{* we use unescape:"htmlall" to unescape var before truncate, to prevent a cut in the middel of an HTML entity, eg &ea... *}
|
||||||
|
<p>{$DESCRIPTION|strip_tags|unescape:"htmlall"|truncate:250:"...":true nofilter}</p>
|
||||||
<p><a class="btn" href="{$URL}" target="_blank">{intl l='Lire la suite »'}</a></p>
|
<p><a class="btn" href="{$URL}" target="_blank">{intl l='Lire la suite »'}</a></p>
|
||||||
</div>
|
</div>
|
||||||
{/loop}
|
{/loop}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
{module_include location='orders_table_header'}
|
{module_include location='orders_table_header'}
|
||||||
|
|
||||||
<th>{intl l="Actions"}</th>
|
<th class="actions">{intl l="Actions"}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
{check_auth context="front" roles="CUSTOMER" login_tpl="login"}
|
||||||
{extends file="layout.tpl"}
|
{extends file="layout.tpl"}
|
||||||
|
|
||||||
{block name="breadcrumb"}
|
{block name="breadcrumb"}
|
||||||
@@ -74,11 +75,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="account-address" class="panel-collapse collapse">
|
<div id="account-address" class="panel-collapse collapse">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<a href="address.php" class="btn btn-add-address">{intl l="Add a new address"}</a>
|
<a href="{url path="/address/create"}" class="btn btn-add-address">{intl l="Add a new address"}</a>
|
||||||
<table class="table table-address" role="presentation" summary="{intl l="My Address Books"}">
|
<table class="table table-address" role="presentation" summary="{intl l="My Address Books"}">
|
||||||
<tbody>
|
<tbody>
|
||||||
{loop type="address" name="customer.addresses"}
|
{loop type="address" name="customer.addresses" customer="current"}
|
||||||
<tr class="{if $DEFAULT == 1}address-primary{else}address-additional{/if}">
|
<tr class="{if $DEFAULT == 1}address-primary{else}address-additional{/if}" id="customer-address-{$ID}">
|
||||||
<th>{$LABEL}</th>
|
<th>{$LABEL}</th>
|
||||||
<td>
|
<td>
|
||||||
<ul class="list-address">
|
<ul class="list-address">
|
||||||
@@ -113,9 +114,9 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="group-btn">
|
<div class="group-btn">
|
||||||
<a href="{url path="/address/edit/{$ID}"}" class="btn btn-edit-address" data-toggle="tooltip" title="Edit this address"><i class="icon-pencil"></i> <span>{intl l="Edit"}</span></a>
|
<a href="{url path="/address/update/{$ID}"}" class="btn btn-edit-address" data-toggle="tooltip" title="Edit this address"><i class="icon-pencil"></i> <span>{intl l="Edit"}</span></a>
|
||||||
{if $DEFAULT != 1}
|
{if $DEFAULT != 1}
|
||||||
<a href="#" class="btn btn-remove-address" data-toggle="tooltip" title="Remove this address"><i class="icon-remove"></i> <span>{intl l="Cancel"}</span></a>
|
<a href="{url path="/address/delete/{$ID}"}" class="btn btn-remove-address remove-address" title="{intl l="Remove this address"}" data-toggle="tooltip"><i class="icon-remove"></i> <span>{intl l="Cancel"}</span></a>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@@ -172,4 +173,37 @@
|
|||||||
|
|
||||||
</div><!-- /.layout -->
|
</div><!-- /.layout -->
|
||||||
|
|
||||||
|
<div class="modal fade" id="address-delete-modal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
<h3>{intl l="Delete address"}</h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
{intl l="Do you really want to delete this address ?"}
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<a href="#" type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-remove"></span> {intl l="No"}</a>
|
||||||
|
<a href="#" id="address-delete-link" type="submit" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-check"></span> {intl l="Yes"}</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block name="after-javascript-include"}
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function(){
|
||||||
|
$(".remove-address").click(function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
$("#address-delete-link").attr("href", $(this).attr("href"));
|
||||||
|
$('#address-delete-modal').modal('show');
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
{/block}
|
{/block}
|
||||||
250
templates/default/address-update.html
Normal file
250
templates/default/address-update.html
Normal file
@@ -0,0 +1,250 @@
|
|||||||
|
{check_auth context="front" roles="CUSTOMER" login_tpl="login"}
|
||||||
|
{extends file="layout.tpl"}
|
||||||
|
{block name="breadcrumb"}
|
||||||
|
<nav class="nav-breadcrumb" role="navigation" aria-labelledby="breadcrumb-label">
|
||||||
|
<strong id="breadcrumb-label">{intl l="You are here"}: </strong>
|
||||||
|
<ul class="breadcrumb" itemprop="breadcrumb">
|
||||||
|
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="index.php" itemprop="url"><span itemprop="title">{intl l="Home"}</span></a></li>
|
||||||
|
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><span itemprop="title">{intl l="Account"}</span></li>
|
||||||
|
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="active"><span itemprop="title">{intl l="Address"}</span></li>
|
||||||
|
</ul>
|
||||||
|
</nav><!-- /.nav-breadcrumb -->
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block name="main-content"}
|
||||||
|
<div class="main">
|
||||||
|
|
||||||
|
<article class="col-main" role="main" aria-labelledby="main-label">
|
||||||
|
|
||||||
|
<h1 id="main-label" class="page-header">{intl l="Create New Address"}</h1>
|
||||||
|
{form name="thelia.address.update"}
|
||||||
|
{loop name="customer.update" type="address" customer="current" id="{$address_id}"}
|
||||||
|
<form id="form-address" class="form-horizontal" action="{url path="/address/update/{$address_id}"}" method="post" role="form">
|
||||||
|
{form_field form=$form field='success_url'}
|
||||||
|
<input type="hidden" name="{$name}" value="{url path="/customer/account"}" /> {* the url the user is redirected to on login success *}
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
|
{form_field form=$form field='error_message'}
|
||||||
|
<input type="hidden" name="{$name}" value="{intl l="missing or invalid data"}" /> {* the url the user is redirected to on login success *}
|
||||||
|
{/form_field}
|
||||||
|
{form_hidden_fields form=$form}
|
||||||
|
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
|
||||||
|
<fieldset class="panel">
|
||||||
|
<div class="panel-heading">
|
||||||
|
{intl l="Address"}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="panel-body">
|
||||||
|
{form_field form=$form field="label"}
|
||||||
|
<div class="form-group group-label {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
|
||||||
|
<label class="control-label" for="{$label_attr.for}">{$label}: <span class="required">*</span></label>
|
||||||
|
|
||||||
|
<div class="control-input">
|
||||||
|
<input type="text" name="{$name}" value="{$value|default:{$LABEL}}" id="{$label_attr.for}" class="form-control" placeholder="{intl l="Home address"}" autofocus>
|
||||||
|
{if $error }
|
||||||
|
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
|
||||||
|
{elseif $value != "" && !$error}
|
||||||
|
<span class="help-block"><i class="icon-ok"></i></span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--/.form-group-->
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
|
{form_field form=$form field="title"}
|
||||||
|
{assign var="customer_title_id" value="{$value|default:$TITLE}"}
|
||||||
|
<div class="form-group group-title {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
|
||||||
|
<label class="control-label" for="{$label_attr.for}">{$label} <span class="required">*</span></label>
|
||||||
|
<div class="control-input">
|
||||||
|
<select name="{$name}" id="{$label_attr.for}" class="form-control" required autofocus>
|
||||||
|
<option value="">-- {intl l="Select Title"} --</option>
|
||||||
|
{loop type="title" name="title.list"}
|
||||||
|
<option value="{$ID}" {if $customer_title_id == $ID}selected{/if} >{$LONG}</option>
|
||||||
|
{/loop}
|
||||||
|
</select>
|
||||||
|
{if $error }
|
||||||
|
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
|
||||||
|
{elseif $value != "" && !$error}
|
||||||
|
<span class="help-block"><i class="icon-ok"></i></span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div><!--/.form-group-->
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
|
{form_field form=$form field="firstname"}
|
||||||
|
<div class="form-group group-firstname {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
|
||||||
|
<label class="control-label" for="{$label_attr.for}">{$label}: <span class="required">*</span></label>
|
||||||
|
|
||||||
|
<div class="control-input">
|
||||||
|
<input type="text" name="{$name}" value="{$value|default:{$FIRSTNAME}}" id="{$label_attr.for}" class="form-control" placeholder="John" required>
|
||||||
|
{if $error }
|
||||||
|
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
|
||||||
|
{elseif $value != "" && !$error}
|
||||||
|
<span class="help-block"><i class="icon-ok"></i></span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--/.form-group-->
|
||||||
|
{/form_field}
|
||||||
|
<!--/.form-group-->
|
||||||
|
|
||||||
|
{form_field form=$form field="lastname"}
|
||||||
|
<div class="form-group group-lastname {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
|
||||||
|
<label class="control-label" for="{$label_attr.for}">{$label}: <span class="required">*</span></label>
|
||||||
|
|
||||||
|
<div class="control-input">
|
||||||
|
<input type="text" name="{$name}" value="{$value|default:{$LASTNAME}}" id="{$label_attr.for}" class="form-control" placeholder="Doe" required>
|
||||||
|
{if $error }
|
||||||
|
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
|
||||||
|
{elseif $value != "" && !$error}
|
||||||
|
<span class="help-block"><i class="icon-ok"></i></span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--/.form-group-->
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
|
{form_field form=$form field="address1"}
|
||||||
|
<div class="form-group group-address1 {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
|
||||||
|
<label class="control-label" for="{$label_attr.for}">{$label}: <span class="required">*</span></label>
|
||||||
|
|
||||||
|
<div class="control-input">
|
||||||
|
<input type="text" name="{$name}" value="{$value|default:{$ADDRESS1}}" id="{$label_attr.for}" class="form-control" placeholder="Street address" required>
|
||||||
|
{if $error }
|
||||||
|
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
|
||||||
|
{elseif $value != "" && !$error}
|
||||||
|
<span class="help-block"><i class="icon-ok"></i></span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--/.form-group-->
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
|
{form_field form=$form field="address2"}
|
||||||
|
<div class="form-group group-address2 {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
|
||||||
|
<label class="control-label" for="{$label_attr.for}">{$label}: </label>
|
||||||
|
|
||||||
|
<div class="control-input">
|
||||||
|
<input type="text" name="{$name}" value="{$value|default:{$ADDRESS2}}" id="{$label_attr.for}" class="form-control" placeholder="{intl l="Complementary address"}">
|
||||||
|
{if $error }
|
||||||
|
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
|
||||||
|
{elseif $value != "" && !$error}
|
||||||
|
<span class="help-block"><i class="icon-ok"></i></span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--/.form-group-->
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
|
{form_field form=$form field="zipcode"}
|
||||||
|
<div class="form-group group-zipcode {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
|
||||||
|
<label class="control-label" for="{$label_attr.for}">{$label}: <span class="required">*</span></label>
|
||||||
|
|
||||||
|
<div class="control-input">
|
||||||
|
<input type="text" name="{$name}" value="{$value|default:{$ZIPCODE}}" id="{$label_attr.for}" class="form-control" placeholder="H2T 2V6" required>
|
||||||
|
{if $error }
|
||||||
|
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
|
||||||
|
{elseif $value != "" && !$error}
|
||||||
|
<span class="help-block"><i class="icon-ok"></i></span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--/.form-group-->
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
|
{form_field form=$form field="city"}
|
||||||
|
<div class="form-group group-city {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
|
||||||
|
<label class="control-label" for="{$label_attr.for}">{$label}: <span class="required">*</span></label>
|
||||||
|
|
||||||
|
<div class="control-input">
|
||||||
|
<input type="text" name="{$name}" value="{$value|default:{$CITY}}" id="{$label_attr.for}" class="form-control" placeholder="New York" required>
|
||||||
|
{if $error }
|
||||||
|
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
|
||||||
|
{elseif $value != "" && !$error}
|
||||||
|
<span class="help-block"><i class="icon-ok"></i></span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--/.form-group-->
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
|
{form_field form=$form field="country"}
|
||||||
|
{assign var="customer_country_id" value="{$value|default:$COUNTRY}"}
|
||||||
|
<div class="form-group group-country {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
|
||||||
|
<label class="control-label" for="{$label_attr.for}">{$label} <span class="required">*</span></label>
|
||||||
|
<div class="control-input">
|
||||||
|
<select name="{$name}" id="{$label_attr.for}" class="form-control" required>
|
||||||
|
<option value="">-- {intl l="Select Country"} --</option>
|
||||||
|
{loop type="country" name="country.list"}
|
||||||
|
<option value="{$ID}" {if $customer_country_id == $ID}selected{/if} >{$TITLE}</option>
|
||||||
|
{/loop}
|
||||||
|
</select>
|
||||||
|
{if $error }
|
||||||
|
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
|
||||||
|
{elseif $value != "" && !$error}
|
||||||
|
<span class="help-block"><i class="icon-ok"></i></span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div><!--/.form-group-->
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
|
{form_field form=$form field="phone"}
|
||||||
|
<div class="form-group group-phone {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
|
||||||
|
<label class="control-label" for="{$label_attr.for}">{$label}: </label>
|
||||||
|
|
||||||
|
<div class="control-input">
|
||||||
|
<input type="text" name="{$name}" value="{$value|default:{$PHONE}}" id="{$label_attr.for}" class="form-control" placeholder="">
|
||||||
|
{if $error }
|
||||||
|
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
|
||||||
|
{elseif $value != "" && !$error}
|
||||||
|
<span class="help-block"><i class="icon-ok"></i></span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--/.form-group-->
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
|
{form_field form=$form field="cellphone"}
|
||||||
|
<div class="form-group group-cellphone {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
|
||||||
|
<label class="control-label" for="{$label_attr.for}">{$label}: </label>
|
||||||
|
|
||||||
|
<div class="control-input">
|
||||||
|
<input type="text" name="{$name}" value="{$value|default:{$CELLPHONE}}" id="{$label_attr.for}" class="form-control" placeholder="">
|
||||||
|
{if $error }
|
||||||
|
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
|
||||||
|
{elseif $value != "" && !$error}
|
||||||
|
<span class="help-block"><i class="icon-ok"></i></span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--/.form-group-->
|
||||||
|
{/form_field}
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
{form_field form=$form field="is_default"}
|
||||||
|
<div class="form-group group-primary">
|
||||||
|
<div class="control-input">
|
||||||
|
<div class="checkbox">
|
||||||
|
<label class="control-label" for="{$label_attr.for}">
|
||||||
|
<input type="checkbox" name="{$name}" id="{$label_attr.for}" value="1" {if $DEFAULT}checked{/if}> {$label}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--/.form-group-->
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
|
<div class="form-group group-btn">
|
||||||
|
<div class="control-btn">
|
||||||
|
<button type="submit" class="btn btn-submit">{intl l="Create"}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--/.form-group-->
|
||||||
|
</form>
|
||||||
|
{/loop}
|
||||||
|
{/form}
|
||||||
|
</article>
|
||||||
|
|
||||||
|
</div><!-- /.layout -->
|
||||||
|
{/block}
|
||||||
247
templates/default/address.html
Normal file
247
templates/default/address.html
Normal file
@@ -0,0 +1,247 @@
|
|||||||
|
{check_auth context="front" roles="CUSTOMER" login_tpl="login"}
|
||||||
|
{extends file="layout.tpl"}
|
||||||
|
|
||||||
|
{block name="breadcrumb"}
|
||||||
|
<nav class="nav-breadcrumb" role="navigation" aria-labelledby="breadcrumb-label">
|
||||||
|
<strong id="breadcrumb-label">You are here: </strong>
|
||||||
|
<ul class="breadcrumb" itemprop="breadcrumb">
|
||||||
|
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="index.php" itemprop="url"><span itemprop="title">Home</span></a></li>
|
||||||
|
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="index.php" itemprop="url"><span itemprop="title">Account</span></a></li>
|
||||||
|
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="active"><span itemprop="title">{intl l="Address"}</span></li>
|
||||||
|
</ul>
|
||||||
|
</nav><!-- /.nav-breadcrumb -->
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block name="main-content"}
|
||||||
|
<div class="main">
|
||||||
|
|
||||||
|
<article class="col-main" role="main" aria-labelledby="main-label">
|
||||||
|
|
||||||
|
<h1 id="main-label" class="page-header">{intl l="Create New Address"}</h1>
|
||||||
|
{form name="thelia.address.create"}
|
||||||
|
<form id="form-address" class="form-horizontal" action="{url path="/address/create"}" method="post" role="form">
|
||||||
|
{form_field form=$form field='success_url'}
|
||||||
|
<input type="hidden" name="{$name}" value="{url path="/customer/account"}" /> {* the url the user is redirected to on login success *}
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
|
{form_field form=$form field='error_message'}
|
||||||
|
<input type="hidden" name="{$name}" value="{intl l="missing or invalid data"}" /> {* the url the user is redirected to on login success *}
|
||||||
|
{/form_field}
|
||||||
|
{form_hidden_fields form=$form}
|
||||||
|
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
|
||||||
|
<fieldset class="panel">
|
||||||
|
<div class="panel-heading">
|
||||||
|
{intl l="Address"}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="panel-body">
|
||||||
|
{form_field form=$form field="label"}
|
||||||
|
<div class="form-group group-label {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
|
||||||
|
<label class="control-label" for="{$label_attr.for}">{$label}: <span class="required">*</span></label>
|
||||||
|
|
||||||
|
<div class="control-input">
|
||||||
|
<input type="text" name="{$name}" value="{$value}" id="{$label_attr.for}" class="form-control" placeholder="{intl l="Home address"}" autofocus>
|
||||||
|
{if $error }
|
||||||
|
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
|
||||||
|
{elseif $value != "" && !$error}
|
||||||
|
<span class="help-block"><i class="icon-ok"></i></span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--/.form-group-->
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
|
{form_field form=$form field="title"}
|
||||||
|
<div class="form-group group-title {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
|
||||||
|
<label class="control-label" for="{$label_attr.for}">{$label} <span class="required">*</span></label>
|
||||||
|
<div class="control-input">
|
||||||
|
<select name="{$name}" id="{$label_attr.for}" class="form-control" required autofocus>
|
||||||
|
<option value="">-- {intl l="Select Title"} --</option>
|
||||||
|
{loop type="title" name="title.list"}
|
||||||
|
<option value="{$ID}" {if $value == $ID}selected{/if} >{$LONG}</option>
|
||||||
|
{/loop}
|
||||||
|
</select>
|
||||||
|
{if $error }
|
||||||
|
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
|
||||||
|
{elseif $value != "" && !$error}
|
||||||
|
<span class="help-block"><i class="icon-ok"></i></span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div><!--/.form-group-->
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
|
{form_field form=$form field="firstname"}
|
||||||
|
<div class="form-group group-firstname {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
|
||||||
|
<label class="control-label" for="{$label_attr.for}">{$label}: <span class="required">*</span></label>
|
||||||
|
|
||||||
|
<div class="control-input">
|
||||||
|
<input type="text" name="{$name}" value="{$value}" id="{$label_attr.for}" class="form-control" placeholder="John" required>
|
||||||
|
{if $error }
|
||||||
|
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
|
||||||
|
{elseif $value != "" && !$error}
|
||||||
|
<span class="help-block"><i class="icon-ok"></i></span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--/.form-group-->
|
||||||
|
{/form_field}
|
||||||
|
<!--/.form-group-->
|
||||||
|
|
||||||
|
{form_field form=$form field="lastname"}
|
||||||
|
<div class="form-group group-lastname {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
|
||||||
|
<label class="control-label" for="{$label_attr.for}">{$label}: <span class="required">*</span></label>
|
||||||
|
|
||||||
|
<div class="control-input">
|
||||||
|
<input type="text" name="{$name}" value="{$value}" id="{$label_attr.for}" class="form-control" placeholder="Doe" required>
|
||||||
|
{if $error }
|
||||||
|
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
|
||||||
|
{elseif $value != "" && !$error}
|
||||||
|
<span class="help-block"><i class="icon-ok"></i></span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--/.form-group-->
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
|
{form_field form=$form field="address1"}
|
||||||
|
<div class="form-group group-address1 {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
|
||||||
|
<label class="control-label" for="{$label_attr.for}">{$label}: <span class="required">*</span></label>
|
||||||
|
|
||||||
|
<div class="control-input">
|
||||||
|
<input type="text" name="{$name}" value="{$value}" id="{$label_attr.for}" class="form-control" placeholder="Street address" required>
|
||||||
|
{if $error }
|
||||||
|
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
|
||||||
|
{elseif $value != "" && !$error}
|
||||||
|
<span class="help-block"><i class="icon-ok"></i></span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--/.form-group-->
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
|
{form_field form=$form field="address2"}
|
||||||
|
<div class="form-group group-address2 {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
|
||||||
|
<label class="control-label" for="{$label_attr.for}">{$label}: </label>
|
||||||
|
|
||||||
|
<div class="control-input">
|
||||||
|
<input type="text" name="{$name}" value="{$value}" id="{$label_attr.for}" class="form-control" placeholder="{intl l="Complementary address"}">
|
||||||
|
{if $error }
|
||||||
|
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
|
||||||
|
{elseif $value != "" && !$error}
|
||||||
|
<span class="help-block"><i class="icon-ok"></i></span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--/.form-group-->
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
|
{form_field form=$form field="zipcode"}
|
||||||
|
<div class="form-group group-zipcode {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
|
||||||
|
<label class="control-label" for="{$label_attr.for}">{$label}: <span class="required">*</span></label>
|
||||||
|
|
||||||
|
<div class="control-input">
|
||||||
|
<input type="text" name="{$name}" value="{$value}" id="{$label_attr.for}" class="form-control" placeholder="H2T 2V6" required>
|
||||||
|
{if $error }
|
||||||
|
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
|
||||||
|
{elseif $value != "" && !$error}
|
||||||
|
<span class="help-block"><i class="icon-ok"></i></span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--/.form-group-->
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
|
{form_field form=$form field="city"}
|
||||||
|
<div class="form-group group-city {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
|
||||||
|
<label class="control-label" for="{$label_attr.for}">{$label}: <span class="required">*</span></label>
|
||||||
|
|
||||||
|
<div class="control-input">
|
||||||
|
<input type="text" name="{$name}" value="{$value}" id="{$label_attr.for}" class="form-control" placeholder="New York" required>
|
||||||
|
{if $error }
|
||||||
|
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
|
||||||
|
{elseif $value != "" && !$error}
|
||||||
|
<span class="help-block"><i class="icon-ok"></i></span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--/.form-group-->
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
|
{form_field form=$form field="country"}
|
||||||
|
<div class="form-group group-country {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
|
||||||
|
<label class="control-label" for="{$label_attr.for}">{$label} <span class="required">*</span></label>
|
||||||
|
<div class="control-input">
|
||||||
|
<select name="{$name}" id="{$label_attr.for}" class="form-control" required>
|
||||||
|
<option value="">-- {intl l="Select Country"} --</option>
|
||||||
|
{loop type="country" name="country.list"}
|
||||||
|
<option value="{$ID}" {if $value == $ID}selected{/if} >{$TITLE}</option>
|
||||||
|
{/loop}
|
||||||
|
</select>
|
||||||
|
{if $error }
|
||||||
|
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
|
||||||
|
{elseif $value != "" && !$error}
|
||||||
|
<span class="help-block"><i class="icon-ok"></i></span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div><!--/.form-group-->
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
|
{form_field form=$form field="phone"}
|
||||||
|
<div class="form-group group-phone {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
|
||||||
|
<label class="control-label" for="{$label_attr.for}">{$label}: </label>
|
||||||
|
|
||||||
|
<div class="control-input">
|
||||||
|
<input type="text" name="{$name}" value="{$value}" id="{$label_attr.for}" class="form-control" placeholder="">
|
||||||
|
{if $error }
|
||||||
|
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
|
||||||
|
{elseif $value != "" && !$error}
|
||||||
|
<span class="help-block"><i class="icon-ok"></i></span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--/.form-group-->
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
|
{form_field form=$form field="cellphone"}
|
||||||
|
<div class="form-group group-cellphone {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
|
||||||
|
<label class="control-label" for="{$label_attr.for}">{$label}: </label>
|
||||||
|
|
||||||
|
<div class="control-input">
|
||||||
|
<input type="text" name="{$name}" value="{$value}" id="{$label_attr.for}" class="form-control" placeholder="">
|
||||||
|
{if $error }
|
||||||
|
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
|
||||||
|
{elseif $value != "" && !$error}
|
||||||
|
<span class="help-block"><i class="icon-ok"></i></span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--/.form-group-->
|
||||||
|
{/form_field}
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
{form_field form=$form field="is_default"}
|
||||||
|
<div class="form-group group-primary">
|
||||||
|
<div class="control-input">
|
||||||
|
<div class="checkbox">
|
||||||
|
<label class="control-label" for="{$label_attr.for}">
|
||||||
|
<input type="checkbox" name="{$name}" id="{$label_attr.for}" value="1"> {$label}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--/.form-group-->
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
|
<div class="form-group group-btn">
|
||||||
|
<div class="control-btn">
|
||||||
|
<button type="submit" class="btn btn-submit">{intl l="Create"}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--/.form-group-->
|
||||||
|
</form>
|
||||||
|
{/form}
|
||||||
|
</article>
|
||||||
|
|
||||||
|
</div><!-- /.layout -->
|
||||||
|
{/block}
|
||||||
@@ -96,7 +96,7 @@
|
|||||||
<div class="form-group group-phone {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
|
<div class="form-group group-phone {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
|
||||||
<label class="control-label" for="{$label_attr.for}">{$label}</label>
|
<label class="control-label" for="{$label_attr.for}">{$label}</label>
|
||||||
<div class="control-input">
|
<div class="control-input">
|
||||||
<input type="text" name="{$name}" id="{$label_attr.for}" class="form-control" placeholder="John" value="{$value}" autofocus>
|
<input type="text" name="{$name}" id="{$label_attr.for}" class="form-control" placeholder="" value="{$value}" autofocus>
|
||||||
{if $error }
|
{if $error }
|
||||||
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
|
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
|
||||||
{elseif $value != "" && !$error}
|
{elseif $value != "" && !$error}
|
||||||
@@ -109,7 +109,7 @@
|
|||||||
<div class="form-group group-cellphone {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
|
<div class="form-group group-cellphone {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
|
||||||
<label class="control-label" for="{$label_attr.for}">{$label}</label>
|
<label class="control-label" for="{$label_attr.for}">{$label}</label>
|
||||||
<div class="control-input">
|
<div class="control-input">
|
||||||
<input type="text" name="{$name}" id="{$label_attr.for}" class="form-control" placeholder="John" value="{$value}" autofocus>
|
<input type="text" name="{$name}" id="{$label_attr.for}" class="form-control" placeholder="" value="{$value}" autofocus>
|
||||||
{if $error }
|
{if $error }
|
||||||
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
|
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
|
||||||
{elseif $value != "" && !$error}
|
{elseif $value != "" && !$error}
|
||||||
|
|||||||
Reference in New Issue
Block a user