I need a search form that searches only for products. Some people have tweaked Drupal's search.module (search for node type 'product') or suggest using trip_search.module. Is there a proper UC way to do this - an implementation of hook_search or something?
There should be a tab on your site's search page labeled "Products" ; it will point to http://www.yoursitename.com/search/uc_product
This page will just search within products. Are you looking for something more sophisticated?
There is also a uc_views module that seems to be floating around somewhere but unfortunately isn't posted to ubercart.org. I've created a similiar views module for myself (its quite a hack) since I couldn't find this original one anywhere. Combining this module with with the fastsearch module would also do the trick. I'm working on a similar page right now, but its now finished quite yet...
Thanks for your hints. But I need the search block (in the header of a page, like here on ubercart.org) to search for products, not the full search page. I found this comment and put this in my template.php:
<?php
function mytheme_search_block_form($form) {
return '<div class="product-search">'. drupal_get_form('product_search_form') .'</div>';
}
function
product_search_form() {
$form = array();
$form['keys'] = array('#type' => 'textfield');
$form['submit'] = array('#type' => 'submit', '#value' => t('go'));
return $form;
}
function
product_search_form_submit($form_id, $form_values) {
return 'search/node/' . trim($form_values['keys']) . ' type:product';
}
?>It works, but I have a feeling that this is a complicated solution to a simple problem. And there are other drawbacks: The search form on the results page shows '[keys] type:product' in its textfield (should be empty) and it searches sitewide (should be just products). Any suggestions for improvement?
Concerning the uc_views module by BullCreek (hasn't signed up after the server crash): I do have a copy (alpha6c, as of July 10). I can upload it if anyone wishes.
If you could upload it or pm it to me, that would be great. I would like to work on it as a base if possible. Hopefully bullcreek will sign up again, but if it doesn't then a few of us should take off from where he has ended on the uc_views module.
As for search - I'm site isn't live yet - but the solution I am using is just to steal the code generated from my uc_views + fastsearch View. Then I've placed this code into my page.tpl.php file where I want the search box to show up. So my code ends up looking something like this:
<form action="http://www.mysitename.com/views_search" method="get" id="views-filters">
I'm interested in magazines about
<input name="filter0" id="edit-filter0" value="" maxlength="256" size="30" style="font-size: 12px;" type="text">
<input type="hidden" name="op1" id="edit-op1" value="AND" />
<input type="hidden" name="filter1[]" id="edit-filter1" value="**ALL**" />
in
<!-- <select name="filter1[]" id="edit-filter1" size="8"> -->
<select name="filter1[]" id="edit-category" style="font-size: 12px;">
<option value="**ALL**" selected="selected">All Categories</option>
<option value="1">Automobiles</option>
<option value="2">Business</option>
<option value="3">Children</option>
<option value="4">Computing</option>
</select>
<input id="edit-submit" value="Find it!" class="form-submit" type="submit">
</form>So in the View I have created, I have told it to just filter within the Products nodes. Appears to work fine and not search non-product nodes. I also like this method because I can then finetune how the search output appears - I have an image that shows as well as a short description and the of course the product name.
I give the customer the ability to do a keyword search across the entire site or within just a single shopping category.
-Aaron
Thanks, Aaron, seems to work. However, I'm still wondering if there is a way to do this using Drupal's Form API/search system (instead of "stealing" rendered HTML): A simple search block that only searches for UC products, and a result page with a form that does the same...
I bet I can do this using the search routine from the order edit form. You can choose to not use the uBrowser to add products to an order, and it pops up a custom product search form. I'll file this away and get to it eventually if no one else gets to it first. 
This is a bump on the product search issue. My marketing department just asked me to implement:
product search within catagory branch,
the cheesy old A-Z text links that yield all products beginning with [Letter] within catagory
products with specific suggested keyword (a drop down of a CCK field)
my solution? A howitzer aimed at the Marketing department. Anyway....
Has anyone made more progress on sub-catagory search?




