Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

M lindenhofer fix variations sort bug #791

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Extension/ProductVariationsExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function updateCMSFields(FieldList $fields)
GridFieldConfig_RecordEditor::create(100)
)
]);

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

if ($this->owner->Variations()->exists()) {
Expand Down Expand Up @@ -210,7 +210,7 @@ public function possibleValuesForAttributeType($type)
'"SilverShop_Variation_AttributeValues"."SilverShop_VariationID" = "SilverShop_Variation"."ID"'
)->where(
"TypeID = $type AND \"SilverShop_Variation\".\"ProductID\" = " . $this->owner->ID
)->sort('"SilverShop_Variation"."Sort" ASC');
);

if (!Product::config()->allow_zero_price) {
$list = $list->where('"SilverShop_Variation"."Price" > 0');
Expand Down
2 changes: 1 addition & 1 deletion src/Forms/VariationForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ protected function getFormFields($controller = null)
'',
['attribute' => $attribute->Label]
),
$product->possibleValuesForAttributeType($attribute)
$product->possibleValuesForAttributeType($attribute)->sort(['Sort' => 'ASC'])
);

if ($attributeDropdown) {
Expand Down
Loading