-
Notifications
You must be signed in to change notification settings - Fork 256
2770757 implement promotion conditions #475
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
2770757 implement promotion conditions #475
Conversation
Branched off of #445 |
$form += parent::buildConfigurationForm($form, $form_state); | ||
|
||
$form['amount'] = [ | ||
'#type' => 'commerce_price', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to extend FunctionalJavascript test for this.
11e59f8
to
ebd5e0f
Compare
]); | ||
|
||
$fields['conditions'] = BaseFieldDefinition::create('commerce_plugin_item:commerce_promotion_condition') | ||
->setLabel(t('Offer')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wong label.
ebd5e0f
to
ba64052
Compare
fd4d164
to
1109f5e
Compare
*/ | ||
public function getQuantity() { | ||
return $this->get('quantity')->value; | ||
return (string) $this->get('quantity')->value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bojanz so should we change the field type to be string, or store it as decimal and keep this cast?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be more proper to change a field type, but that will probably require providing a custom widget. We can go with the cast and open a followup issue.
modules/price/src/Element/Price.php
Outdated
if ($input !== FALSE && $input !== NULL && !empty($input['amount']) && !empty($input['currency_code'])) { | ||
// Convert empty string value to numeric value. | ||
if ($input['amount'] === '') { | ||
if ($input['amount'] == '') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Undo this change.
1109f5e
to
e987bc4
Compare
e987bc4
to
3f98208
Compare
1f5d4d9
to
9ce67bd
Compare
* The entity. | ||
* | ||
* @return bool | ||
* Returns TRUE if promotion can be applied, or false if conditions failed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need "Returns", that's redundant. Just "TRUE if the promotion can be applied, FALSE otherwise."
/** | ||
* Defines an interface for Condition plugins. | ||
* | ||
* Extends the core Condition interface to support Commerce Promotion specific |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably don't need to say "Commerce"? It's implied. The whole sentence feels redundant.
a1971f5
to
8ffb20f
Compare
protected $entityTypeManager; | ||
|
||
/** | ||
* Constructs a ConditionManager object. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Constructs a new PromotionConditionManager object.
8ffb20f
to
0a09673
Compare
No description provided.