Skip to content

Commit

Permalink
Merge pull request #1368 from dpfaffenbauer/feature/store-inheritance
Browse files Browse the repository at this point in the history
[CoreBundle] only show restore-inheritance when actually inheritable
  • Loading branch information
dpfaffenbauer authored Apr 30, 2020
2 parents 9e42ca0 + dc29602 commit 155d991
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion src/CoreShop/Bundle/CoreBundle/CoreExtension/StoreValues.php
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,14 @@ public function getDataForEditmode($data, $object = null, $params = [])
return $storeData;
}

$class = Model\DataObject\ClassDefinition::getById($object->getClassId());

if (!$class instanceof Model\DataObject\ClassDefinition) {
return $storeData;
}

$inheritable = $class->getAllowInherit() && $object->getParent() instanceof $object;

foreach ($data as $storeValuesEntity) {
$context = SerializationContext::create();
$context->setSerializeNull(true);
Expand All @@ -522,7 +530,8 @@ public function getDataForEditmode($data, $object = null, $params = [])
'name' => $storeValuesEntity->getStore()->getName(),
'currencySymbol' => $storeValuesEntity->getStore()->getCurrency()->getSymbol(),
'values' => $values,
'inherited' => false
'inherited' => false,
'inheritable' => $inheritable
];
}

Expand All @@ -539,6 +548,7 @@ public function getDataForEditmode($data, $object = null, $params = [])
'name' => $store->getName(),
'currencySymbol' => $store->getCurrency()->getSymbol(),
'values' => ['price' => 0],
'inheritable' => $inheritable
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ pimcore.object.tags.coreShopStoreValues = Class.create(pimcore.object.tags.abstr
data = this.data.hasOwnProperty(store.getId()) ? this.data[store.getId()] : null;
valuesBuilder = new coreshop.product.storeValues.builder(this.fieldConfig, store, data, this.productUnitDefinitionsStore, this.object.id);

if (data && data.hasOwnProperty('inherited') && !data.inherited) {
if (data && data.hasOwnProperty('inherited') && !data.inherited && data.inheritable) {
formPanel.add({
xtype: 'button',
text: t('coreshop_restore_inheritance'),
Expand Down

0 comments on commit 155d991

Please sign in to comment.