Skip to content

Commit

Permalink
Fixes after PR review
Browse files Browse the repository at this point in the history
  • Loading branch information
GSadee committed Oct 26, 2017
1 parent 539afbf commit 620a8fe
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
28 changes: 15 additions & 13 deletions app/migrations/Version20170913125128.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,23 @@ public function up(Schema $schema)

$this->addSql('ALTER TABLE sylius_order_item ADD product_name VARCHAR(255), ADD variant_name VARCHAR(255)');

$this->addSql('UPDATE sylius_order_item
INNER JOIN sylius_order AS o ON sylius_order_item.order_id = o.id
INNER JOIN sylius_product_variant AS pv ON sylius_order_item.variant_id = pv.id
INNER JOIN sylius_product AS p ON pv.product_id = p.id
INNER JOIN sylius_product_translation AS pt ON pt.translatable_id = p.id
INNER JOIN sylius_order AS ol ON pt.locale = ol.locale_code
SET sylius_order_item.product_name = pt.name
$this->addSql('
UPDATE sylius_order_item
INNER JOIN sylius_order ON sylius_order_item.order_id = sylius_order.id
INNER JOIN sylius_product_variant ON sylius_order_item.variant_id = sylius_product_variant.id
INNER JOIN sylius_product ON sylius_product_variant.product_id = sylius_product.id
INNER JOIN sylius_product_translation ON sylius_product_translation.translatable_id = sylius_product.id
WHERE sylius_product_translation.locale = sylius_order.locale_code
SET sylius_order_item.product_name = sylius_product_translation.name
');
$this->addSql('UPDATE sylius_order_item
INNER JOIN sylius_order AS o ON sylius_order_item.order_id = o.id
INNER JOIN sylius_product_variant AS pv ON sylius_order_item.variant_id = pv.id
INNER JOIN sylius_product_variant_translation AS pvt ON pvt.translatable_id = pv.id
INNER JOIN sylius_order AS ol ON pvt.locale = ol.locale_code
SET sylius_order_item.variant_name = pvt.name
$this->addSql('
UPDATE sylius_order_item
INNER JOIN sylius_order ON sylius_order_item.order_id = sylius_order.id
INNER JOIN sylius_product_variant ON sylius_order_item.variant_id = sylius_product_variant.id
INNER JOIN sylius_product_variant_translation ON sylius_product_variant_translation.translatable_id = sylius_product_variant.id
WHERE sylius_product_variant_translation.locale = sylius_order.locale_code
SET sylius_order_item.variant_name = sylius_product_variant_translation.name
');

$this->addSql('ALTER TABLE sylius_order_item CHANGE product_name product_name VARCHAR(255) DEFAULT NULL, CHANGE variant_name variant_name VARCHAR(255) DEFAULT NULL');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{% set taxAdjustment = constant('Sylius\\Component\\Core\\Model\\AdjustmentInterface::TAX_ADJUSTMENT') %}

{% set variant = item.variant %}
{% set product = item.variant.product %}
{% set product = variant.product %}

<tr>
<td class="single line">
Expand Down

0 comments on commit 620a8fe

Please sign in to comment.