[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ic] Action Map - basics?


I am adding a 'News' section to our Interchange store.

I have successfully added a new MySQL table 'News' and set this up in the UI so entries can be added. 'News' items are categorised by Categories similar to our Product categories.
For simplicity the 'News' table fields look something like:

code    category    newscontent
1    Hammers    New hammers released by Acme etc.
2    Nails    Acme releases line of titanium compound gang nails. etc
3 Nails New tests show hand hammered nails five times stronger than gun nails etc

I have been able to display News items with a news.html page that uses [query] tag and SQL statements.

However, I thought that this might be a good opportunity to use ActionMap functionality.

I think I have read every ActionMap post in the archives and docs however I am struggling getting this to work. Before I go on this is my first ActionMap and I admit I do not fully understand the function.

I am hoping to be able to display news items using URLs as follows:

www.domain.com/storename/news/Hammers

or

www.domain.com/storename/news/Nails


My ActionMap (added to catalog.cfg) looks like:

ActionMap  news  <<EOR
sub {
       my ($action, $category) = split ('/', shift);
       $CGI->{mv_todo} ='search';
       $CGI->{mv_nextpage} = 'resultsnews';
       $CGI->{mv_search_file} = 'News';
       $CGI->{mv_searchtype} = 'db';
       $CGI->{mv_coordinate} = 'yes';
       $CGI->{mv_return_fields} = 'code';
       $CGI->{mv_matchlimit} = '10';
       $CGI->{mv_sort_field} = 'category';
       $CGI->{mv_sort_option} = 'f,n';
       $CGI->{mv_search_field} = 'category';
       $CGI->{mv_searchspec} = "$category";
       $CGI->{banner_text} = "$category";
       $Tag->update('process');
       return 1;
}
EOR

I am stuck trying to get anything to show up in the resultsnews page.

Can someone please advise what loop or list code I need to add to the resultsnews.html page to pull in the news items for selected categories and the correct tag to pull in data from the news table fields?

Simon









_______________________________________________
interchange-users mailing list
suppressed
http://www.icdevgroup.org/mailman/listinfo/interchange-users


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.