Пример #1
0
 /**
  * @param $isbn
  * @return string
  */
 function getAmazonCover($isbn)
 {
     $isbn = ISBN13toISBN10(preg_replace('/[^\\d]/', '', $isbn));
     if ($isbn != '') {
         $cover = 'https://images-eu.ssl-images-amazon.com/images/P/' . $isbn . '.MZZZZZZZ.jpg';
         try {
             list($width, $height, $type, $attr) = getimagesize($cover);
             if ($width == 1 and $height == 1) {
                 $cover = asset('/images/no_book_cover.jpg');
             }
         } catch (Exception $e) {
             $cover = asset('/images/no_book_cover.jpg');
         }
     } else {
         $cover = asset('/images/no_book_cover.jpg');
     }
     return $cover;
 }
<?php 
global $post, $product;
?>
 	<?php 
do_action('woocommerce_product_meta_start');
?>
 
 	
 	
 <?php 
if ($product->is_type(array('simple', 'variable')) && get_option('woocommerce_enable_sku') == 'yes' && $product->get_sku()) {
    ?>
 
 <?php 
    $isbn_13 = $product->get_sku();
    $isbn_13_converted = ISBN13toISBN10($isbn_13);
    //for Amazon
    ?>
 
 <?php 
}
?>
	
  
  
<li><a href="http://www.amazon.com/dp/<?php 
echo $isbn_13_converted;
?>
" title="Amazon"><img src="/wp-content/themes/pubspring_core_pubs/images/booksellers/500px-Amazon_com_logo_svg.png" alt="Amazon.com" style="height: 22px;" /></a></li>
<li><a href="http://search.barnesandnoble.com/booksearch/isbnInquiry.asp?EAN=<?php 
echo $isbn_13;