Esempio n. 1
0
 public function getProductMainImageURL($post_id, $checking_parent = false)
 {
     // check if custom post meta field '_ebay_gallery_image_url' exists
     if (get_post_meta($post_id, '_ebay_gallery_image_url', true)) {
         return $this->removeHttpsFromUrl(get_post_meta($post_id, '_ebay_gallery_image_url', true));
     }
     // check if custom post meta field 'ebay_image_url' exists
     if (get_post_meta($post_id, 'ebay_image_url', true)) {
         return $this->removeHttpsFromUrl(get_post_meta($post_id, 'ebay_image_url', true));
     }
     // this seems to be neccessary for listing previews on some installations
     if (!function_exists('get_post_thumbnail_id')) {
         require_once ABSPATH . 'wp-includes/post-thumbnail-template.php';
     }
     // get main product image (post thumbnail)
     $large_image_url = ProductWrapper::getImageURL($post_id);
     // if ( $large_image_url ) {
     $image_url = $large_image_url;
     // } else {
     // 	$images = $this->getProductImagesURL( $post_id ); // disabled as it could lead to infinite recursion issue
     // 	$image_url = @$images[0];
     // }
     // check if featured image comes from nextgen gallery
     if ($this->is_plugin_active('nextgen-gallery/nggallery.php')) {
         $thumbnail_id = get_post_meta($post_id, '_thumbnail_id', true);
         if ('ngg' == substr($thumbnail_id, 0, 3)) {
             $imageID = str_replace('ngg-', '', $thumbnail_id);
             $picture = nggdb::find_image($imageID);
             $image_url = $picture->imageURL;
             // WPLE()->logger->info( "NGG - picture: " . print_r($picture,1) );
             WPLE()->logger->info("NGG - image_url: " . print_r($image_url, 1));
         }
     }
     // filter image_url hook
     $image_url = apply_filters('wplister_get_product_main_image', $image_url, $post_id);
     // if no main image found, check parent product
     if ($image_url == '' && !$checking_parent) {
         // $parents = get_post_ancestors( $post_id );
         $post = get_post($post_id);
         $parent_id = isset($post->post_parent) ? $post->post_parent : false;
         if ($parent_id) {
             return $this->getProductMainImageURL($parent_id, true);
         }
     }
     // ebay doesn't accept https - only http and ftp
     $image_url = $this->removeHttpsFromUrl($image_url);
     return $image_url;
 }
Esempio n. 2
0
	<?php 
foreach ($items as $item) {
    ?>
		
	<a href="<?php 
    echo $item['ViewItemURL'];
    ?>
" title="<?php 
    echo $item['auction_title'];
    ?>
" target="_top">

		<div class="thumb">
			<!-- <img src="<?php 
    echo ProductWrapper::getImageURL($item['post_id']);
    ?>
" alt="<?php 
    echo $item['auction_title'];
    ?>
" />  -->
			<img src="<?php 
    echo $item['GalleryURL'];
    ?>
" alt="<?php 
    echo $item['auction_title'];
    ?>
" /> 
		</div>

		<div class="title"><?php