hi all
i'm developing an ecommerce (http://www.rc-modelmania.com/dev/) but only in home page if i click on "Aggiungi al carrello" (add to cart) button sometimes form submit doesn't work... do you know why?
add to cart doesn't work!
|
|
that happen only if i choose a random order in the home page block...
i don't know why... probably random order interfere with token form creation?
I couldn't reproduce the bug in my quick test, but the random order shouldn't interfere with anything... the forms should be independent of the rest of the page's source.
i changed the order to random now... and often i can't add products to cart from the home page
please check now
tnx
Very weird... looking at the source, do you notice any differences in the HTML? I don't think the form token should be a problem, and the form ID seems to be getting generated properly. 
the html source of the forms is identic for home page and categories' pages
this is very strange... i don't know in which way random order create this bug
i can confirm a similar bug. in fact i was just about to ask the same question. my setup is i'm using views with the bonus pack and i'm creating a page that shows a random set of products (with an add to cart/buy button) underneath each product. when they sort criteria is set to anything else other than random the buy button works and redirects to the cart with the item added in. but when it's set to random sorting, the buy button works just once then never again. 
the form's HTML seems then same. the tokens seem to be generated properly. so im also at a loss. 
Oooh, sneaky. I think I figured out the problem. The random order is a big part of the problem, but it would work just fine if you were displaying every product in your catalog at once.
When forms are submitted, the data in them is sent to whatever URL is in the action attribute of the <form> tag. In Drupal, this is nearly always the same page the form is on. So, when the Add to Cart button is clicked, the page is reloaded. On the random order views, you don't necessarily have the same products on the page that you did when you clicked. The Form API's security measures notice that the POST data don't match the form anymore, so nothing happens. Usually, this kind of thing throws an error, but this isn't a usual kind of bug.
If you're going to use the random sorting, I recommend not using any forms in the View. Just use links to the product page.
Just use links to the product page.
Or Cart links. Thats what we use on our catalogue page. That way we avoid the Add to Cart form items altogether.
|
|








Joined: 03/12/2008