2

So I have built a View that uses Apache Solr to display products on my Ubercart site from the Solr index. Swell. Now Ubercart typically lets me add a 'Buy-it-Now'/ Add to Cart button as a field in most views but for some reason in this view that is not possible.

How do I add a 'Buy-it-Now'/ Add to Cart field to this view?

0

You can use one of the hooks provided by apache solr to alter your search results : hook_apachesolr_process_results

and you could append 'Buy it Now' button as well by using hook_theme()

Apache solr hooks

  • I did not get a chance to attempt your answer; however, I feel like if my problem was a little more complicated these options would have come in handy. – kevinaskevin Nov 1 '13 at 20:19
0

Okay so I was not able to try out gj. 's answer because I figured this out using the Views Field View module.

I created a sub view called 'Buy it now Button'. This view displays just a buy it now button field with one result that takes a contextual filter with Node ID as an argument. I added the view 'Buy it now Button' as a field in my faceted search view and everything works fine.

The only thing extra to note was that I had to add an invisible Node ID field to the search view which I could then pass as an argument to the View Field (conditional arguments are supported by Views Field View)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.