koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] koha/opac opac-detail.pl [dev_week]


From: Cindy Murdock
Subject: [Koha-cvs] koha/opac opac-detail.pl [dev_week]
Date: Wed, 16 Apr 2008 19:30:03 +0000

CVSROOT:        /sources/koha
Module name:    koha
Branch:         dev_week
Changes by:     Cindy Murdock <clm>     08/04/16 19:30:03

Modified files:
        opac           : opac-detail.pl 

Log message:
        Applying Jesse's Amazon patch to dev_week.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-detail.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.14.2.19.2.7&r2=1.14.2.19.2.8

Patches:
Index: opac-detail.pl
===================================================================
RCS file: /sources/koha/koha/opac/opac-detail.pl,v
retrieving revision 1.14.2.19.2.7
retrieving revision 1.14.2.19.2.8
diff -u -b -r1.14.2.19.2.7 -r1.14.2.19.2.8
--- opac-detail.pl      4 Dec 2006 05:41:43 -0000       1.14.2.19.2.7
+++ opac-detail.pl      16 Apr 2008 19:30:02 -0000      1.14.2.19.2.8
@@ -124,26 +124,28 @@
 
        my $amazon_details = &get_amazon_details($dat->{amazonisbn});
 
-       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});
+       use Data::Dumper;
+       
+       foreach my $item (@{$amazon_details->{Items}->{Item}}) {
+#              $template->param(item_description => 
$result->{ProductDescription});
+               $template->param(image => $item->{MediumImage}->{URL});
+               $template->param(list_price => 
$item->{ItemAttributes}->{ListPrice}->{FormattedPrice});
+               $template->param(amazon_url => $item->{DetailPageURL});
        }
 
        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);
+       foreach my $item (@{$amazon_details->{Items}->{Item}}) {
+               next unless $item->{SimilarProducts};
+               foreach my $product 
(@{$item->{SimilarProducts}->{SimilarProduct}}) {
+                       push @products, {asin => $product->{ASIN}, title => 
$product->{Title}, url => "http://amazon.com/dp/"; . $product->{ASIN}};
                }
-               for my $reviews ( @{ $details->{ Reviews }->{ CustomerReview } 
} ) {
-                       push @reviews, +{ Date => $reviews->{ Date }, Rating => 
$reviews->{ Rating }, Summary => $reviews->{ Summary }, Comment => $reviews->{ 
Comment }, };
+
+               next unless $item->{CustomerReviews};
+               $template->param(rating => 
$item->{CustomerReviews}->{AverageRating} * 20);
+               $template->param(amazon_rating => 
$item->{CustomerReviews}->{AverageRating});
+
+               foreach my $review (@{$item->{CustomerReviews}->{Review}}) {
+                       push @reviews, {Summary => $review->{Summary}, Comment 
=> $review->{Content}};  
                }
        }
        $template->param( SIMILAR_PRODUCTS => address@hidden );




reply via email to

[Prev in Thread] Current Thread [Next in Thread]