Skip to content

Commit

Permalink
Merge 1e1258c into e880157
Browse files Browse the repository at this point in the history
  • Loading branch information
intotheweb101 committed May 20, 2020
2 parents e880157 + 1e1258c commit 62a3289
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion composer.json
Expand Up @@ -25,7 +25,8 @@
"silverstripe/asset-admin": "*",
"silverstripe/silverstripe-omnipay": "^3@dev",
"silvershop/silverstripe-listsorter": "^3@dev",
"silvershop/silverstripe-sqlquerylist": "^2@dev"
"silvershop/silverstripe-sqlquerylist": "^2@dev",
"symbiote/silverstripe-gridfieldextensions": "^3.2"
},
"require-dev": {
"phpunit/phpunit": "^5.7",
Expand Down
6 changes: 5 additions & 1 deletion src/Extension/ProductVariationsExtension.php
Expand Up @@ -17,6 +17,7 @@
use SilverStripe\ORM\DataList;
use SilverStripe\Versioned\Versioned;
use SilverStripe\View\ArrayData;
use Symbiote\GridFieldExtensions\GridFieldOrderableRows;

/**
* Adds extra fields and relationships to Products for variations support.
Expand Down Expand Up @@ -49,13 +50,16 @@ public function updateCMSFields(FieldList $fields)
__CLASS__ . '.AttributesDescription',
'These are fields to indicate the way(s) each variation varies. Once selected, they can be edited on each variation.'
)),
GridField::create(
$variationsGridField = GridField::create(
'Variations',
_t(__CLASS__ . '.Variations', 'Variations'),
$this->owner->Variations(),
GridFieldConfig_RecordEditor::create()
)
]);

$variationsGridField->getConfig()->addComponent($sort = new GridFieldOrderableRows('Sort'));

if ($this->owner->Variations()->exists()) {
$fields->addFieldToTab(
'Root.Pricing',
Expand Down
1 change: 1 addition & 0 deletions src/Model/Variation/Variation.php
Expand Up @@ -40,6 +40,7 @@
class Variation extends DataObject implements Buyable
{
private static $db = [
'Sort' => 'Int',
'InternalItemID' => 'Varchar(30)',
'Price' => 'Currency(19,4)',

Expand Down

0 comments on commit 62a3289

Please sign in to comment.