?>
:<br/>
								<?php 
        if (wpsc_product_has_multicurrency()) {
            ?>
									<?php 
            echo wpsc_display_product_multicurrency();
            ?>
								<?php 
        }
        ?>
								<?php 
        if (get_option('display_pnp') == 1) {
            ?>
									<span class="pricedisplay"><?php 
            echo wpsc_product_postage_and_packaging();
            ?>
</span><?php 
            echo __('P&amp;P', 'wpsc');
            ?>
:  <br />
								<?php 
        }
        ?>
						
							<?php 
    }
    ?>
						</div>
					<?php 
    if (function_exists('wpsc_akst_share_link') && get_option('wpsc_share_this') == 1) {
								<input type='text' id='donation_price_<?php echo wpsc_the_product_id(); ?>' name='donation_price' value='<?php echo $wpsc_query->product['price']; ?>' size='6' />
								<br />
							
							
							<?php else : ?>
								<?php if(wpsc_product_on_special()) : ?>
									<span class='oldprice'><?php echo __('Price', 'wpsc'); ?>: <?php echo wpsc_product_normal_price(); ?></span><br />
								<?php endif; ?>
								<span id="product_price_<?php echo wpsc_the_product_id(); ?>" class="pricedisplay"><?php echo wpsc_the_product_price(); ?></span><?php echo __('Price', 'wpsc'); ?>:  <br/>
								<!-- multi currency code -->
								<?php if(wpsc_product_has_multicurrency()) : ?>
								<?php echo wpsc_display_product_multicurrency(); ?>
								<?php endif; ?>
								<!-- end multi currency code -->
								<?php if(get_option('display_pnp') == 1) : ?>
									<span class="pricedisplay"><?php echo wpsc_product_postage_and_packaging(); ?></span><?php echo __('P&amp;P', 'wpsc'); ?>:  <br />
								<?php endif; ?>							
							<?php endif; ?>
						</div>
					<?php if(function_exists('wpsc_akst_share_link') && (get_option('wpsc_share_this') == 1)) {
						echo wpsc_akst_share_link('return');
					} ?>
						
					<input type="hidden" value="add_to_cart" name="wpsc_ajax_action"/>
					<input type="hidden" value="<?php echo wpsc_the_product_id(); ?>" name="product_id"/>
							
					<?php if(wpsc_product_is_customisable()) : ?>				
						<input type="hidden" value="true" name="is_customisable"/>
					<?php endif; ?>
					
					
Esempio n. 3
0
 function post_object($id, $term_id = false, $matches = false)
 {
     $unset_array = array('post_date_gmt', 'post_status', 'comment_status', 'ping_status', 'post_password', 'post_content_filtered', 'to_ping', 'pinged', 'post_modified', 'post_modified_gmt', 'post_parent', 'guid', 'menu_order', 'post_mime_type', 'comment_count', 'ancestors', 'filter');
     global $post;
     $date_format = get_option('date_format');
     $post = get_post($id);
     if ($term_id) {
         if (!in_category($term_id, $post->ID)) {
             return false;
         }
     }
     $size = array('height' => 50, 'width' => 50);
     if ($post != null) {
         $post_object = new stdclass();
         $post_link = get_permalink($post->ID);
         if (in_array('{post_image}', $matches) || in_array('{post_image_html}', $matches)) {
             $post_thumbnail_id = get_post_thumbnail_id($post->ID);
             if ($post_thumbnail_id > 0) {
                 $thumb = wp_get_attachment_image_src($post_thumbnail_id, array($size['height'], $size['width']));
                 $post_object->post_image = trim($thumb[0]) == "" ? WEBNUS_SEARCH_NO_IMAGE : $thumb[0];
                 if (in_array('{post_image_html}', $matches)) {
                     $post_object->post_image_html = '<img src="' . $post_object->post_image . '" width="' . $size['width'] . '" height="' . $size['height'] . '"/>';
                 }
             } else {
                 if ($src = $this->get_image_from_content($post->post_content, $size['height'], $size['width'])) {
                     $post_object->post_image = $src['src'] ? $src['src'] : WEBNUS_SEARCH_NO_IMAGE;
                     if (in_array('{post_image_html}', $matches)) {
                         $post_object->post_image_html = '<img src="' . $post_object->post_image . '" width="' . $src['width'] . '" height="' . $src['height'] . '" />';
                     }
                 } else {
                     $post_object->post_image = WEBNUS_SEARCH_NO_IMAGE;
                     if (in_array('{post_image_html}', $matches)) {
                         $post_object->post_image_html = '';
                     }
                 }
             }
         }
         if ($post->post_type == "wpsc-product") {
             if (function_exists('wpsc_calculate_price')) {
                 if (in_array('{wpsc_price}', $matches)) {
                     $post_object->wpsc_price = wpsc_the_product_price();
                 }
                 if (in_array('{wpsc_shipping}', $matches)) {
                     $post_object->wpsc_shipping = strip_tags(wpsc_product_postage_and_packaging());
                 }
                 if (in_array('{wpsc_image}', $matches)) {
                     $post_object->wpsc_image = wpsc_the_product_image($size['height'], $size['width']);
                 }
             }
         }
         if ($post->post_type == 'product' && class_exists('WC_Product_Factory')) {
             $product_factory = new WC_Product_Factory();
             global $product;
             $product = $product_factory->get_product($post);
             if ($product->is_visible()) {
                 foreach ($matches as $match) {
                     $match = str_replace(array('{', '}'), '', $match);
                     if (in_array($match, array('categories', 'tags'))) {
                         $method = "get_" . $match;
                         if (method_exists($product, $method)) {
                             $term_list = call_user_func(array($product, $method), '');
                             if ($term_list) {
                                 $post_object->{$match} = '<span class="sf_list sf_' . $match . '">' . $term_list . '</span>';
                             } else {
                                 $post_object->{$match} = "";
                             }
                         }
                     } elseif ($match == 'add_to_cart_button') {
                         ob_start();
                         do_action('woocommerce_' . $product->product_type . '_add_to_cart');
                         $post_object->{$match} = '<div class="product">' . ob_get_contents() . '</div>';
                         ob_end_clean();
                     } else {
                         $method = "get_" . $match;
                         if (method_exists($product, $method)) {
                             $post_object->{$match} = call_user_func(array($product, $method));
                         } elseif (method_exists($product, $match)) {
                             $post_object->{$match} = call_user_func(array($product, $match));
                         }
                     }
                 }
             }
             /*
             $post->sku = $product->get_sku();
             $post->sale_price = $product->get_sale_price();
             $post->regular_price = $product->get_regular_price();
             $post->price = $product->get_price();
             $post->price_including_tax = $product->get_price_including_tax();
             $post->price_excluding_tax = $product->get_price_excluding_tax();
             $post->price_suffix = $product->get_price_suffix();
             $post->price_html = $product->get_price_html();
             $post->price_html_from_text = $product->get_price_html_from_text();
             $post->average_rating = $product->get_average_rating();
             $post->rating_count = $product->get_rating_count();
             $post->rating_html = $product->get_rating_html();
             $post->dimensions = $product->get_dimensions();
             $post->shipping_class = $product->get_shipping_class();
             $post->add_to_cart_text = $product->add_to_cart_text();
             $post->single_add_to_cart_text = $product->single_add_to_cart_text();
             $post->add_to_cart_url = $product->add_to_cart_url();
             $post->title = $product->get_title();
             */
         }
         $post_object->ID = $post->ID;
         $post_object->post_title = get_the_title($post->ID);
         if (in_array('{post_excerpt}', $matches)) {
             $post_object->post_excerpt = $post->post_excerpt;
         }
         if (in_array('{post_author}', $matches)) {
             $post_object->post_author = get_the_author_meta('display_name', $post->post_author);
         }
         if (in_array('{post_link}', $matches)) {
             $post_object->post_link = $post_link;
         }
         if (in_array('{post_content}', $matches)) {
             $post_object->post_content = $this->get_text_words(apply_filters('the_content', $post->post_content), (int) $this->get_excerpt_count());
         }
         if (in_array('{post_date_formatted}', $matches)) {
             $post_object->post_date_formatted = date($date_format, strtotime($post->post_date));
         }
         foreach ($matches as $match) {
             $match = str_replace(array('{', '}'), '', $match);
             if (strpos($match, 'custom_field_') !== false) {
                 $key = str_replace('custom_field_', '', $match);
                 $custom_field = get_post_meta($post->ID, $key, true);
                 if (is_array($custom_field)) {
                     $cf_name = 'custom_field_' . $key;
                     $post_object->{$cf_name} = apply_filters('sf_post_custom_field', $custom_field[0], $key, $post);
                 } else {
                     $cf_name = 'custom_field_' . $key;
                     $post_object->{$cf_name} = apply_filters('sf_post_custom_field', $custom_field, $key, $post);
                 }
             }
         }
         $post_object = apply_filters('sf_post', $post_object);
         return $post_object;
     }
     return false;
 }
            ?>
									<span id="product_price_<?php 
            echo wpsc_the_product_id();
            ?>
" class="pricedisplay"><?php 
            echo wpsc_the_product_price(get_option('wpsc_hide_decimals'));
            ?>
</span><?php 
            echo __('Price', 'wpsc');
            ?>
:  <br/>
									<?php 
            if (get_option('display_pnp') == 1) {
                ?>
										<span class="pricedisplay"><?php 
                echo wpsc_product_postage_and_packaging(get_option('wpsc_hide_decimals'));
                ?>
</span><?php 
                echo __('P&amp;P', 'wpsc');
                ?>
:  <br />
									<?php 
            }
            ?>
							
								<?php 
        }
        ?>
							</div>
							
							<input type="hidden" value="add_to_cart" name="wpsc_ajax_action"/>