Search result as teaser 'Add to cart' button doesn´t work

Project:Ubercart Contributions
Component:Code
Category:support request
Priority:minor
Assigned:Unassigned
Status:active
Description
Project: 
Ubercart

I ´ve doen the following to let search results look like teasers.
http://drupal.org/node/33650

Very nice, but the 'Add to cart' button doesn´t work on this search page.
See here: http://www.igadgets.be/nl/search/node/duck

Somebody know whats the problem.

Thanks.

Version: 
beta7
Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Search result as teaser 'Add to cart' button doesn´t work

My hunch is this is related to the problem discovered in this thread. When a form button gets clicked, Drupal submits the info to the same page, so it has to rebuild the page content to find the matching form. I bet it's not applying to the search results somehow... and it is curious that the URL would stay the same but the search results disappear. It could be a bug w/ Drupal core in that respect... worth looking into.

doomed@drupal.org's picture
Offline
Bug Finder
Joined: 04/05/2008
Juice: 334
Jurgen8en, where did you
Assigned to:Ryan» doomed@drupal.org

Jurgen8en, where did you apply that code? which file do you have to edit?

And did you fix this ?

I checked your site and it looks like its still not fixed.

doomed@drupal.org's picture
Offline
Bug Finder
Joined: 04/05/2008
Juice: 334
Re: Jurgen8en, where did you

Well i found out that the file to edit is the theme's template.php .

blinko's picture
Offline
Joined: 03/01/2008
Juice: 31
Re: Search result as teaser 'Add to cart' button doesn´t work
Assigned to:doomed@drupal.org» blinko

Exact same "bug" here...

Did you solve it? what did you change?

...

EDIT: i solved it by setting up a CART LINK

In my "contemplate" for the teaser, I replaced the default code:

<div id="priceline"><?php print $node->content['add_to_cart']['#value'] ?></div>

by this code:

<div id="priceline">
<span class="sell_price">Price: $<?php print $node->sell_price ?> &nbsp;|&nbsp; </span><div id="add_to_cart"><form action="/store/cart/add/p<?php print $node->nid ?>_q1-iteaser_cart_link"  accept-charset="UTF-8" method="link" id="uc-product-add-to-cart-form-<?php print $node->nid ?>">
<div>
<input type="hidden" name="destination" value="cart" >
<input type="submit" name="op" id="edit-submit-<?php print $node->nid ?>" value=""  class="form-submit node-add-to-cart" />
</div></form>
</div>
</div>

This adds quantity 1 for the product node... It can work with a simple text link as well or an image with a link, but i needed to keep the default display as an html form "button", so the form is transformed into a direct link towards the cart link.

For more info about "cart links" you may check this link.

hobbes's picture
Offline
Joined: 06/24/2009
Juice: 2
that's a bug in drupal
Assigned to:blinko» hobbes

Hello,

this is a bug in drupal's search module. Patch provided here :

http://drupal.org/node/497206

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6846
Re: that's a bug in drupal
Assigned to:hobbes» Lyle

Good to know. I've tested the patch superficially, and it does the job. I'll try to remember to come back if there are any problems.

Matthias's picture
Offline
Joined: 10/14/2009
Juice: 4
Patch worked for me. Same
Assigned to:Lyle» Matthias

Patch worked for me.

Same problem exists when you try to combine the add-to-cart button with Apachesolr results. Filed an issue and patch in the projects' issue queue

http://drupal.org/node/614644

fehin's picture
Offline
Joined: 12/17/2008
Juice: 151
#8
Category:» support request
Assigned to:Matthias» Guest

Hi Jurgen8en, I just took a look at your website. How did you get your search result to appear as product grids?