[Koha-cvs] koha/opac opac-detail.pl [rel_2_2]
Joshua Ferraro
jmf at kados.org
Sat Feb 4 02:56:42 CET 2006
CVSROOT: /sources/koha
Module name: koha
Branch: rel_2_2
Changes by: Joshua Ferraro <kados at savannah.gnu.org> 06/02/04 01:56:42
Modified files:
opac : opac-detail.pl
Log message:
Adds Fully Preferences-based Amazon.com feature. See mail to koha-devel
for details.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/koha/opac/opac-detail.pl.diff?only_with_tag=rel_2_2&tr1=1.14.2.11&tr2=1.14.2.12&r1=text&r2=text
Patches:
Index: koha/opac/opac-detail.pl
diff -u koha/opac/opac-detail.pl:1.14.2.11 koha/opac/opac-detail.pl:1.14.2.12
--- koha/opac/opac-detail.pl:1.14.2.11 Fri Feb 3 21:05:20 2006
+++ koha/opac/opac-detail.pl Sat Feb 4 01:56:42 2006
@@ -9,6 +9,7 @@
use HTML::Template;
use C4::Biblio;
use C4::SearchMarc;
+use C4::Amazon;
my $query=new CGI;
my ($template, $borrowernumber, $cookie)
@@ -63,7 +64,6 @@
#preformat isbn for amazon content
$dat->{'isbn'} =~ s|-||g;
-
my @results = ($dat,);
if (C4::Boolean::true_p($marc)) {
my $dbh = C4::Context->dbh;
@@ -87,11 +87,41 @@
SITE_RESULTS => $sitearray,
subscriptions => \@subs,
subscriptionsnumber => $subscriptionsnumber,
- LibraryName => C4::Context->preference("LibraryName"),
+ LibraryName => C4::Context->preference("LibraryName"),
suggestion => C4::Context->preference("suggestion"),
virtualshelves => C4::Context->preference("virtualshelves"),
OpacNav => C4::Context->preference("OpacNav"),
+ AmazonContent => C4::Context->preference("AmazonContent"),
);
+## Amazon.com stuff
+if (C4::Context->preference("AmazonContent")==1) {
+ my $isbn=$dat->{'isbn'};
+ my $amazon_details = &get_amazon_details($isbn);
+
+ foreach my $result (@{$amazon_details->{Details}}){
+ $template->param(item_description => $result->{ProductDescription});
+ $template->param(image => $result->{ImageUrlMedium});
+ $template->param(list_price => $result->{ListPrice});
+ $template->param(amazon_url => $result->{url});
+ }
+
+ my @products;
+ my @reviews;
+ for my $details( @{ $amazon_details->{ Details } } ) {
+ next unless $details->{ SimilarProducts };
+ for my $product ( @{ $details->{ SimilarProducts }->{ Product } } ) {
+ push @products, +{ Product => $product };
+ }
+ next unless $details->{ Reviews };
+ for my $product ( @{ $details->{ Reviews }->{ AvgCustomerRating } } ) {
+ $template->param(rating => $product * 20);
+ }
+ for my $reviews ( @{ $details->{ Reviews }->{ CustomerReview } } ) {
+ push @reviews, +{ Summary => $reviews->{ Summary }, Comment => $reviews->{ Comment }, };
+ }
+ }
+ $template->param( SIMILAR_PRODUCTS => \@products );
+ $template->param( REVIEWS => \@reviews );
+}
output_html_with_http_headers $query, $cookie, $template->output;
-
More information about the Koha-cvs
mailing list