diff --git a/modules/ubercart/src/Plugin/migrate/process/d6/UbercartLineItem.php b/modules/ubercart/src/Plugin/migrate/process/d6/UbercartLineItem.php index 317cc1e..c8e3d70 100644 --- a/modules/ubercart/src/Plugin/migrate/process/d6/UbercartLineItem.php +++ b/modules/ubercart/src/Plugin/migrate/process/d6/UbercartLineItem.php @@ -28,13 +28,12 @@ class UbercartLineItem extends ProcessPluginBase { foreach ($value as $adjustment) { $adjust = []; $adjust['delta'] = $i++; - $adjust['type'] = $row->getSourceProperty('commerce_shipping') ? 'shipping' : 'custom'; + $adjust['type'] = $adjustment['type']; $adjust['label'] = $adjustment['title']; - $adjust['amount'] = - [ - 'number' => $adjustment['amount'], - 'currency_code' => $adjustment['currency_code'], - ]; + $adjust['amount'] = [ + 'number' => $adjustment['amount'], + 'currency_code' => $adjustment['currency_code'], + ]; $adjust['amount'] = new Price($adjust['amount']['number'], $adjust['amount']['currency_code']); $adjustments[] = new Adjustment($adjust); } diff --git a/modules/ubercart/src/Plugin/migrate/source/d6/Order.php b/modules/ubercart/src/Plugin/migrate/source/d6/Order.php index f399412..7cef2f2 100644 --- a/modules/ubercart/src/Plugin/migrate/source/d6/Order.php +++ b/modules/ubercart/src/Plugin/migrate/source/d6/Order.php @@ -87,9 +87,6 @@ class Order extends DrupalSqlBase { // isn't necessary so I removed it here. unset($data['cc_data']); - // The line item type depends on whether commerce_shipping is installed. - // Save the state here for the UbercartLineItem process plugin. - $row->setSourceProperty('commerce_shipping', $this->moduleHandler->moduleExists('commerce_shipping')); $row->setSourceProperty('adjustments', $this->getAdjustmentData($row)); return parent::prepareRow($row); } @@ -112,10 +109,14 @@ class Order extends DrupalSqlBase { ->condition('uol.order_id', $order_id); $query->innerJoin('uc_orders', 'uo', 'uol.order_id = uo.order_id'); $adjustments = $query->execute()->fetchAll(); + // The line item type depends on whether commerce_shipping is installed. + // Save the state here for the UbercartLineItem process plugin. + $type = $this->moduleHandler->moduleExists('commerce_shipping') ? 'shipping' : 'custom';; $currency_code = $this->variableGet('uc_currency_code', 'USD'); foreach ($adjustments as &$adjustment) { $adjustment['currency_code'] = $currency_code; + $adjustment['type'] = $type; } return $adjustments; }