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

Fix issues in discount #148

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Fix issues in discount #148

wants to merge 2 commits into from

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.

@@ -109,9 +109,16 @@ public function get()

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