本文整理汇总了PHP中wpsc_the_product_thumbnail函数的典型用法代码示例。如果您正苦于以下问题:PHP wpsc_the_product_thumbnail函数的具体用法?PHP wpsc_the_product_thumbnail怎么用?PHP wpsc_the_product_thumbnail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpsc_the_product_thumbnail函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _wpsc_manage_products_column_image
/**
* Image column in Manage Products page
*
* @since 3.8.9
* @access private
* @param object $post Post object
* @param int $post_id Post ID
*/
function _wpsc_manage_products_column_image($post, $post_id)
{
$src = wpsc_the_product_thumbnail(true, true, $post_id, 'manage-products');
if ($src) {
echo '<img src="' . esc_url($src) . '" alt="" />';
} else {
echo '<img src="' . esc_url(WPSC_CORE_IMAGES_URL . '/no-image-uploaded.gif') . '" width="38" height="38" />';
}
}
开发者ID:pankajsinghjarial,项目名称:SYLC,代码行数:17,代码来源:display-items.page.php
示例2: while
<?php endif; ?>
</div>
<?php endif; ?>
<!-- End Pagination -->
<?php /** start the product loop here */?>
<?php while (wpsc_have_products()) : wpsc_the_product(); ?>
<div class="productdisplay default_product_display product_view_<?php echo wpsc_the_product_id(); ?> <?php echo wpsc_category_class(); ?>">
<div class="textcol">
<?php if(get_option('show_thumbnails')) :?>
<div class="imagecol">
<?php if(wpsc_the_product_thumbnail()) :?>
<a rel="<?php echo str_replace(array(" ", '"',"'", '"','''), array("_", "", "", "",''), wpsc_the_product_title()); ?>" class="thickbox preview_link" href="<?php echo wpsc_the_product_image(); ?>">
<img class="product_image" id="product_image_<?php echo wpsc_the_product_id(); ?>" alt="<?php echo wpsc_the_product_title(); ?>" title="<?php echo wpsc_the_product_title(); ?>" src="<?php echo wpsc_the_product_thumbnail(); ?>" />
</a>
<?php else: ?>
<div class="item_no_image">
<a href="<?php echo wpsc_the_product_permalink(); ?>">
<span>No Image Available</span>
</a>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
<div class="producttext">
<h2 class="prodtitles">
<?php if(get_option('hide_name_link') == 1) : ?>
<span><?php echo wpsc_the_product_title(); ?></span>
开发者ID:nerdfiles,项目名称:sideshowtramps.com,代码行数:31,代码来源:products_page.php
示例3: wpsc_cart_item_image
/**
* cart item image function
* returns the url to the to the cart item thumbnail image, if a width and height is specified, it resizes the thumbnail image to that size using the preview code (which caches the thumbnail also)
* @param integer width
* @param integer height
* @return string url to the to the cart item thumbnail image
*/
function wpsc_cart_item_image($width = 31, $height = 31)
{
global $wpsc_cart;
$cart_image = wpsc_the_product_thumbnail($width, $height, $wpsc_cart->cart_item->product_id, "shopping_cart");
if (is_ssl()) {
$cart_image = str_replace('http://', 'https://', $cart_image);
}
return $cart_image;
}
开发者ID:pankajsinghjarial,项目名称:SYLC,代码行数:16,代码来源:cart.class.php
示例4: _wpsc_ajax_set_variation_product_thumbnail
/**
* @access private
*
* @uses current_user_can() Checks user capabilities given string
* @uses delete_post_thumbnail() Deletes post thumbnail given thumbnail id
* @uses set_post_thumbnail() Sets post thumbnail given post_id and thumbnail_id
* @uses wpsc_the_product_thumbnail() Returns URL to the product thumbnail
*
* @return array $response Includes the thumbnail URL and success bool value
*/
function _wpsc_ajax_set_variation_product_thumbnail()
{
$response = array('success' => false);
$post_ID = intval($_POST['post_id']);
if (current_user_can('edit_post', $post_ID)) {
$thumbnail_id = intval($_POST['thumbnail_id']);
if ($thumbnail_id == '-1') {
delete_post_thumbnail($post_ID);
}
set_post_thumbnail($post_ID, $thumbnail_id);
$thumbnail = wpsc_the_product_thumbnail(50, 50, $post_ID, '');
if (!$thumbnail) {
$thumbnail = WPSC_CORE_IMAGES_URL . '/no-image-uploaded.gif';
}
$response['src'] = $thumbnail;
$response['success'] = true;
}
echo json_encode($response);
exit;
}
开发者ID:dreamteam111,项目名称:dreamteam,代码行数:30,代码来源:ajax.php
示例5: column_title
public function column_title($item)
{
$title = implode(', ', $this->object_terms_cache[$item->ID]);
$thumbnail = wpsc_the_product_thumbnail(50, 50, $item->ID, '');
$show_edit_link = apply_filters('wpsc_show_product_variations_edit_action', true, $item);
if (!$thumbnail) {
$thumbnail = WPSC_CORE_IMAGES_URL . '/no-image-uploaded.gif';
}
?>
<div class="wpsc-product-variation-thumbnail">
<a data-title="<?php
echo esc_attr($title);
?>
" href="<?php
echo esc_url(admin_url('media-upload.php?post_id=' . $item->ID . '&TB_iframe=1&width=640&height=566&product_variation=1'));
?>
">
<img id="wpsc-variation-thumbnail-<?php
echo $item->ID;
?>
" src="<?php
echo esc_url($thumbnail);
?>
" alt="" />
</a>
</div>
<div class="wpsc-product-variation-title">
<strong class="row-title">
<?php
if ($show_edit_link) {
?>
<a target="_blank" href="<?php
echo esc_url(get_edit_post_link($item->ID, true));
?>
" title="<?php
esc_attr_e(__('Edit this item'), 'wpsc');
?>
">
<?php
}
?>
<?php
echo esc_html($title);
?>
<?php
if ($show_edit_link) {
?>
</a>
<?php
}
?>
</strong>
<?php
echo $this->row_actions($this->get_row_actions($item));
?>
</div>
<?php
}
开发者ID:pankajsinghjarial,项目名称:SYLC,代码行数:58,代码来源:product-variation-list-table.class.php
示例6: wpsc_specials
/**
* Product Specials Widget content function
*
* Displays the latest products.
*
* @todo Remove marketplace theme specific code and maybe replce with a filter for the image output? (not required if themeable as above)
*
* Changes made in 3.8 that may affect users:
*
* 1. The product title link text does now not have a bold tag, it should be styled via css.
* 2. <br /> tags have been ommitted. Padding and margins should be applied via css.
* 3. Each product is enclosed in a <div> with a 'wpec-special-product' class.
* 4. The product list is enclosed in a <div> with a 'wpec-special-products' class.
* 5. Function now expect a single paramter with an array of options (used to be a string which prepended the output).
*/
function wpsc_specials($args = null, $instance)
{
global $wpdb;
$args = wp_parse_args((array) $args, array('number' => 5));
$siteurl = get_option('siteurl');
if (!($number = (int) $instance['number'])) {
$number = 5;
}
$show_thumbnails = isset($instance['show_thumbnails']) ? (bool) $instance['show_thumbnails'] : FALSE;
$show_description = isset($instance['show_description']) ? (bool) $instance['show_description'] : FALSE;
$excludes = wpsc_specials_excludes();
$args = array('post_type' => 'wpsc-product', 'caller_get_posts' => 1, 'post_status' => 'publish', 'post_parent' => 0, 'post__not_in' => $excludes, 'posts_per_page' => $number);
$special_products = query_posts($args);
$output = '';
$product_ids[] = array();
if (count($special_products) > 0) {
list($wp_query, $special_products) = array($special_products, $wp_query);
// swap the wpsc_query object
while (wpsc_have_products()) {
wpsc_the_product();
if (!in_array(wpsc_the_product_id(), $product_ids)) {
$product_ids[] = wpsc_the_product_id();
if ($show_thumbnails) {
if (wpsc_the_product_thumbnail()) {
?>
<a rel="<?php
echo str_replace(array(" ", '"', "'", '"', '''), array("_", "", "", "", ''), wpsc_the_product_title());
?>
" href="<?php
echo wpsc_the_product_permalink();
?>
">
<img class="product_image" id="product_image_<?php
echo wpsc_the_product_id();
?>
" alt="<?php
echo wpsc_the_product_title();
?>
" title="<?php
echo wpsc_the_product_title();
?>
" src="<?php
echo wpsc_the_product_thumbnail();
?>
"/>
</a>
<?php
} else {
?>
<a href="<?php
echo wpsc_the_product_permalink();
?>
">
<img class="no-image" id="product_image_<?php
echo wpsc_the_product_id();
?>
" alt="No Image" title="<?php
echo wpsc_the_product_title();
?>
" src="<?php
echo WPSC_URL;
?>
/wpsc-theme/wpsc-images/noimage.png" width="<?php
esc_attr_e(get_option('product_image_width'));
?>
" height="<?php
esc_attr_e(get_option('product_image_height'));
?>
" />
</a>
<?php
}
?>
<?php
}
// close show thumbnails
?>
<br />
<span id="special_product_price_<?php
echo wpsc_the_product_id();
?>
">
<!-- price display -->
<?php
//.........这里部分代码省略.........
开发者ID:arturo-mayorga,项目名称:am_com,代码行数:101,代码来源:specials_widget.php
示例7: column_title
public function column_title($item)
{
$title = implode(', ', $this->object_terms_cache[$item->ID]);
$thumbnail = wpsc_the_product_thumbnail(false, false, $item->ID, 'manage-products');
$show_edit_link = apply_filters('wpsc_show_product_variations_edit_action', true, $item);
$nonce = wp_create_nonce("wpsc_ajax_get_variation_gallery_{$item->ID}");
$save_gallery_nonce = wp_create_nonce("wpsc_ajax_update_gallery_{$item->ID}");
$get_gallery_nonce = wp_create_nonce("wpsc_ajax_get_gallery_{$item->ID}");
if (!$thumbnail) {
$thumbnail = WPSC_CORE_IMAGES_URL . '/no-image-uploaded.gif';
}
?>
<div class="wpsc-product-variation-thumbnail">
<a
target="_blank"
data-featured-nonce="<?php
echo esc_attr(wp_create_nonce("update-post_{$item->ID}"));
?>
"
data-nonce="<?php
echo esc_attr($nonce);
?>
"
data-save-gallery-nonce="<?php
echo esc_attr($save_gallery_nonce);
?>
"
data-get-gallery-nonce="<?php
echo esc_attr($get_gallery_nonce);
?>
"
data-image-id="<?php
echo get_post_thumbnail_id($item->ID);
?>
"
data-id="<?php
echo $item->ID;
?>
"
data-title="<?php
echo esc_attr($title);
?>
"
href="<?php
echo esc_url(admin_url('media-upload.php?post_id=' . $item->ID . '&width=640&height=566&product_variation=1'));
?>
"
>
<img id="wpsc-variation-thumbnail-<?php
echo $item->ID;
?>
" src="<?php
echo esc_url($thumbnail);
?>
" alt="" />
</a>
</div>
<div class="wpsc-product-variation-title">
<strong class="row-title">
<?php
if ($show_edit_link) {
?>
<a target="_blank" href="<?php
echo esc_url(get_edit_post_link($item->ID, true));
?>
" title="<?php
esc_attr_e(__('Edit this item'), 'wpsc');
?>
">
<?php
}
?>
<?php
echo esc_html(apply_filters('wpsc_variation_name', $title, $item));
?>
<?php
if ($show_edit_link) {
?>
</a>
<?php
}
?>
</strong>
<?php
echo $this->row_actions($this->get_row_actions($item));
?>
</div>
<?php
}
开发者ID:VanessaGarcia-Freelance,项目名称:ButtonHut,代码行数:89,代码来源:product-variation-list-table.class.php
示例8: get_data_wpsc_38
//.........这里部分代码省略.........
// Code to get the Category Name from the term_taxonomy_id
if (isset($category_ids_all[$record->id])) {
$category_names = "";
$category_id = explode('###', $category_ids_all[$record->id]);
for ($j = 0; $j < sizeof($category_id); $j++) {
if (isset($term_taxonomy[$category_id[$j]])) {
$category_names .= $term_taxonomy[$category_id[$j]] . ', ';
}
}
if ($category_names != "") {
$category_names = substr($category_names, 0, -2);
$record->category = $category_names;
}
} else {
$record->category = "";
}
$product_type = !is_wp_error($product_type) ? !empty($product_type[0]) ? $product_type[0] : '' : '';
// Code for WP_Error and empty check
$record->category = $record->post_parent > 0 && $product_type == 'simple' || $record->post_parent == 0 ? !empty($record->category) ? $record->category : '' : '';
// To hide category name from Product's variations
$prod_meta_values = explode('###', $record->prod_othermeta_value);
$prod_meta_key = explode('###', $record->prod_othermeta_key);
if (count($prod_meta_key) != count($prod_meta_values)) {
continue;
}
$prod_meta_key_values = array_combine($prod_meta_key, $prod_meta_values);
if (intval($record->post_parent) > 0) {
$title = get_post_field('post_title', $record->post_parent, 'raw');
$variation_terms = wp_get_object_terms($record->id, 'wpsc-variation', array('fields' => 'names', 'orderby' => 'name', 'order' => 'ASC'));
$record->post_title = $title . ' - (' . implode(', ', $variation_terms) . ')';
}
// $thumbnail = isset( $prod_meta_key_values['_thumbnail_id'] ) ? wp_get_attachment_image_src( $prod_meta_key_values['_thumbnail_id'], $image_size ) : '';
// $record->thumbnail = ( $thumbnail[0] != '' ) ? $thumbnail[0] : false;
$thumbnail = wpsc_the_product_thumbnail('', '', $record->id, '');
$record->thumbnail = $thumbnail != '' ? $thumbnail : false;
foreach ($prod_meta_key_values as $key => $value) {
if (is_serialized($value)) {
$unsez_data = unserialize($value);
$unsez_data['weight'] = wpsc_convert_weight($unsez_data['weight'], "pound", $unsez_data['weight_unit']);
// get the weight by converting it to repsective unit
foreach ((array) $unsez_data as $meta_key => $meta_value) {
if (is_array($meta_value)) {
foreach ($meta_value as $sub_metakey => $sub_metavalue) {
in_array($sub_metakey, $view_columns) ? $record->{$sub_metakey} = $sub_metavalue : '';
}
} else {
in_array($meta_key, $view_columns) ? $record->{$meta_key} = $meta_value : '';
}
if ($record->post_parent == 0 && wpsc_product_has_children($record->id)) {
if ($show_variation == true) {
$record->_wpsc_price = $record->_wpsc_special_price = ' ';
} elseif ($show_variation == false) {
$parent_price = version_compare(WPSC_VERSION, '3.8.10', '>=') == 1 ? wpsc_product_variation_price_from($record->id) : wpsc_product_variation_price_available($record->id);
$record->_wpsc_price = substr($parent_price, 1, strlen($parent_price));
$record->_wpsc_special_price = substr($parent_price, 1, strlen($parent_price));
}
}
}
unset($prod_meta_key_values[$value]);
} else {
in_array($key, $view_columns) ? $record->{$key} = $value : '';
}
}
unset($record->prod_othermeta_value);
unset($record->prod_meta);
unset($record->prod_othermeta_key);
开发者ID:JaneJieYing,项目名称:kiddoonline_dvlpment,代码行数:67,代码来源:json38.php
示例9: wpsc_specials
/**
* Product Specials Widget content function
*
* Displays the latest products.
*
* Changes made in 3.8 that may affect users:
*
* 1. The product title link text does now not have a bold tag, it should be styled via css.
* 2. <br /> tags have been ommitted. Padding and margins should be applied via css.
* 3. Each product is enclosed in a <div> with a 'wpec-special-product' class.
* 4. The product list is enclosed in a <div> with a 'wpec-special-products' class.
* 5. Function now expect a single paramter with an array of options (used to be a string which prepended the output).
*/
function wpsc_specials($args = null, $instance)
{
global $wpdb;
$args = wp_parse_args((array) $args, array('number' => 5));
if (!($number = (int) $instance['number'])) {
$number = 5;
}
$show_thumbnails = isset($instance['show_thumbnails']) ? (bool) $instance['show_thumbnails'] : false;
$show_description = isset($instance['show_description']) ? (bool) $instance['show_description'] : false;
$show_discount = isset($instance['show_discount']) ? (bool) $instance['show_discount'] : false;
$show_old_price = isset($instance['show_old_price']) ? (bool) $instance['show_old_price'] : false;
$args = array('post_type' => 'wpsc-product', 'ignore_sticky_posts' => 1, 'post_status' => 'publish', 'post_parent' => 0, 'posts_per_page' => $number, 'no_found_rows' => true);
add_filter('posts_join', '_wpsc_filter_special_widget_join');
add_filter('posts_where', '_wpsc_filter_special_widget_where');
$special_products = new WP_Query($args);
remove_filter('posts_join', '_wpsc_filter_special_widget_join');
remove_filter('posts_where', '_wpsc_filter_special_widget_where');
if (!$special_products->post_count) {
echo apply_filters('wpsc_specials_widget_no_items_message', __('We currently have no items on special.', 'wp-e-commerce'));
return;
}
$product_ids = array();
while ($special_products->have_posts()) {
$special_products->the_post();
?>
<h4><strong><a class="wpsc_product_title" href="<?php
echo esc_url(wpsc_product_url(wpsc_the_product_id(), false));
?>
"><?php
echo esc_html(wpsc_the_product_title());
?>
</a></h4></strong>
<?php
if ($show_description) {
?>
<div class="wpsc-special-description">
<?php
echo wpsc_the_product_description();
?>
</div>
<?php
}
// close show description
if (!in_array(wpsc_the_product_id(), $product_ids)) {
$product_ids[] = wpsc_the_product_id();
$has_children = wpsc_product_has_children(get_the_ID());
$width = get_option('product_image_width');
$height = get_option('product_image_height');
if ($show_thumbnails) {
if (wpsc_the_product_thumbnail()) {
?>
<a rel="<?php
echo str_replace(array(" ", '"', "'", '"', '''), array("_", "", "", "", ''), wpsc_the_product_title());
?>
" href="<?php
echo esc_url(wpsc_the_product_permalink());
?>
"><img class="product_image" id="product_image_<?php
echo esc_attr(wpsc_the_product_id());
?>
" alt="<?php
echo esc_attr(wpsc_the_product_title());
?>
" title="<?php
echo esc_attr(wpsc_the_product_title());
?>
" src="<?php
echo esc_url(wpsc_the_product_thumbnail($width, $height));
?>
"/></a>
<?php
} else {
?>
<a href="<?php
esc_url(wpsc_the_product_permalink());
?>
"><img class="no-image" id="product_image_<?php
echo esc_attr(wpsc_the_product_id());
?>
" alt="<?php
echo esc_attr(wpsc_the_product_title());
?>
" title="<?php
echo esc_attr(wpsc_the_product_title());
?>
" src="<?php
//.........这里部分代码省略.........
开发者ID:ashik968,项目名称:digiplot,代码行数:101,代码来源:specials_widget.php
示例10: wpsc_gold_shpcrt_ajax
function wpsc_gold_shpcrt_ajax($id)
{
global $wpdb;
if (isset($_POST) && !empty($_POST)) {
if (isset($_POST['wpsc_live_search']) && $_POST['wpsc_live_search'] == true && (get_option('show_live_search') == 1 || true == $_POST['wpsc_search_widget']) && !empty($_POST['product_search'])) {
$keyword = $_POST['product_search'];
$output = "<ul>";
if (version_compare(WPSC_VERSION, '3.8', '<')) {
$search_sql = gold_shpcrt_search_sql($keyword);
$product_list = $wpdb->get_results("SELECT DISTINCT `" . WPSC_TABLE_PRODUCT_LIST . "`.* FROM `" . WPSC_TABLE_PRODUCT_LIST . "` WHERE `" . WPSC_TABLE_PRODUCT_LIST . "`.`active`='1' {$search_sql} ORDER BY `" . WPSC_TABLE_PRODUCT_LIST . "`.`name` ASC", ARRAY_A);
if ($product_list != null) {
foreach ($product_list as $product) {
//filter out the HTML, otherwise we get partial tags and everything breaks
$product['description'] = wp_kses($product['description'], false);
// shorten the description;
if (strlen($product['description']) > 68) {
$product_description = substr($product['description'], 0, 68) . "...";
} else {
$product_description = $product['description'];
}
//generate the HTML
$output .= "<li>\n\r";
$output .= "\t<a href='" . wpsc_product_url($product['id']) . "'>\n\r";
if ($product['image'] != '') {
$output .= "\t\t\t\t<img class='live-search-image' src='index.php?productid=" . $product['id'] . "&width=50&height=50'>\n\r";
} else {
$output .= "\t\t\t\t<img class='live-search-image' src='" . get_option('siteurl') . "/wp-content/plugins/" . WPSC_DIR_NAME . "/no-image-uploaded.gif' style='height: 50px; width: 50px;'>\n\r";
}
$output .= "\t\t\t\t<div class='live-search-text'>\n\r";
$output .= "\t\t\t\t\t<strong>" . $product['name'] . "</strong>\n\r";
$output .= "\t\t\t\t\t<div class='description'>" . stripslashes($product_description) . "</div>\n\r";
$output .= "\t\t\t\t</div>\n\r";
$output .= "\t\t <br clear='both' />\n\r";
$output .= "\t\t</a>\n\r";
$output .= "</li>\n\r";
}
}
} else {
wpsc_gc_start_search_query();
echo '<ul>';
while (wpsc_have_products()) {
wpsc_the_product();
?>
<li>
<a style="clear:both;" href="<?php
echo wpsc_the_product_permalink();
?>
">
<?php
if (wpsc_the_product_thumbnail()) {
?>
<img class="live-search-image" alt="<?php
echo wpsc_the_product_title();
?>
" src="<?php
echo wpsc_the_product_thumbnail(50, 50, 0, 'live-search');
?>
" />
<?php
} else {
?>
<img class="live-search-image" alt="No Image" title="<?php
echo wpsc_the_product_title();
?>
" src="<?php
echo WPSC_CORE_THEME_URL;
?>
wpsc-images/noimage.png" style="width:50px; height:50px;" />
<?php
}
?>
<div class="live-search-text">
<strong><?php
echo wpsc_the_product_title();
?>
</strong>
<div class="description">
<?php
echo wpsc_the_product_description();
?>
</div>
</div>
</a>
</li>
<?php
}
echo '</ul>';
exit;
}
$output .= "</ul>";
if (!empty($product_list)) {
$_SESSION['live_search_results'] = $product_list;
}
exit($output);
}
}
if (isset($_POST['affiliate']) && $_POST['affiliate'] == true) {
if (!function_exists('affiliate_text')) {
function affiliate_text($id, $user)
{
//.........这里部分代码省略.........
开发者ID:hornet9,项目名称:Morato,代码行数:101,代码来源:gold_shopping_cart.php
示例11: wpsc_generate_product_feed
function wpsc_generate_product_feed()
{
global $wpdb, $wp_query, $post;
set_time_limit(0);
// Don't build up a huge posts cache for the whole store - http://code.google.com/p/wp-e-commerce/issues/detail?id=885
// WP 3.3+ only
if (function_exists('wp_suspend_cache_addition')) {
wp_suspend_cache_addition(true);
}
$chunk_size = apply_filters('wpsc_productfeed_chunk_size', 50);
// Don't cache feed under WP Super-Cache
define('DONOTCACHEPAGE', TRUE);
$selected_category = '';
$selected_product = '';
$args = array('post_type' => 'wpsc-product', 'numberposts' => $chunk_size, 'offset' => 0, 'cache_results' => false);
$args = apply_filters('wpsc_productfeed_query_args', $args);
$self = site_url("/index.php?rss=true&action=product_list{$selected_category}{$selected_product}");
header("Content-Type: application/xml; charset=UTF-8");
header('Content-Disposition: inline; filename="E-Commerce_Product_List.rss"');
echo "<?xml version='1.0' encoding='UTF-8' ?>\n\r";
echo "<rss version='2.0' xmlns:atom='http://www.w3.org/2005/Atom'";
$google_checkout_note = false;
if ($_GET['xmlformat'] == 'google') {
echo ' xmlns:g="http://base.google.com/ns/1.0"';
// Is Google Checkout available as a payment gateway
$selected_gateways = get_option('custom_gateway_options');
if (in_array('google', $selected_gateways)) {
$google_checkout_note = true;
}
} else {
echo ' xmlns:product="http://www.buy.com/rss/module/productV2/"';
}
echo ">\n\r";
echo " <channel>\n\r";
echo " <title><![CDATA[" . get_option('blogname') . " Products]]></title>\n\r";
echo " <link>" . get_option('siteurl') . "/wp-admin/admin.php?page=" . WPSC_DIR_NAME . "/display-log.php</link>\n\r";
echo " <description>This is the WP e-Commerce Product List RSS feed</description>\n\r";
echo " <generator>WP e-Commerce Plugin</generator>\n\r";
echo " <atom:link href='{$self}' rel='self' type='application/rss+xml' />\n\r";
$products = get_posts($args);
while (count($products)) {
foreach ($products as $post) {
setup_postdata($post);
$purchase_link = wpsc_product_url($post->ID);
echo " <item>\n\r";
if ($google_checkout_note) {
echo " <g:payment_notes>Google Checkout</g:payment_notes>\n\r";
}
echo " <title><![CDATA[" . get_the_title() . "]]></title>\n\r";
echo " <link>{$purchase_link}</link>\n\r";
echo " <description><![CDATA[" . apply_filters('the_content', get_the_content()) . "]]></description>\n\r";
echo " <pubDate>" . $post->post_modified_gmt . "</pubDate>\n\r";
echo " <guid>{$purchase_link}</guid>\n\r";
$image_link = wpsc_the_product_thumbnail();
if ($image_link !== FALSE) {
if ($_GET['xmlformat'] == 'google') {
echo " <g:image_link>{$image_link}</g:image_link>\n\r";
} else {
echo " <enclosure url='{$image_link}' />\n\r";
}
}
$price = wpsc_calculate_price($post->ID);
$currargs = array('display_currency_symbol' => false, 'display_decimal_point' => true, 'display_currency_code' => false, 'display_as_html' => false);
$price = wpsc_currency_display($price, $currargs);
$children = get_children(array('post_parent' => $post->ID, 'post_type' => 'wpsc-product'));
foreach ($children as $child) {
$child_price = wpsc_calculate_price($child->ID);
if ($price == 0 && $child_price > 0) {
$price = $child_price;
} else {
if ($child_price > 0 && $child_price < $price) {
$price = $child_price;
}
}
}
if ($_GET['xmlformat'] == 'google') {
echo " <g:price>" . $price . "</g:price>\n\r";
$google_elements = array();
$product_meta = get_post_custom($post->ID);
if (is_array($product_meta)) {
foreach ($product_meta as $meta_key => $meta_value) {
if (stripos($meta_key, 'g:') === 0) {
$google_elements[$meta_key] = $meta_value;
}
}
}
$google_elements = apply_filters('wpsc_google_elements', array('product_id' => $post->ID, 'elements' => $google_elements));
$google_elements = $google_elements['elements'];
$done_condition = FALSE;
$done_availability = FALSE;
$done_weight = FALSE;
if (count($google_elements)) {
foreach ($google_elements as $element_name => $element_values) {
foreach ($element_values as $element_value) {
echo " <" . $element_name . ">";
echo "<![CDATA[" . $element_value . "]]>";
echo "</" . $element_name . ">\n\r";
}
if ($element_name == 'g:shipping_weight') {
$done_weight = TRUE;
//.........这里部分代码省略.........
开发者ID:arturo-mayorga,项目名称:am_com,代码行数:101,代码来源:productfeed.php
示例12: wpsc_also_bought
function wpsc_also_bought($product_id)
{
/*
* Displays products that were bought aling with the product defined by $product_id
* most of it scarcely needs describing
*/
global $wpdb;
if (get_option('wpsc_also_bought') == 0) {
//returns nothing if this is off
return '';
}
// to be made customiseable in a future release
$also_bought_limit = 3;
$element_widths = 96;
$image_display_height = 96;
$image_display_width = 96;
$output = '';
$also_bought = $wpdb->get_results($wpdb->prepare("SELECT `" . $wpdb->posts . "`.* FROM `" . WPSC_TABLE_ALSO_BOUGHT . "`, `" . $wpdb->posts . "` WHERE `selected_product`= %d AND `" . WPSC_TABLE_ALSO_BOUGHT . "`.`associated_product` = `" . $wpdb->posts . "`.`id` AND `" . $wpdb->posts . "`.`post_status` IN('publish','protected') ORDER BY `" . WPSC_TABLE_ALSO_BOUGHT . "`.`quantity` DESC LIMIT {$also_bought_limit}", $product_id), ARRAY_A);
if (count($also_bought) > 0) {
$output .= "<h2 class='prodtitles wpsc_also_bought' >" . __('People who bought this item also bought', 'wpsc') . "</h2>";
$output .= "<div class='wpsc_also_bought'>";
foreach ((array) $also_bought as $also_bought_data) {
$output .= "<div class='wpsc_also_bought_item' style='width: " . $element_widths . "px;'>";
if (get_option('show_thumbnails') == 1) {
$image_path = wpsc_the_product_thumbnail($image_display_width, $image_display_height, $also_bought_data['ID']);
if ($image_path) {
$output .= "<a href='" . get_permalink($also_bought_data['ID']) . "' class='preview_link' rel='" . str_replace(" ", "_", get_the_title($also_bought_data['ID'])) . "'>";
$output .= "<img src='{$image_path}' id='product_image_" . $also_bought_data['ID'] . "' class='product_image' style='margin-top: " . $margin_top . "px'/>";
$output .= "</a>";
} else {
if (get_option('product_image_width') != '') {
$output .= "<img src='" . WPSC_CORE_IMAGES_URL . "/no-image-uploaded.gif' title='" . esc_attr(get_the_title($also_bought_data['ID'])) . "' alt='" . esc_attr($also_bought_data['name']) . "' width='{$image_display_height}' height='{$image_display_height}' id='product_image_" . $also_bought_data['ID'] . "' class='product_image' />";
} else {
$output .= "<img src='" . WPSC_CORE_IMAGES_URL . "/no-image-uploaded.gif' title='" . esc_attr(get_the_title($also_bought_data['ID'])) . "' alt='" . esc_attr(get_the_title($also_bought_data['ID'])) . "' id='product_image_" . $also_bought_data['ID'] . "' class='product_image' />";
}
}
}
$output .= "<a class='wpsc_product_name' href='" . get_permalink($also_bought_data['ID']) . "'>" . get_the_title($also_bought_data['ID']) . "</a>";
$price = get_product_meta($also_bought_data['ID'], 'price', true);
$special_price = get_product_meta($also_bought_data['ID'], 'special_price', true);
if (!empty($special_price)) {
$output .= '<span style="text-decoration: line-through;">' . wpsc_currency_display($price) . '</span>';
$output .= wpsc_currency_display($special_price);
} else {
$output .= wpsc_currency_display($price);
}
$output .= "</div>";
}
$output .= "</div>";
$output .= "<br clear='all' />";
}
return $output;
}
开发者ID:pankajsinghjarial,项目名称:SYLC,代码行数:53,代码来源:display.functions.php
示例13: wpsc_specials
/**
* Product Specials Widget content function
*
* Displays the latest products.
*
* @todo Remove marketplace theme specific code and maybe replce with a filter for the image output? (not required if themeable as above)
*
* Changes made in 3.8 that may affect users:
*
* 1. The product title link text does now not have a bold tag, it should be styled via css.
* 2. <br /> tags have been ommitted. Padding and margins should be applied via css.
* 3. Each product is enclosed in a <div> with a 'wpec-special-product' class.
* 4. The product list is enclosed in a <div> with a 'wpec-special-products' class.
* 5. Function now expect a single paramter with an array of options (used to be a string which prepended the output).
*/
function wpsc_specials($args = null, $instance)
{
global $wpdb;
$args = wp_parse_args((array) $args, array('number' => 5));
$siteurl = get_option('siteurl');
if (!($number = (int) $instance['number'])) {
$number = 5;
}
$show_thumbnails = isset($instance['show_thumbnails']) ? (bool) $instance['show_thumbnails'] : FALSE;
$show_description = isset($instance['show_description']) ? (bool) $instance['show_description'] : FALSE;
$excludes = wpsc_specials_excludes();
$args = array('post_type' => 'wpsc-product', 'caller_get_posts' => 1, 'post_status' => 'publish', 'post_parent' => 0, 'post__not_in' => $excludes, 'posts_per_page' => $number);
$special_products = query_posts($args);
$output = '';
$product_ids[] = array();
if (count($special_products) > 0) {
list($wp_query, $special_products) = array($special_products, $wp_query);
// swap the wpsc_query object
while (wpsc_have_products()) {
wpsc_the_product();
if (!in_array(wpsc_the_product_id(), $product_ids)) {
$product_ids[] = wpsc_the_product_id();
if ($show_thumbnails) {
if (wpsc_the_product_thumbnail()) {
?>
<a rel="<?php
echo str_replace(array(" ", '"', "'", '"', '''), array("_", "", "", "", ''), wpsc_the_product_title());
?>
" href="<?php
echo wpsc_the_product_permalink();
?>
">
<img class="product_image" id="product_image_<?php
echo wpsc_the_product_id();
?>
" alt="<?php
echo wpsc_the_product_title();
?>
" title="<?php
echo wpsc_the_product_title();
?>
" src="<?php
echo wpsc_the_product_thumbnail();
?>
"/>
</a>
<?php
} else {
?>
<a href="<?php
echo wpsc_the_product_permalink();
?>
">
<img class="no-image" id="product_image_<?php
echo wpsc_the_product_id();
?>
" alt="No Image" title="<?php
echo wpsc_the_product_title();
?>
" src="<?php
echo WPSC_URL;
?>
/wpsc-theme/wpsc-images/noimage.png" width="<?php
esc_attr_e(get_option('product_image_width'));
?>
" height="<?php
esc_attr_e(get_option('product_image_height'));
?>
" />
</a>
<?php
}
?>
<?php
}
// close show thumbnails
?>
<br />
<span id="special_product_price_<?php
echo wpsc_the_product_id();
?>
">
<!-- price display -->
<?php
//.........这里部分代码省略.........
开发者ID:hornet9,项目名称:Morato,代码行数:101,代码来源:specials_widget.php
示例14: getSliderProducts
function getSliderProducts($products)
{
$products = explode(",", $products);
global $wpsc_query, $wpdb;
foreach ($products as $product) {
$image_width = get_option('single_view_image_width');
$image_height = get_option('single_view_image_height');
$options = get_option('site_basic_options');
$wpsc_query = new WPSC_Query(array('product_id' => $product));
while (wpsc_have_products()) {
wpsc_the_product();
?>
<li class="feature-product">
<?php
if (wpsc_the_product_thumbnail()) {
?>
<div class="product-image">
<a rel="<?php
echo str_replace(array(" ", '"', "'", '"', '''), array("_", "", "", "", ''), wpsc_the_product_title());
?>
" class="thickbox preview_link" href="<?php
echo wpsc_the_product_image();
?>
">
<img class="product_image" id="product_image_<?php
echo wpsc_the_product_id();
?>
" alt="<?php
echo wpsc_the_product_title();
?>
" title="<?php
echo wpsc_the_product_title();
?>
" src="<?php
if ($options['themelayout'] == 'boxed') {
bloginfo('template_url');
?>
/timthumb.php?src=<?php
echo wpsc_the_product_image($image_width, $image_height);
|
请发表评论