-
Notifications
You must be signed in to change notification settings - Fork 114
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
Inconsistency in product component #691
Comments
Good find! This looks like an oversight. The We can definitely clean this up, but have to make sure we don't break backwards compatibility for existing installations. |
Thank you tobias for your feedback.
Yes it is, didn't not investigate deeply into that variable, but it's used (at least) to not display the loader for the first stock refresh call.
We could add some extra condition for backward compatibility that check the existence of post('values') in onChangeProperty method. Something like that :
and in the stockCheckResponse method :
A little dirty but I should do the job. The important thing IMO is to make the change quite fast to prevent people from working with the wrong variables. Best regards, |
When passing form: $form I do get this error, what could cause it? |
Hello,
By trying to understand core concepts of Mall, I noticed a weird thing in the product component.
When you have a product with variants and custom fields, we can see the following :
But :
It works cause, when you change property you manually initialize datas in you product/scripts.htm partial with that code :
By getting the right post() variables in the onChangeProperty() method and on the stockCheckResponse method, you could avoid to manipulate data before sending the request, you could just reference the form object as data source exactly like you do it with your request to the onChangeConfiguration.
I tried some changes :
in the onChangeProperty, load $values with the following code :
$values = post('props', []);
in the stockCheckResponse, load $fields with the following code :
$fields = $this->mapToCustomFields(post('fields', []));
in the script, reference form instead of manually send data :
It seems to work the same way and you don't have to build the values and props array yourself. What do you think about this ?
The text was updated successfully, but these errors were encountered: