Skip to content

Conversation

mglaman
Copy link
Contributor

@mglaman mglaman commented Aug 27, 2016

No description provided.

@mglaman
Copy link
Contributor Author

mglaman commented Aug 27, 2016

Branched off of #445

$form += parent::buildConfigurationForm($form, $form_state);

$form['amount'] = [
'#type' => 'commerce_price',
Copy link
Contributor Author

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.

@mglaman mglaman force-pushed the 2770757-implement-promotion-conditions branch 4 times, most recently from 11e59f8 to ebd5e0f Compare August 28, 2016 22:18
]);

$fields['conditions'] = BaseFieldDefinition::create('commerce_plugin_item:commerce_promotion_condition')
->setLabel(t('Offer'))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wong label.

@mglaman mglaman force-pushed the 2770757-implement-promotion-conditions branch from ebd5e0f to ba64052 Compare August 30, 2016 17:28
@mglaman mglaman force-pushed the 2770757-implement-promotion-conditions branch 9 times, most recently from fd4d164 to 1109f5e Compare August 31, 2016 17:16
*/
public function getQuantity() {
return $this->get('quantity')->value;
return (string) $this->get('quantity')->value;
Copy link
Contributor Author

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?

Copy link
Contributor

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.

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'] == '') {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Undo this change.

@mglaman mglaman force-pushed the 2770757-implement-promotion-conditions branch from 1109f5e to e987bc4 Compare September 2, 2016 17:34
@mglaman mglaman force-pushed the 2770757-implement-promotion-conditions branch from e987bc4 to 3f98208 Compare September 2, 2016 17:36
@mglaman mglaman force-pushed the 2770757-implement-promotion-conditions branch 2 times, most recently from 1f5d4d9 to 9ce67bd Compare September 7, 2016 16:32
* The entity.
*
* @return bool
* Returns TRUE if promotion can be applied, or false if conditions failed.
Copy link
Contributor

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
Copy link
Contributor

@bojanz bojanz Sep 7, 2016

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.

@mglaman mglaman force-pushed the 2770757-implement-promotion-conditions branch 2 times, most recently from a1971f5 to 8ffb20f Compare September 7, 2016 17:56
protected $entityTypeManager;

/**
* Constructs a ConditionManager object.
Copy link
Contributor

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.

@mglaman mglaman force-pushed the 2770757-implement-promotion-conditions branch from 8ffb20f to 0a09673 Compare September 7, 2016 19:48
@mglaman mglaman merged commit 0a09673 into drupalcommerce:discount Sep 7, 2016
@mglaman mglaman deleted the 2770757-implement-promotion-conditions branch September 7, 2016 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants