OrderStatusNotify : on supprime l'ancien module qui ne fonctionnait pas
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<config xmlns="http://thelia.net/schema/dic/config"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
|
||||
|
||||
<hooks>
|
||||
<hook id="orderstatusnotification.hook.back" class="OrderStatusNotification\Hook\BackHook">
|
||||
<tag name="hook.event_listener" event="main.top-menu-tools" type="back" />
|
||||
</hook>
|
||||
</hooks>
|
||||
|
||||
</config>
|
||||
@@ -1,26 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module xmlns="http://thelia.net/schema/dic/module"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://thelia.net/schema/dic/module http://thelia.net/schema/dic/module/module-2_2.xsd">
|
||||
<fullnamespace>OrderStatusNotification\OrderStatus</fullnamespace>
|
||||
<descriptive locale="en_US">
|
||||
<title>Send email on order status change</title>
|
||||
</descriptive>
|
||||
<descriptive locale="fr_FR">
|
||||
<title>Envoi d'email lors du changement de statut d'une commande</title>
|
||||
</descriptive>
|
||||
<languages>
|
||||
<language>en_US</language>
|
||||
<language>fr_FR</language>
|
||||
</languages>
|
||||
<version>1.0</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Laurent LE CORRE</name>
|
||||
<email>laurent@thecoredev.fr</email>
|
||||
</author>
|
||||
</authors>
|
||||
<type>classic</type>
|
||||
<thelia>2.3.0</thelia>
|
||||
<stability>other</stability>
|
||||
</module>
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<routes xmlns="http://symfony.com/schema/routing"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
|
||||
|
||||
<route id="orderstatusnotification.back" path="/admin/module/orderstatus">
|
||||
<default key="_controller">OrderStatusNotification\Controller\Back\OrderStatusController::showStatus</default>
|
||||
</route>
|
||||
|
||||
<route id="orderstatusnotification.toggle-online" path="/admin/module/orderstatus/toggle-online">
|
||||
<default key="_controller">OrderStatusNotification\Controller\Back\OrderStatusController::setToggleVisibilityAction</default>
|
||||
</route>
|
||||
|
||||
</routes>
|
||||
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace OrderStatusNotification\Controller\Back;
|
||||
|
||||
use Thelia\Controller\Admin\BaseAdminController;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
|
||||
/**
|
||||
* Class OrderStatusController
|
||||
* @package OrderStatusNotification\Controller\Back
|
||||
* @author Laurent LE CORRE <laurent@thecoredev.fr>
|
||||
*/
|
||||
class OrderStatusController extends BaseAdminController
|
||||
{
|
||||
public function showStatus()
|
||||
{
|
||||
$order_status = explode(',', ConfigQuery::read('thecoredev_orderstatus_tonotify_id'));
|
||||
|
||||
return $this->render('define-status', ['status' => $order_status]);
|
||||
}
|
||||
|
||||
|
||||
public function setToggleVisibilityAction()
|
||||
{
|
||||
/*
|
||||
try {
|
||||
$this->recomposerListeCategories($_GET['category_id']);
|
||||
} catch (\Exception $ex) {
|
||||
// Any error
|
||||
return $this->errorPage($ex);
|
||||
}
|
||||
|
||||
return $this->nullResponse();
|
||||
*/
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace OrderStatus\EventListeners;
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Thelia\Core\Event\Order\OrderEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
* Class OrderStatusListener
|
||||
* @package OrderStatusNotification\EventListeners
|
||||
*/
|
||||
class OrderStatusListener implements EventSubscriberInterface
|
||||
{
|
||||
protected $request;
|
||||
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
return [TheliaEvents::ORDER_UPDATE_STATUS => array("updateStatus", 128)];
|
||||
}
|
||||
|
||||
public function updateStatus(OrderEvent $event)
|
||||
{
|
||||
/*
|
||||
$order = $event->getOrder();
|
||||
|
||||
if (OrderStatusListener::getConfigValue('order_status_changed')) {
|
||||
$this->mailer->sendEmailToCustomer(
|
||||
OrderStatusListener::CONFIRMATION_MESSAGE_NAME,
|
||||
$order->getCustomer(),
|
||||
[
|
||||
'order_id' => $order->getId(),
|
||||
'order_ref' => $order->getRef(),
|
||||
'new_status' => $order->getOrderStatus()
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
Tlog::getInstance()->debug("Order status change sent to customer " . $order->getCustomer()->getEmail());
|
||||
*/
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace OrderStatusNotification\Hook;
|
||||
|
||||
use Thelia\Core\Event\Hook\HookRenderBlockEvent;
|
||||
use Thelia\Core\Hook\BaseHook;
|
||||
use Thelia\Tools\URL;
|
||||
|
||||
/**
|
||||
* Class BackHook
|
||||
* @package OrderStatusNotification\Hook
|
||||
* @author Laurent LE CORRE
|
||||
*/
|
||||
class BackHook extends BaseHook
|
||||
{
|
||||
public function onMainTopMenuTools(HookRenderBlockEvent $event)
|
||||
{
|
||||
$event->add(
|
||||
[
|
||||
'id' => 'tools_menu_orderstatusnotification',
|
||||
'class' => '',
|
||||
'url' => URL::getInstance()->absoluteUrl('/admin/module/orderstatusnotification'),
|
||||
'title' => $this->trans('Order status notification', [], OrderStatusNotification::DOMAIN_NAME)
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
<?php
|
||||
return array(
|
||||
// 'an english string' => 'The displayed english string',
|
||||
);
|
||||
@@ -1,4 +0,0 @@
|
||||
<?php
|
||||
return [
|
||||
'Order status notification' => 'Prévenir des changements de statut',
|
||||
];
|
||||
@@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace OSNotification;
|
||||
|
||||
use Thelia\Module\BaseModule;
|
||||
|
||||
class OrderStatusNotification extends BaseModule
|
||||
{
|
||||
/** @var string */
|
||||
const DOMAIN_NAME = 'orderstatusnotification';
|
||||
|
||||
/*
|
||||
* You may now override BaseModuleInterface methods, such as:
|
||||
* install, destroy, preActivation, postActivation, preDeactivation, postDeactivation
|
||||
*
|
||||
* Have fun !
|
||||
*/
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
# Order Status
|
||||
|
||||
Add a short description here. You can also add a screenshot if needed.
|
||||
|
||||
## Installation
|
||||
|
||||
### Manually
|
||||
|
||||
* Copy the module into ```<thelia_root>/local/modules/``` directory and be sure that the name of the module is OrderStatus.
|
||||
* Activate it in your thelia administration panel
|
||||
|
||||
### Composer
|
||||
|
||||
Add it in your main thelia composer.json file
|
||||
|
||||
```
|
||||
composer require your-vendor/order-status-module:~1.0
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Explain here how to use your module, how to configure it, etc.
|
||||
|
||||
## Hook
|
||||
|
||||
If your module use one or more hook, fill this part. Explain which hooks are used.
|
||||
|
||||
|
||||
## Loop
|
||||
|
||||
If your module declare one or more loop, describe them here like this :
|
||||
|
||||
[loop name]
|
||||
|
||||
### Input arguments
|
||||
|
||||
|Argument |Description |
|
||||
|--- |--- |
|
||||
|**arg1** | describe arg1 with an exemple. |
|
||||
|**arg2** | describe arg2 with an exemple. |
|
||||
|
||||
### Output arguments
|
||||
|
||||
|Variable |Description |
|
||||
|--- |--- |
|
||||
|$VAR1 | describe $VAR1 variable |
|
||||
|$VAR2 | describe $VAR2 variable |
|
||||
|
||||
### Exemple
|
||||
|
||||
Add a complete exemple of your loop
|
||||
|
||||
## Other ?
|
||||
|
||||
If you have other think to put, feel free to complete your readme as you want.
|
||||
@@ -1,46 +0,0 @@
|
||||
{extends file="admin-layout.tpl"}
|
||||
|
||||
{block name="page-title"}{intl d='orderstatusnotification' l='Order status notification'}{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="order_status">
|
||||
<div id="wrapper" class="container">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="{url path='/admin/home'}">{intl d='orderstatusnotification' l="Home"}</a></li>
|
||||
<li><a href="{url path='/admin/tools'}">{intl d='orderstatusnotification' l="Tools"}</a></li>
|
||||
<li><a href="{url path='/admin/module/orderstatusnotification'}">{intl d='orderstatusnotification' l="Order status"}</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="general-block-decorator">
|
||||
<div class="row">
|
||||
<div class="col-md-9">
|
||||
{include file="include/status-list.html"}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
|
||||
|
||||
{block name="javascript-initialization"}
|
||||
{javascripts file='assets/js/bootstrap-switch/bootstrap-switch.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
|
||||
/* Gestion des switch */
|
||||
$(".visibleToggle").on('switch-change', function(event, data) {
|
||||
$.ajax({
|
||||
url: "{url path='admin/module/popularcategory/toggle-online'}",
|
||||
data: {
|
||||
category_id: $(this).data('id')
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
{/block}
|
||||
@@ -1,35 +0,0 @@
|
||||
{$status={config key="thecoredev_orderstatus_tonotify_id"}}
|
||||
{assign var="status_as_array" value=","|explode:$status}
|
||||
|
||||
|
||||
<form name="" action="">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<caption>
|
||||
{intl d='orderstatusnotification' l="Status list"}
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{intl d='orderstatusnotification' l="ID"}</th>
|
||||
<th>{intl d='orderstatusnotification' l="Status"}</th>
|
||||
<th>{intl d='orderstatusnotification' l="Send notification"}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
|
||||
{loop type="order_status" name="status-loop" visible="yes" order="alpha"}
|
||||
<tr>
|
||||
<td>{$ID}</td>
|
||||
<td>{$TITLE}</td>
|
||||
<td>
|
||||
<div class="make-switch switch-small visibleToggle" data-id="{$ID}" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
|
||||
<input type="checkbox" class="visibleToggle" {if $VISIBLE == 1}{if in_array({$ID}, $status_as_array)}checked="checked"{/if}{/if}>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
</tfoot>
|
||||
</table>
|
||||
</form>
|
||||
Reference in New Issue
Block a user