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

Updating cart with empty qty removes buttons #2379

Closed
AlexanderWillner opened this issue Oct 14, 2022 · 14 comments
Closed

Updating cart with empty qty removes buttons #2379

AlexanderWillner opened this issue Oct 14, 2022 · 14 comments
Labels
Milestone

Comments

@AlexanderWillner
Copy link
Contributor

Steps that will reproduce the problem?

  1. Put an item into the cart
  2. Go to the cart
  3. Change the quantity of an item to "" (not "0", but an empty string)
  4. Press on the update cart button

What is the expected result?
The items gets removed or the input gets ignored.

What happens instead?
The buttons are missing.

Possible workaround:
Open the URL again (reload doesn't work)

Any additional information:
The root cause is here

if (Input::post('FORM_SUBMIT') === $this->strFormId) {
and here

@aschempp
Copy link
Member

can you please explain what buttons? The go to checkout or the remove/update button of each product item in the cart?

@AlexanderWillner
Copy link
Contributor Author

Of course:

Step 2:

image

Step 3:

image

Step 4:

image

(note: the last screenshot is not cropped, the buttons are missing)

@aschempp aschempp added the bug label Oct 20, 2022
@aschempp
Copy link
Member

do you see any error message in the logs or the browser console? Can you also check if the buttons are there in the HTML markup but somehow not displayed (e.g. malformed HTML)?

@AlexanderWillner
Copy link
Contributor Author

AlexanderWillner commented Oct 31, 2022

Can you also check if the buttons are there in the HTML markup but somehow not displayed (e.g. malformed HTML)?

The HTML is invalid (e.g. the </form> is missing) as in

the following HTML tags are not shown if the actions are not empty:

</div>
<div class="submit_container">
<?php foreach($this->actions as $action) echo $action->generate($this->collection).' '; ?>
</div>
</form>

@aschempp
Copy link
Member

aschempp commented Nov 1, 2022

did you adjust the template? If there are no actions, the form should not be rendered, but there's a second section at the top of the template.

@AlexanderWillner
Copy link
Contributor Author

Is there any online vanilla Isotope demo? The one available for download at https://www.isotopeecommerce.org/en/demo.html is rather old and can't really be installed on a new 4.13 setup - too many issues with data dump isotope-demo-data.sql (after I fixed some other issues to get it installed in the first place).

@aschempp
Copy link
Member

aschempp commented Nov 1, 2022

unfortunately we don't have a live demo. You could try to install 4.9 and then update to 4.13 though. But also thanks for reminding me we should update the demo 🙈 /cc @netzarbeiter

@AlexanderWillner
Copy link
Contributor Author

Not that easy it seems....

$ composer create-project contao/managed-edition example 4.9 && \
   cd example && composer r -W isotope/isotope-core:2.7 && \
   curl -LO https://github.com/isotope/demo/archive/master.zip && \
   composer config repositories.demo artifact . && \
   composer r -W isotope/isotope-demo

Then, importing the demo data via /contao/install after setting up the database still results in: The import failed! Is the database up to date and is the template file compatible with your Contao version? SQLSTATE[42S22]: Column not found: 1054 Unknown column 'colour' in 'field list'

¯\_(ツ)_/¯

@netzarbeiter
Copy link
Member

The new demo is now based on Contao 4.13 and Isotope eCommerce 2.8.
Have fun and happy testing!

@AlexanderWillner
Copy link
Contributor Author

AlexanderWillner commented Nov 2, 2022

Cool. Thank you.

  1. Was able to install it via
composer create-project contao/managed-edition example 4.13 && \
 cd example && composer r -W isotope/isotope-core:2.8 && \
 curl -LO https://github.com/isotope/demo/archive/master.zip && \
 composer config repositories.demo artifact . && \
 composer r -W isotope/isotope-demo
  1. Ok, the issue occurs in this setup as well, however, in your template the user can't change the number of products and update it on the cart view (it is just possible to replicate the issue while by changing the value to ""):

image

  1. Seems the dump might not be complete (or I missed something):

image

@netzarbeiter
Copy link
Member

Everything is fine with the dump, please follow the instructions to install the demo.

@AlexanderWillner
Copy link
Contributor Author

I see, I missed an ./vendor/bin/contao-console cache:clear in the middle of the process. Works fine now. The main issue remains (can still be replicated) though:

image

@aschempp aschempp added this to the 2.8 milestone Nov 4, 2022
@aschempp aschempp modified the milestones: 2.8, 2.8.10 Feb 27, 2023
@aschempp
Copy link
Member

fixed in 511f4e9

@AlexanderWillner
Copy link
Contributor Author

I can confirm it works in our installations as well, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants