update address process
This commit is contained in:
@@ -142,6 +142,11 @@
|
|||||||
<requirement key="address_id">\d+</requirement>
|
<requirement key="address_id">\d+</requirement>
|
||||||
</route>
|
</route>
|
||||||
|
|
||||||
|
<route id="admin.address.save" path="/admin/address/save/{address_id}">
|
||||||
|
<default key="_controller">Thelia\Controller\Admin\AddressController::processUpdateAction</default>
|
||||||
|
<requirement key="address_id">\d+</requirement>
|
||||||
|
</route>
|
||||||
|
|
||||||
<!-- end address management -->
|
<!-- end address management -->
|
||||||
|
|
||||||
<!-- order management -->
|
<!-- order management -->
|
||||||
|
|||||||
@@ -60,31 +60,6 @@ class AddressController extends AbstractCrudController
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* public function deleteAddressAction()
|
|
||||||
{
|
|
||||||
if (null !== $response = $this->checkAuth("admin.customer.update")) return $response;
|
|
||||||
|
|
||||||
$address_id = $this->getRequest()->request->get('address_id');
|
|
||||||
|
|
||||||
try {
|
|
||||||
$address = AddressQuery::create()->findPk($address_id);
|
|
||||||
|
|
||||||
if (null === $address) {
|
|
||||||
throw new \InvalidArgumentException(sprintf('%d address does not exists', $address_id));
|
|
||||||
}
|
|
||||||
|
|
||||||
$addressEvent = new AddressEvent($address);
|
|
||||||
|
|
||||||
$this->dispatch(TheliaEvents::ADDRESS_DELETE, $addressEvent);
|
|
||||||
|
|
||||||
$this->adminLogAppend(sprintf("address %d for customer %d removal", $address_id, $address->getCustomerId()));
|
|
||||||
} catch(\Exception $e) {
|
|
||||||
\Thelia\Log\Tlog::getInstance()->error(sprintf("error during address removal with message %s", $e->getMessage()));
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->redirectToRoute('admin.customer.update.view', array(), array('customer_id' => $address->getCustomerId()));
|
|
||||||
}*/
|
|
||||||
|
|
||||||
public function useAddressAction()
|
public function useAddressAction()
|
||||||
{
|
{
|
||||||
if (null !== $response = $this->checkAuth("admin.customer.update")) return $response;
|
if (null !== $response = $this->checkAuth("admin.customer.update")) return $response;
|
||||||
@@ -159,7 +134,13 @@ class AddressController extends AbstractCrudController
|
|||||||
*/
|
*/
|
||||||
protected function getCreationEvent($formData)
|
protected function getCreationEvent($formData)
|
||||||
{
|
{
|
||||||
return $this->getCreateOrUpdateEvent($formData);
|
$event = $this->getCreateOrUpdateEvent($formData);
|
||||||
|
|
||||||
|
$customer = CustomerQuery::create()->findPk($this->getRequest()->get("customer_id"));
|
||||||
|
|
||||||
|
$event->setCustomer($customer);
|
||||||
|
|
||||||
|
return $event;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -169,7 +150,9 @@ class AddressController extends AbstractCrudController
|
|||||||
*/
|
*/
|
||||||
protected function getUpdateEvent($formData)
|
protected function getUpdateEvent($formData)
|
||||||
{
|
{
|
||||||
return $this->getCreateOrUpdateEvent($formData);
|
$event = $this->getCreateOrUpdateEvent($formData);
|
||||||
|
|
||||||
|
$event->setAddress($this->getExistingObject());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getCreateOrUpdateEvent($formData)
|
protected function getCreateOrUpdateEvent($formData)
|
||||||
@@ -191,9 +174,7 @@ class AddressController extends AbstractCrudController
|
|||||||
$formData["is_default"]
|
$formData["is_default"]
|
||||||
);
|
);
|
||||||
|
|
||||||
$customer = CustomerQuery::create()->findPk($this->getRequest()->get("customer_id"));
|
|
||||||
|
|
||||||
$event->setCustomer($customer);
|
|
||||||
|
|
||||||
return $event;
|
return $event;
|
||||||
|
|
||||||
@@ -281,7 +262,8 @@ class AddressController extends AbstractCrudController
|
|||||||
*/
|
*/
|
||||||
protected function redirectToEditionTemplate()
|
protected function redirectToEditionTemplate()
|
||||||
{
|
{
|
||||||
// TODO: Implement redirectToEditionTemplate() method.
|
$address = $this->getExistingObject();
|
||||||
|
$this->redirectToRoute('admin.customer.update.view', array(), array('customer_id' => $address->getCustomerId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -312,7 +294,11 @@ class AddressController extends AbstractCrudController
|
|||||||
*/
|
*/
|
||||||
protected function performAdditionalCreateAction($createEvent)
|
protected function performAdditionalCreateAction($createEvent)
|
||||||
{
|
{
|
||||||
$address = $createEvent->getAddress();
|
$this->redirectToEditionTemplate();
|
||||||
$this->redirectToRoute('admin.customer.update.view', array(), array('customer_id' => $address->getCustomerId()));
|
}
|
||||||
|
|
||||||
|
protected function performAdditionalUpdateAction($event)
|
||||||
|
{
|
||||||
|
$this->redirectToEditionTemplate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -103,7 +103,7 @@
|
|||||||
dialog_ok_label = {intl l="Edit this address"}
|
dialog_ok_label = {intl l="Edit this address"}
|
||||||
dialog_cancel_label = {intl l="Cancel"}
|
dialog_cancel_label = {intl l="Cancel"}
|
||||||
|
|
||||||
form_action = {url path='/admin/address/update'}
|
form_action = {url path="/admin/address/save/{$address_id}"}
|
||||||
form_enctype = {form_enctype form=$form}
|
form_enctype = {form_enctype form=$form}
|
||||||
form_error_message = $form_error_message
|
form_error_message = $form_error_message
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,24 +62,6 @@ URL: http://www.thelia.net
|
|||||||
<nav class="navbar-collapse collapse nav-main" role="navigation" aria-label="Main Navigation">
|
<nav class="navbar-collapse collapse nav-main" role="navigation" aria-label="Main Navigation">
|
||||||
<ul class="nav navbar-nav navbar-categories">
|
<ul class="nav navbar-nav navbar-categories">
|
||||||
<li class="active"><a href="{url path="/"}" class="home" tabindex="-1">Home</a></li>
|
<li class="active"><a href="{url path="/"}" class="home" tabindex="-1">Home</a></li>
|
||||||
{* <li class="dropdown">
|
|
||||||
<a href="" data-toggle="dropdown" class="dropdown-toggle">Pages</a>
|
|
||||||
<ul class="dropdown-menu list-subnav" role="menu">
|
|
||||||
<li class="active"><a href="index.html" tabindex="-1">Index</a></li>
|
|
||||||
<li><a href="category.html">Category Grid</a></li>
|
|
||||||
<li><a href="category-list.html">Category List</a></li>
|
|
||||||
<li><a href="account.html">Account</a></li>
|
|
||||||
<li><a href="login.html">Login</a></li>
|
|
||||||
<li><a href="password.html">Forgot Password</a></li>
|
|
||||||
<li><a href="register.html">Register</a></li>
|
|
||||||
<li><a href="cart.html">Cart</a></li>
|
|
||||||
<li><a href="cart-step2.html">Cart (Step 2)</a></li>
|
|
||||||
<li><a href="cart-step3.html">Cart (Step 3)</a></li>
|
|
||||||
<li><a href="cart-step4.html">Cart (Step 4)</a></li>
|
|
||||||
<li><a href="product-details.html">Product details</a></li>
|
|
||||||
<li><a href="address.html">New address</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>*}
|
|
||||||
{loop type="category" name="category.navigation" parent="0"}
|
{loop type="category" name="category.navigation" parent="0"}
|
||||||
<li><a href="{$URL}">{$TITLE}</a></li>
|
<li><a href="{$URL}">{$TITLE}</a></li>
|
||||||
{/loop}
|
{/loop}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
<meta itemprop="brand" content="{$TITLE}">
|
<meta itemprop="brand" content="{$TITLE}">
|
||||||
{/loop}
|
{/loop}
|
||||||
{/loop}
|
{/loop}
|
||||||
{loop name="brand.feature" type="feature" product=$ID title="isbn"}
|
{loop name="isbn.feature" type="feature" product=$ID title="isbn"}
|
||||||
{loop name="brand.value" type="feature_value" feature=$ID product=$product_id}
|
{loop name="brand.value" type="feature_value" feature=$ID product=$product_id}
|
||||||
<meta itemprop="productID" content="isbn:{$TITLE}">
|
<meta itemprop="productID" content="isbn:{$TITLE}">
|
||||||
{/loop}
|
{/loop}
|
||||||
|
|||||||
Reference in New Issue
Block a user