Skip to content

Commit

Permalink
Allow linking of a related object to customisations and price modifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
mlewis-everley committed Oct 28, 2024
1 parent f18725a commit 47c1017
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/Model/LineItemCustomisation.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ class LineItemCustomisation extends DataObject implements TaxableProvider
* @var array
*/
private static $has_one = [
"Parent" => LineItem::class
"Parent" => LineItem::class,
'RelatedObject' => DataObject::class
];

/**
Expand Down
12 changes: 7 additions & 5 deletions src/Model/PriceModifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,26 @@ class PriceModifier extends DataObject
private static $table_name = 'Orders_PriceModifier';

private static $db = [
'Name' => 'Varchar',
'ModifyPrice' => 'Decimal(9,3)'
'Name' => 'Varchar',
'ModifyPrice' => 'Decimal(9,3)'
];

private static $has_one = [
'LineItem' => LineItem::class,
'LineItem' => LineItem::class,
'RelatedObject' => DataObject::class,
'Customisation' => LineItemCustomisation::class
];

private static $summary_fields = [
'Name',
'ModifyPrice',
'CustomisationID'
'RelatedObject.Title'
];

private static $field_labels = [
'Name' => 'Modification applied',
'ModifyPrice' => 'Modify base item price'
'ModifyPrice' => 'Modify base item price',
'RelatedObject.Title' => 'Base Object'
];

public function isNegative(): bool
Expand Down

0 comments on commit 47c1017

Please sign in to comment.