Skip to content

Commit

Permalink
[Admin][Order] Add order notes
Browse files Browse the repository at this point in the history
  • Loading branch information
Arminek committed Jun 22, 2016
1 parent 470ea13 commit cca98df
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 0 deletions.
34 changes: 34 additions & 0 deletions app/migrations/Version20160622082932.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace Sylius\Migrations;

use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20160622082932 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('ALTER TABLE sylius_order CHANGE notes notes VARCHAR(255) DEFAULT NULL');
}

/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('ALTER TABLE sylius_order CHANGE notes notes VARCHAR(255) NOT NULL COLLATE utf8_unicode_ci');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% if order.notes is defined and order.notes is not null %}
<h4 class="ui top attached styled header">
{{ 'sylius.ui.notes'|trans }}
</h4>
<div class="ui attached segment" id="sylius-order-notes">
{{ order.notes }}
</div>
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
{% include '@SyliusAdmin/Order/Show/_addresses.html.twig' %}
{% include '@SyliusAdmin/Order/Show/_payments.html.twig' %}
{% include '@SyliusAdmin/Order/Show/_shipments.html.twig' %}
{% include '@SyliusAdmin/Order/Show/_notes.html.twig' %}
</div>
</div>
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<field type="string" name="checkoutState" column="checkout_state" />
<field type="string" name="paymentState" column="payment_state" />
<field type="string" name="shippingState" column="shipping_state" />
<field type="string" name="notes" column="notes" nullable="true" />

<many-to-one field="channel" target-entity="Sylius\Component\Channel\Model\ChannelInterface">
<join-column name="channel_id" referenced-column-name="id" nullable="true" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ sylius:
not_contains: Not contains
not_empty: Not empty
not_in: Not in
notes: Notes
onhold: Onhold
or: or
order_history: Order history
Expand Down
21 changes: 21 additions & 0 deletions src/Sylius/Component/Core/Model/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ class Order extends Cart implements OrderInterface
*/
protected $promotions;

/**
* @var string
*/
protected $notes;

public function __construct()
{
parent::__construct();
Expand Down Expand Up @@ -565,4 +570,20 @@ public function getOrderPromotionTotal()

return $orderPromotionTotal;
}

/**
* @return string
*/
public function getNotes()
{
return $this->notes;
}

/**
* @param string $notes
*/
public function setNotes($notes)
{
$this->notes = $notes;
}
}

0 comments on commit cca98df

Please sign in to comment.