Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions Config/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,4 @@
<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">

<loops>
<loop name="order.comment.comment" class="OrderComment\Loop\OrderCommentLoop"/>
<loop name="order.comment.session.comment" class="OrderComment\Loop\SessionOrderCommentLoop"/>
</loops>

</config>
2 changes: 1 addition & 1 deletion Config/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<descriptive locale="fr_FR">
<title>Permet au client d'ajouter un commentaire à sa commande</title>
</descriptive>
<version>3.0.1</version>
<version>3.1.0</version>
<author>
<name>Vincent Lopes-Vicente</name>
<email>vlopes@openstudio.fr</email>
Expand Down
8 changes: 4 additions & 4 deletions Controller/OrderCommentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

namespace OrderComment\Controller;

use Front\Front;
use OrderComment\Form\CommentForm;
use OrderComment\OrderComment;
use Propel\Runtime\Exception\PropelException;
use Thelia\Controller\Front\BaseFrontController;
use Thelia\Core\HttpFoundation\Request;
Expand Down Expand Up @@ -41,12 +41,12 @@ public function setComment(Request $request)

return $this->generateRedirectFromRoute('order.delivery');
} catch (FormValidationException $e) {
$message = Translator::getInstance()->trans('Please check your input: %s', ['%s' => $e->getMessage()], Front::MESSAGE_DOMAIN);
$message = Translator::getInstance()->trans('Please check your input: %s', ['%s' => $e->getMessage()], OrderComment::MESSAGE_DOMAIN);
} catch (PropelException $e) {
$this->getParserContext()->setGeneralError($e->getMessage());
$message = Translator::getInstance()->trans('Sorry, a database error occurred: %s', ['%s' => $e->getMessage()], Front::MESSAGE_DOMAIN);
$message = Translator::getInstance()->trans('Sorry, a database error occurred: %s', ['%s' => $e->getMessage()], OrderComment::MESSAGE_DOMAIN);
} catch (\Exception $e) {
$message = Translator::getInstance()->trans('Sorry, an error occurred: %s', ['%s' => $e->getMessage()], Front::MESSAGE_DOMAIN);
$message = Translator::getInstance()->trans('Sorry, an error occurred: %s', ['%s' => $e->getMessage()], OrderComment::MESSAGE_DOMAIN);
}

if ($message !== false) {
Expand Down
54 changes: 0 additions & 54 deletions Hook/FrontHook.php

This file was deleted.

50 changes: 0 additions & 50 deletions Loop/OrderCommentLoop.php

This file was deleted.

39 changes: 0 additions & 39 deletions Loop/SessionOrderCommentLoop.php

This file was deleted.

4 changes: 3 additions & 1 deletion OrderComment.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@

class OrderComment extends BaseModule
{
public function postActivation(ConnectionInterface $con = null): void
public const MESSAGE_DOMAIN = 'ordercomment';

public function postActivation(?ConnectionInterface $con = null): void
{
$wrapped = $con->getWrappedConnection();
$stmt = $wrapped->query("SHOW TABLES LIKE 'order_comment'");
Expand Down
38 changes: 2 additions & 36 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,40 +19,6 @@ Add it in your main thelia composer.json file
composer require thelia/order-comment-module:~2.0
```

## Loop
## Usage

OrderCommentLoop : order.comment.comment

This loop return the comment of an order.

### Input arguments

|Argument |Description |
|--- |--- |
|**order_id** | Unique ID of the order (eg. order_id=5) |

### Output arguments

|Variable |Description |
|--- |--- |
|$ORDER_COMMENT | Content of the comment |

### Example

```
{ifloop rel="order_comment_loop"}
{loop name="order_comment_loop" type="order.comment.comment" order_id="$order_id" }
{$ORDER_COMMENT}
{/loop}
{/ifloop}
{elseloop rel="order_comment_loop"}
<p class="alert alert-warning">
{intl l="No comment for this order was defined." d="ordercomment"}
</p>
{/elseloop}
```

## Other ?

It may be convenient to display the comment on the detail page of the customer's order.
To do that, uses the loop described previously.
On the checkout delivery step, the customer comment is entered with the `AddOrderComment` live component. The comment is saved with the order and shown in the order detail page of the back office.
19 changes: 0 additions & 19 deletions templates/backOffice/default/order-edit.html

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions templates/frontOffice/default/OrderComment/cart-comment.html

This file was deleted.

13 changes: 0 additions & 13 deletions templates/frontOffice/default/OrderComment/comment-input.html

This file was deleted.

Loading