Jump to:

23457 Posts in 18905 Topics by 2877 members

General Questions

SilverStripe Forums » General Questions » Advanced Search on Ecommerce module

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1057 Views
  • SSadmin
    Avatar
    Community Member
    90 Posts

    Advanced Search on Ecommerce module Link to this post

    Hey, folks,

    I wonder is there a way that we could decorate the generic Search function to apply search onto ecommerce module.
    For instance, could search by Category, Artist, and even additonal fields that developer cutomized in their product.php.
    Any suggestions or ideas for achieving that?!
    Thanks in advanced.

  • merrick_sd
    Avatar
    Community Member
    95 Posts

    Re: Advanced Search on Ecommerce module Link to this post

    I'm wondering that too.
    I want to search the product InternalItemID (productcode)

    SS 2.3.4
    mysite > page.php

       /**
        * Site search form
        */
       function SearchForm() {
          $searchText = isset($_REQUEST['Search']) ? $_REQUEST['Search'] : 'Search';
          $fields = new FieldSet(
           new TextField("Search", "", $searchText)
           );
          $actions = new FieldSet(
           new FormAction('results', 'Search')
           );

           return new SearchForm($this, "SearchForm", $fields, $actions);
       }
       
       /**
        * Process and render search results
        */
       function results($data, $form){
           $data = array(
           'Results' => $form->getResults(),
           'Query' => $form->getSearchQuery(),
           'Title' => 'Search Results'
           );

           return $this->customise($data)->renderWith(array('Page_results', 'Page'));
       }

    1057 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.