order admin integration
This commit is contained in:
@@ -23,6 +23,7 @@
|
|||||||
<loop class="Thelia\Core\Template\Loop\Folder" name="folder"/>
|
<loop class="Thelia\Core\Template\Loop\Folder" name="folder"/>
|
||||||
<loop class="Thelia\Core\Template\Loop\Module" name="module"/>
|
<loop class="Thelia\Core\Template\Loop\Module" name="module"/>
|
||||||
<loop class="Thelia\Core\Template\Loop\Order" name="order"/>
|
<loop class="Thelia\Core\Template\Loop\Order" name="order"/>
|
||||||
|
<loop class="Thelia\Core\Template\Loop\OrderAddress" name="order_address"/>
|
||||||
<loop class="Thelia\Core\Template\Loop\OrderStatus" name="order-status"/>
|
<loop class="Thelia\Core\Template\Loop\OrderStatus" name="order-status"/>
|
||||||
<loop class="Thelia\Core\Template\Loop\CategoryPath" name="category-path"/>
|
<loop class="Thelia\Core\Template\Loop\CategoryPath" name="category-path"/>
|
||||||
<loop class="Thelia\Core\Template\Loop\Payment" name="payment"/>
|
<loop class="Thelia\Core\Template\Loop\Payment" name="payment"/>
|
||||||
|
|||||||
@@ -53,11 +53,18 @@ class Order extends BaseLoop
|
|||||||
'customer',
|
'customer',
|
||||||
new TypeCollection(
|
new TypeCollection(
|
||||||
new Type\IntType(),
|
new Type\IntType(),
|
||||||
new Type\EnumType(array('current'))
|
new Type\EnumType(array('current', '*'))
|
||||||
),
|
),
|
||||||
'current'
|
'current'
|
||||||
),
|
),
|
||||||
Argument::createIntListTypeArgument('status')
|
Argument::createIntListTypeArgument('status'),
|
||||||
|
new Argument(
|
||||||
|
'order',
|
||||||
|
new TypeCollection(
|
||||||
|
new Type\EnumListType(array('create-date', 'create-date-reverse'))
|
||||||
|
),
|
||||||
|
'create-date-reverse'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +92,7 @@ class Order extends BaseLoop
|
|||||||
} else {
|
} else {
|
||||||
$search->filterByCustomerId($currentCustomer->getId(), Criteria::EQUAL);
|
$search->filterByCustomerId($currentCustomer->getId(), Criteria::EQUAL);
|
||||||
}
|
}
|
||||||
} else {
|
} elseif ($customer !== '*') {
|
||||||
$search->filterByCustomerId($customer, Criteria::EQUAL);
|
$search->filterByCustomerId($customer, Criteria::EQUAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,6 +102,19 @@ class Order extends BaseLoop
|
|||||||
$search->filterByStatusId($status, Criteria::IN);
|
$search->filterByStatusId($status, Criteria::IN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$orderers = $this->getOrder();
|
||||||
|
|
||||||
|
foreach ($orderers as $orderer) {
|
||||||
|
switch ($orderer) {
|
||||||
|
case "create-date":
|
||||||
|
$search->orderByCreatedAt(Criteria::ASC);
|
||||||
|
break;
|
||||||
|
case "create-date-reverse":
|
||||||
|
$search->orderByCreatedAt(Criteria::DESC);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$orders = $this->search($search, $pagination);
|
$orders = $this->search($search, $pagination);
|
||||||
|
|
||||||
$loopResult = new LoopResult($orders);
|
$loopResult = new LoopResult($orders);
|
||||||
|
|||||||
155
core/lib/Thelia/Core/Template/Loop/OrderAddress.php
Executable file
155
core/lib/Thelia/Core/Template/Loop/OrderAddress.php
Executable file
@@ -0,0 +1,155 @@
|
|||||||
|
<?php
|
||||||
|
/*************************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* Thelia */
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) OpenStudio */
|
||||||
|
/* email : info@thelia.net */
|
||||||
|
/* web : http://www.thelia.net */
|
||||||
|
/* */
|
||||||
|
/* This program is free software; you can redistribute it and/or modify */
|
||||||
|
/* it under the terms of the GNU General Public License as published by */
|
||||||
|
/* the Free Software Foundation; either version 3 of the License */
|
||||||
|
/* */
|
||||||
|
/* This program is distributed in the hope that it will be useful, */
|
||||||
|
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||||
|
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||||
|
/* GNU General Public License for more details. */
|
||||||
|
/* */
|
||||||
|
/* You should have received a copy of the GNU General Public License */
|
||||||
|
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
/* */
|
||||||
|
/*************************************************************************************/
|
||||||
|
|
||||||
|
namespace Thelia\Core\Template\Loop;
|
||||||
|
|
||||||
|
use Propel\Runtime\ActiveQuery\Criteria;
|
||||||
|
use Thelia\Core\Template\Element\BaseLoop;
|
||||||
|
use Thelia\Core\Template\Element\LoopResult;
|
||||||
|
use Thelia\Core\Template\Element\LoopResultRow;
|
||||||
|
|
||||||
|
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||||
|
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||||
|
|
||||||
|
use Thelia\Model\AddressQuery;
|
||||||
|
use Thelia\Type\TypeCollection;
|
||||||
|
use Thelia\Type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* OrderAddress loop
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Class OrderAddress
|
||||||
|
* @package Thelia\Core\Template\Loop
|
||||||
|
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
||||||
|
*/
|
||||||
|
class OrderAddress extends BaseLoop
|
||||||
|
{
|
||||||
|
public $timestampable = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return ArgumentCollection
|
||||||
|
*/
|
||||||
|
protected function getArgDefinitions()
|
||||||
|
{
|
||||||
|
return new ArgumentCollection(
|
||||||
|
new Argument(
|
||||||
|
'id',
|
||||||
|
new TypeCollection(
|
||||||
|
new Type\IntListType(),
|
||||||
|
new Type\EnumType(array('*', 'any'))
|
||||||
|
)
|
||||||
|
),
|
||||||
|
new Argument(
|
||||||
|
'customer',
|
||||||
|
new TypeCollection(
|
||||||
|
new Type\IntType(),
|
||||||
|
new Type\EnumType(array('current'))
|
||||||
|
),
|
||||||
|
'current'
|
||||||
|
),
|
||||||
|
Argument::createBooleanOrBothTypeArgument('default'),
|
||||||
|
new Argument(
|
||||||
|
'exclude',
|
||||||
|
new TypeCollection(
|
||||||
|
new Type\IntListType(),
|
||||||
|
new Type\EnumType(array('none'))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $pagination
|
||||||
|
*
|
||||||
|
* @return \Thelia\Core\Template\Element\LoopResult
|
||||||
|
*/
|
||||||
|
public function exec(&$pagination)
|
||||||
|
{
|
||||||
|
$search = OrderAddressQuery::create();
|
||||||
|
|
||||||
|
$id = $this->getId();
|
||||||
|
|
||||||
|
if (null !== $id && !in_array($id, array('*', 'any'))) {
|
||||||
|
$search->filterById($id, Criteria::IN);
|
||||||
|
}
|
||||||
|
|
||||||
|
$customer = $this->getCustomer();
|
||||||
|
|
||||||
|
if ($customer === 'current') {
|
||||||
|
$currentCustomer = $this->securityContext->getCustomerUser();
|
||||||
|
if ($currentCustomer === null) {
|
||||||
|
return new LoopResult();
|
||||||
|
} else {
|
||||||
|
$search->filterByCustomerId($currentCustomer->getId(), Criteria::EQUAL);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$search->filterByCustomerId($customer, Criteria::EQUAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
$default = $this->getDefault();
|
||||||
|
|
||||||
|
if ($default === true) {
|
||||||
|
$search->filterByIsDefault(1, Criteria::EQUAL);
|
||||||
|
} else if($default === false) {
|
||||||
|
$search->filterByIsDefault(0, Criteria::EQUAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
$exclude = $this->getExclude();
|
||||||
|
|
||||||
|
if (null !== $exclude && 'none' !== $exclude) {
|
||||||
|
$search->filterById($exclude, Criteria::NOT_IN);
|
||||||
|
}
|
||||||
|
|
||||||
|
$addresses = $this->search($search, $pagination);
|
||||||
|
|
||||||
|
$loopResult = new LoopResult($addresses);
|
||||||
|
|
||||||
|
foreach ($addresses as $address) {
|
||||||
|
$loopResultRow = new LoopResultRow($loopResult, $address, $this->versionable, $this->timestampable, $this->countable);
|
||||||
|
$loopResultRow
|
||||||
|
->set("ID", $address->getId())
|
||||||
|
->set("LABEL", $address->getLabel())
|
||||||
|
->set("CUSTOMER", $address->getCustomerId())
|
||||||
|
->set("TITLE", $address->getTitleId())
|
||||||
|
->set("COMPANY", $address->getCompany())
|
||||||
|
->set("FIRSTNAME", $address->getFirstname())
|
||||||
|
->set("LASTNAME", $address->getLastname())
|
||||||
|
->set("ADDRESS1", $address->getAddress1())
|
||||||
|
->set("ADDRESS2", $address->getAddress2())
|
||||||
|
->set("ADDRESS3", $address->getAddress3())
|
||||||
|
->set("ZIPCODE", $address->getZipcode())
|
||||||
|
->set("CITY", $address->getCity())
|
||||||
|
->set("COUNTRY", $address->getCountryId())
|
||||||
|
->set("PHONE", $address->getPhone())
|
||||||
|
->set("CELLPHONE", $address->getCellphone())
|
||||||
|
->set("DEFAULT", $address->getIsDefault())
|
||||||
|
;
|
||||||
|
|
||||||
|
$loopResult->addRow($loopResultRow);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $loopResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -45,10 +45,18 @@
|
|||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
|
{loop type="order" name="order-list" customer="*"}
|
||||||
|
|
||||||
|
{loop type="customer" name="order-customer"}
|
||||||
|
{/loop}
|
||||||
|
|
||||||
|
{loop type="order_address" name="order-invoice-address"}
|
||||||
|
{/loop}
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
|
|
||||||
<td><a href="">01230450123045</a></td>
|
<td><a href="">{$REF}</a></td>
|
||||||
<td>11/09/2013 10:24:31</td>
|
<td>{format_date date=$CREATE_DATE}</td>
|
||||||
<td>Thelia</td>
|
<td>Thelia</td>
|
||||||
<td><a href="">Dupont</a></td>
|
<td><a href="">Dupont</a></td>
|
||||||
<td>251 €</td>
|
<td>251 €</td>
|
||||||
@@ -69,54 +77,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
|
|
||||||
<td><a href="">01230450123045</a></td>
|
{/loop}
|
||||||
<td>11/09/2013 10:24:31</td>
|
|
||||||
<td>Thelia</td>
|
|
||||||
<td><a href="">Dupont</a></td>
|
|
||||||
<td>251 €</td>
|
|
||||||
<td><span class="label label-danger">Canceled</span></td>
|
|
||||||
|
|
||||||
{module_include location='orders_table_row'}
|
|
||||||
|
|
||||||
<td>
|
|
||||||
<div class="btn-group">
|
|
||||||
|
|
||||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.orders.edit"}
|
|
||||||
<a class="btn btn-default btn-xs" title="{intl l='Edit this order'}" href="{url path="/admin/order/update/$ID"}"><span class="glyphicon glyphicon-edit"></span></a>
|
|
||||||
{/loop}
|
|
||||||
|
|
||||||
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.orders.delete"}
|
|
||||||
<a class="btn btn-default btn-xs" title="{intl l='Delete this order'}" href="#delete_order_dialog" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a>
|
|
||||||
{/loop}
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
|
|
||||||
<td><a href="">01230450123045</a></td>
|
|
||||||
<td>11/09/2013 10:24:31</td>
|
|
||||||
<td>Thelia</td>
|
|
||||||
<td><a href="">Dupont</a></td>
|
|
||||||
<td>251 €</td>
|
|
||||||
<td><span class="label label-info">Current</span></td>
|
|
||||||
|
|
||||||
{module_include location='orders_table_row'}
|
|
||||||
|
|
||||||
<td>
|
|
||||||
<div class="btn-group">
|
|
||||||
|
|
||||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.orders.edit"}
|
|
||||||
<a class="btn btn-default btn-xs" title="{intl l='Edit this order'}" href="{url path="/admin/order/update/$ID"}"><span class="glyphicon glyphicon-edit"></span></a>
|
|
||||||
{/loop}
|
|
||||||
|
|
||||||
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.orders.delete"}
|
|
||||||
<a class="btn btn-default btn-xs" title="{intl l='Delete this order'}" href="#delete_order_dialog" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a>
|
|
||||||
{/loop}
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<!-- <tr>
|
<!-- <tr>
|
||||||
<td colspan="3">
|
<td colspan="3">
|
||||||
|
|||||||
Reference in New Issue
Block a user