Skip to content

Commit

Permalink
Merge pull request #735 from madmatt/pulls/misc-fixes
Browse files Browse the repository at this point in the history
Misc fixes made during project
  • Loading branch information
wilr committed Jan 30, 2020
2 parents ae31276 + e5381c9 commit a3070ab
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Model/Order.php
Expand Up @@ -19,6 +19,7 @@
use SilverStripe\Forms\DateField;
use SilverStripe\Forms\DropdownField;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\LiteralField;
use SilverStripe\Forms\Tab;
use SilverStripe\Forms\TabSet;
Expand Down Expand Up @@ -310,7 +311,11 @@ public function getCMSFields()
$parts[] = LiteralField::create('Notes', $fs . $this->renderWith('SilverShop\Admin\OrderAdmin_Notes') . $fe);
}
$fields->addFieldsToTab('Root.Main', $parts);

$fields->addFieldToTab('Root.Modifiers', new GridField('Modifiers', 'Modifiers', $this->Modifiers()));

$this->extend('updateCMSFields', $fields);

if ($payments = $fields->fieldByName('Root.Payments.Payments')) {
$fields->removeByName('Payments');
$fields->insertAfter('Content', $payments);
Expand Down Expand Up @@ -430,9 +435,6 @@ public function SubTotal()
*/
public function calculate()
{
if (!$this->IsCart()) {
return $this->Total;
}
$calculator = OrderTotalCalculator::create($this);
return $this->Total = $calculator->calculate();
}
Expand Down
11 changes: 11 additions & 0 deletions src/Model/Variation/Variation.php
Expand Up @@ -317,6 +317,17 @@ public function addLink()
return $this->Item()->addLink($this->ProductID, $this->ID);
}

/**
* Returns a link to the parent product of this variation (variations don't have their own pages)
*
* @param $action string
*
* @return string
*/
public function Link($action = null) {
return ($this->ProductID) ? $this->Product()->Link($action) : false;
}

public function createItem($quantity = 1, $filter = array())
{
$orderitem = self::config()->order_item;
Expand Down

0 comments on commit a3070ab

Please sign in to comment.