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

Fixed a three problems that could happen when you have bundle products #3692

Merged

Conversation

ResuBaka
Copy link
Collaborator

@ResuBaka ResuBaka commented Oct 8, 2019

Related issues

closes #

Short description and why it's useful

  1. Is that the optionChanged event does not work because camel case does not work 100% of the time.
  2. Bundles with only one option for the bundle option were not working as the function find does not exist on an object.
  3. This can only happen in an bundle or config product and that is that there is no server_item_id or item_id in the products that are going to be compared and then they where equal which is wrong.

All three cases above are fix with this PR.

Screenshots of visual changes before/after (if there are any)

Which environment this relates to

Check your case. In case of any doubts please read about Release Cycle

  • Test version (https://test.storefrontcloud.io) - this is a new feature or improvement for Vue Storefront. I've created branch from develop branch and want to merge it back to develop
  • RC version (https://next.storefrontcloud.io) - this is a stabilisation fix for Release Candidate of Vue Storefront. I've created branch from release branch and want to merge it back to release
  • Stable version (https://demo.storefrontcloud.io) - this is an important fix for current stable version. I've created branch from hotfix or master branch and want to merge it back to hotfix

Upgrade Notes and Changelog

  • No upgrade steps required (100% backward compatibility and no breaking changes)
  • I've updated the Upgrade notes and Changelog on how to port existing VS sites with this new feature

IMPORTANT NOTICE - Remember to update CHANGELOG.md with description of your change

Contribution and currently important rules acceptance

…em_id

This is a problem because then they are equal but should not so now we
check if one is undefined and then return false in that case.
@pkarw pkarw requested review from andrzejewsky and patzick October 8, 2019 17:50
Copy link
Collaborator

@pkarw pkarw left a comment

Choose a reason for hiding this comment

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

Probably not a change requests but rather some questions :)

@@ -1,7 +1,7 @@
<template>
<form class="custom-options">
<div v-for="option in product.bundle_options" :key="('bundleOption_' + option.option_id)">
<product-bundle-option :option="option" @optionChanged="optionChanged" :error-messages="errorMessages" />
<product-bundle-option :option="option" @option-changed="optionChanged" :error-messages="errorMessages" />
</div>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn’t it be “bundleOptionChanged” as for the function name?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think that this is fine as it is. As it only Happens in files that have bundle in the name so it should be clear what is happening here.

When you think it is not so clear we can change it.

getServerItemId(product1) === getServerItemId(product2)
const isServerIdsEquals = (product1: CartItem, product2: CartItem): boolean => {
if (getServerItemId(product1) === undefined || getServerItemId(product2) === undefined) {
return false
Copy link
Collaborator

Choose a reason for hiding this comment

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

What if both products have empty server_item_id (say both products added in the offline mode and not yet synced); it’s probably from the caller context that it should be false
In this case correct?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I should always be false when one of the products has no server_item_id or item_id other wise when both don't have it they are the same product but aren't in most cases.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

But for that case we have the check of the checksum.

Copy link
Contributor

@andrzejewsky andrzejewsky left a comment

Choose a reason for hiding this comment

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

just few really cosmetic changes, nice work 👍

core/modules/cart/helpers/productsEquals.ts Outdated Show resolved Hide resolved
core/modules/catalog/components/ProductBundleOption.ts Outdated Show resolved Hide resolved
core/modules/catalog/components/ProductBundleOption.ts Outdated Show resolved Hide resolved
@andrzejewsky andrzejewsky self-requested a review October 9, 2019 08:28
Copy link
Contributor

@andrzejewsky andrzejewsky left a comment

Choose a reason for hiding this comment

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

🥇

@andrzejewsky andrzejewsky added the QA - Ready for tests This is notification for testers, that improvement is ready to be tested and verified. label Oct 9, 2019
@andrzejewsky
Copy link
Contributor

@ResuBaka could you please add a short info how to test / reproduce bug you mentioned? - this is for understanding for QA team.

@andrzejewsky andrzejewsky merged commit b210500 into vuestorefront:release/v1.11 Oct 10, 2019
@ResuBaka
Copy link
Collaborator Author

As it is already merged I still write in here how you could have run into some of the problems.

The Event name change is that in our theme it has not worked I didn't under stand why. So I changed it to more like how actual dom event are named as there are no uppercase in them allowed as far as I am aware of it.

Then the change in the for checking if an bundle option has multible options is when each or one bundle option has only one option in it.

The change for if an product has an server_item_id or item_id is there when it happens that both are not set for what ever reason in both product both are undefined that it would be true which is wrong. This is hard to force I thing as I don't even know what that is happen for us but as it is an edge case it is still good to have it fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
QA - Ready for tests This is notification for testers, that improvement is ready to be tested and verified.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants