Skip to content

Conversation

ahmad753
Copy link

No description provided.

@alecritson
Copy link
Contributor

Hi @ahmad753 I'm not sure this fixes anything, can you explain more what you're trying to solve?

@ahmad753
Copy link
Author

ahmad753 commented Jun 7, 2019

@alecritson This commit "Fix basket line reward apply"
$reward->type the type is return like this "percentage_amount,fixed_amount or to_fixed_price"
and after using $method = 'apply'.ucfirst($reward->type);
it just appends "apply" then convert the first character to uppercase, and when checking the method exist it will return false, because the method variable value is applyPercentage_amout for i.e. which not exist.

And for this commit "Fix issues in discount" the removed line its not functioning, so I increment the discount from its set.


foreach ($this->discounts->get() as $discount) {
foreach ($discount->rewards as $reward) {
$method = 'apply'.ucfirst($reward->type);

Choose a reason for hiding this comment

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

Could you just change it to Str::camelCase and ucfirst so fixed_amount becomes FixedAmount?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this would be better, although I appreciate this PR is quite old now so might need revisiting in full.

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