本文整理汇总了PHP中wpsc_the_product_id函数的典型用法代码示例。如果您正苦于以下问题:PHP wpsc_the_product_id函数的具体用法?PHP wpsc_the_product_id怎么用?PHP wpsc_the_product_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpsc_the_product_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wpsc_buy_now_button
/**
* wpsc buy now button code products function
* Sorry about the ugly code, this is just to get the functionality back, buy now will soon be overhauled, and this function will then be completely different
* @return string - html displaying one or more products
*/
function wpsc_buy_now_button($product_id, $replaced_shortcode = false)
{
global $wpdb, $wpsc_query, $wpsc_cart;
$temp_wpsc_query = new WPSC_query(array('product_id' => $product_id));
list($wpsc_query, $temp_wpsc_query) = array($temp_wpsc_query, $wpsc_query);
// swap the wpsc_query objects
// exit('<pre>'.print_r($temp_wpsc_query, true).'</pre>');
$selected_gateways = get_option('custom_gateway_options');
if (in_array('google', (array) $selected_gateways)) {
$output .= google_buynow($product['id']);
} else {
if (in_array('paypal_multiple', (array) $selected_gateways)) {
if ($product_id > 0) {
//$output .= "<pre>".print_r($wpsc_query,true)."</pre>";
while (wpsc_have_products()) {
wpsc_the_product();
$price = calculate_product_price($wpsc_query->product['id'], $wpsc_query->first_variations);
$shipping = $wpsc_query->product['pnp'];
$output .= "<form onsubmit='log_paypal_buynow(this)' target='paypal' action='" . get_option('paypal_multiple_url') . "' method='post' />\n\t\t\t\t\t<input type='hidden' name='business' value='" . get_option('paypal_multiple_business') . "' />\n\t\t\t\t\t<input type='hidden' name='cmd' value='_xclick' />\n\t\t\t\t\t<input type='hidden' name='item_name' value='" . wpsc_the_product_title() . "' />\n\t\t\t\t\t<input type='hidden' id='item_number' name='item_number' value='" . wpsc_the_product_id() . "' />\n\t\t\t\t\t<input type='hidden' id='amount' name='amount' value='" . ($price + $pnp) . "' />\n\t\t\t\t\t<input type='hidden' id='unit' name='unit' value='" . $price . "' />\n\t\t\t\t\t<input type='hidden' id='shipping' name='ship11' value='" . $shipping . "' />\n\t\t\t\t\t<input type='hidden' name='handling' value='" . get_option('base_local_shipping') . "' />\n\t\t\t\t\t<input type='hidden' name='currency_code' value='" . get_option('paypal_curcode') . "' />\n\t\t\t\t\t<input type='hidden' name='undefined_quantity' value='0' />\n\t\t\t\t\t<input type='image' name='submit' border='0' src='https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif' alt='PayPal - The safer, easier way to pay online' />\n\t\t\t\t\t<img alt='' border='0' width='1' height='1' src='https://www.paypal.com/en_US/i/scr/pixel.gif' />\n\t\t\t\t</form>\n\r";
}
}
}
}
list($temp_wpsc_query, $wpsc_query) = array($wpsc_query, $temp_wpsc_query);
// swap the wpsc_query objects back
if ($replaced_shortcode == true) {
return $output;
} else {
echo $output;
}
}
示例2: cdl_get_cat
function cdl_get_cat()
{
global $wp_query, $wpsc_query;
$query_data = array();
$cdl_post_id = wpsc_the_product_id();
$categories = wp_get_object_terms($cdl_post_id, 'wpsc_product_category');
//if product is associated w more than one category
if (count($categories) > 1 && isset($wpsc_query->query_vars['wpsc_product_category'])) {
$query_data['category'] = $wpsc_query->query_vars['wpsc_product_category'];
} elseif (count($categories) > 0) {
$query_data['category'] = $categories[0]->slug;
}
return $query_data['category'];
}
示例3: wpsc_product_rater
<?php echo wpsc_product_rater(); ?>
<?php
if(function_exists('gold_shpcrt_display_gallery')) :
echo gold_shpcrt_display_gallery(wpsc_the_product_id());
endif;
echo wpsc_also_bought(wpsc_the_product_id());
?>
</div>
<form onsubmit="submitform(this);return false;" action="<?php echo wpsc_this_page_url(); ?>" method="post" name="product_<?php echo wpsc_the_product_id(); ?>" id="product_extra_<?php echo wpsc_the_product_id(); ?>">
<input type="hidden" value="<?php echo wpsc_the_product_id(); ?>" name="prodid"/>
<input type="hidden" value="<?php echo wpsc_the_product_id(); ?>" name="item"/>
</form>
</div>
</div>
</div>
<?php echo wpsc_product_comments(); ?>
<?php endwhile; ?>
<?php /** end the product loop here */?>
<?php
if(function_exists('fancy_notifications')) {
echo fancy_notifications();
}
?>
示例4: get_permalink
?>
</a>
</div>
</div><?php
if (wpsc_the_product_thumbnail()) {
?>
<div class="featured_item_image">
<a href="<?php
echo get_permalink($product->ID);
?>
" title="<?php
echo get_the_title($product->ID);
?>
"><?php
echo wpsc_the_sticky_image(wpsc_the_product_id());
?>
</a>
</div><?php
} else {
?>
<div class="item_no_image">
<a href="<?php
echo get_the_title($product->ID);
?>
"><span><?php
esc_html_e('No Image Available', 'wpsc');
?>
</span></a>
</div><?php
示例5: wpsc_buy_now_button
<?php
if (get_option('hide_addtocart_button') == 0 && get_option('addtocart_or_buynow') == '1') {
?>
<?php
echo wpsc_buy_now_button(wpsc_the_product_id());
?>
<?php
}
?>
<?php
echo wpsc_product_rater();
?>
<?php
if (function_exists('gold_shpcrt_display_gallery')) {
echo gold_shpcrt_display_gallery(wpsc_the_product_id(), true);
}
?>
</div>
</div>
</div>
<?php
}
?>
<?php
/** end the product loop here */
?>
<?php
示例6: if
<?php /** the variation group HTML and loop ends here */?>
<?php endif; ?>
<?php if((get_option('display_addtocart') == 1) && (get_option('addtocart_or_buynow') !='1')) :?>
<?php if(wpsc_product_has_stock()) : ?>
<input type='image' src='<?php echo WPSC_URL; ?>/themes/iShop/images/buy_button.gif' id='product_<?php echo wpsc_the_product_id(); ?>_submit_button' class='wpsc_buy_button' name='Buy' value="<?php echo __('Add To Cart', 'wpsc'); ?>" />
<?php else : ?>
<p class='soldout'><?php echo __('This product has sold out.', 'wpsc'); ?></p>
<?php endif ; ?>
<?php endif; ?>
</form>
</div>
<?php if((get_option('display_addtocart') == 1) && (get_option('addtocart_or_buynow') == '1')) :?>
<?php echo wpsc_buy_now_button(wpsc_the_product_id()); ?>
<?php endif ; ?>
<?php endif; ?>
</div>
<?php if((get_option('grid_number_per_row') > 0) && ((($wpsc_query->current_product +1) % get_option('grid_number_per_row')) == 0)) :?>
<div class='grid_view_newline'></div>
<?php endif ; ?>
<?php endwhile; ?>
<?php if(wpsc_product_count() < 1):?>
示例7: wpsc_you_save
function wpsc_you_save($args = null)
{
$defaults = array('product_id' => false, 'type' => "percentage", 'variations' => false);
$args = wp_parse_args($args, $defaults);
extract($args, EXTR_SKIP);
global $wpdb;
if (!$product_id) {
if (function_exists('wpsc_the_product_id')) {
//select the variation ID with lowest price
$product_id = $wpdb->get_var('SELECT `posts`.`id` FROM ' . $wpdb->posts . ' `posts` JOIN ' . $wpdb->postmeta . ' `postmeta` ON `posts`.`id` = `postmeta`.`post_id` WHERE `posts`.`post_parent` = ' . wpsc_the_product_id() . ' AND `posts`.`post_type` = "wpsc-product" AND `posts`.`post_status` = "inherit" AND `postmeta`.`meta_key`="_wpsc_price" ORDER BY (`postmeta`.`meta_value`)+0 ASC LIMIT 1');
if (!$product_id) {
$product_id = wpsc_the_product_id();
}
}
}
if (!$product_id) {
return 0;
}
$regular_price = wpsc_calculate_price($product_id, $variations, false);
$sale_price = wpsc_calculate_price($product_id, $variations, true);
switch ($type) {
case "amount":
return $regular_price - $sale_price;
break;
default:
if (number_format(($regular_price - $sale_price) / $regular_price * 100, 2) == 100) {
return 99.98999999999999;
} else {
return number_format(($regular_price - $sale_price) / $regular_price * 100, 2);
}
}
}
示例8: wpsc_latest_product
function wpsc_latest_product($args = null, $instance)
{
global $wpdb;
$args = wp_parse_args((array) $args, array('number' => 5));
$siteurl = get_option('siteurl');
$options = get_option('wpsc-widget_latest_products');
$number = isset($instance['number']) ? (int) $instance['number'] : 5;
$image = isset($instance['image']) ? (bool) $instance['image'] : FALSE;
if (isset($instance['width'])) {
$width = $instance['width'];
}
if (isset($instance['height'])) {
$height = $instance['height'];
}
$latest_products = get_posts(array('post_type' => 'wpsc-product', 'numberposts' => $number, 'orderby' => 'post_date', 'post_parent' => 0, 'post_status' => 'publish', 'order' => 'DESC'));
$output = '';
if (count($latest_products) > 0) {
foreach ($latest_products as $latest_product) {
// Link
$output .= '<a href="' . wpsc_product_url($latest_product->ID, null) . '" class="wpsc-product-title">' . stripslashes($latest_product->post_title) . '</a>';
// Thumbnails, if required
if ($image) {
$output .= '<div class="item_image">';
$output .= '<a href="' . wpsc_product_url($latest_product->ID, null) . '">';
$attached_images = (array) get_posts(array('post_type' => 'attachment', 'numberposts' => 1, 'post_status' => null, 'post_parent' => $latest_product->ID, 'orderby' => 'menu_order', 'order' => 'ASC'));
$attached_image = $attached_images[0];
if ($attached_image->ID > 0) {
$output .= '<img src="' . wpsc_product_image($attached_image->ID, $width, $height) . '" title="' . $latest_product->post_title . '" alt="' . $latest_product->post_title . '" />';
} else {
$output .= '<img class="no-image" id="product_image_' . wpsc_the_product_id() . '" alt="No Image" title="' . wpsc_the_product_title() . '" src="' . WPSC_URL . '/wpsc-theme/images/noimage.png" width="' . $width . '" height="' . $height . '" />';
}
$output .= '<span></span>';
$output .= '</a>';
$output .= '</div>';
}
}
}
echo $output;
}
示例9: vtprd_show_product_you_save
function vtprd_show_product_you_save($product_id = null)
{
global $post, $vtprd_setup_options, $vtprd_info;
//can only be executed when WPEC version less than 3.8.9
if (!(version_compare(strval('3.8.9'), strval(WPSC_VERSION), '>') == 1)) {
//'==1' = 2nd value is lower
return;
}
$pct = vtprd_get_single_product_you_save_pct($product_id);
$amt = $vtprd_info['product_session_info']['product_yousave_total_amt'];
$amt = vtprd_format_money_element($amt);
//CUSTOM function created by CUSTOMER
if (function_exists('custom_show_single_product_you_save')) {
custom_show_single_product_you_save($product_id, $pct, $amt);
return;
}
if ($pct) {
?>
<p class="pricedisplay product_<?php
echo wpsc_the_product_id();
?>
"><?php
_e('You save', 'wpsc');
?>
: <span class="yousave" id="yousave_<?php
echo wpsc_the_product_id();
?>
"><?php
echo $amt;
?>
! (<?php
echo $pct;
?>
%)</span></p>
<?php
} else {
//original code from wpsc-single_product.php
?>
<?php
if (wpsc_product_on_special()) {
?>
<p class="pricedisplay product_<?php
echo wpsc_the_product_id();
?>
"><?php
_e('You save', 'wpsc');
?>
: <span class="yousave" id="yousave_<?php
echo wpsc_the_product_id();
?>
"><?php
echo wpsc_currency_display(wpsc_you_save('type=amount'), array('html' => false));
?>
! (<?php
echo wpsc_you_save();
?>
%)</span></p>
<?php
}
?>
<?php
}
return;
}
示例10: wpsc_get_form_action
/**
* wpsc_get_form_action
*
* Return the form action for use in the template files
*
* @global <type> $wpec_form_action
* @return <type>
*/
function wpsc_get_form_action()
{
global $wpec_form_action;
$product_id = wpsc_the_product_id();
// Function has already ran in this page load
if (isset($wpec_form_action)) {
$action = $wpec_form_action;
// No global so figure it out
} else {
// Use external if set
if (wpsc_is_product_external()) {
$action = wpsc_product_external_link($product_id);
// Otherwise use this page
} else {
$action = wpsc_this_page_url();
}
}
// Return form action
return $action;
}
示例11: wpsc_this_page_url
<form onsubmit="submitform(this);return false;" action="<?php
echo wpsc_this_page_url();
?>
" method="post" name="product_<?php
echo wpsc_the_product_id();
?>
" id="product_extra_<?php
echo wpsc_the_product_id();
?>
">
<input type="hidden" value="<?php
echo wpsc_the_product_id();
?>
" name="prodid"/>
<input type="hidden" value="<?php
echo wpsc_the_product_id();
?>
" name="item"/>
</form>
</div>
</div>
</div>
<?php
echo wpsc_product_comments();
}
/** end the product loop here */
?>
<?php
if (function_exists('fancy_notifications')) {
示例12: get_the_terms
$product_tags = get_the_terms($post->ID, 'product_tag');
if ($product_tags) {
foreach ($product_tags as $product_tag) {
$categories .= str_replace(" ", "_", $product_tag->slug) . $NV_shortcode_id . ' ';
}
}
$categories = preg_replace("/&#?[a-z0-9]+;/i", "", $categories);
}
if (class_exists('WPSC_Query')) {
$wpsc_product_categories = get_the_product_category(wpsc_the_product_id());
if ($wpsc_product_categories) {
foreach ($wpsc_product_categories as $wpsc_product_category) {
$categories .= str_replace(" ", "_", $wpsc_product_category->slug) . $NV_shortcode_id . ' ';
}
}
$wpsc_product_tags = wp_get_product_tags(wpsc_the_product_id());
if ($wpsc_product_tags) {
foreach ($wpsc_product_tags as $wpsc_product_tag) {
$categories .= str_replace(" ", "_", $wpsc_product_tag->slug) . $NV_shortcode_id . ' ';
}
}
$categories = preg_replace("/&#?[a-z0-9]+;/i", "", $categories);
}
}
/* ------------------------------------
:: GET INDIVIDUAL SLIDE DATA
------------------------------------ */
if ($NV_datasource == 'data-5') {
if (class_exists('Woocommerce')) {
示例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
//.........这里部分代码省略.........
示例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);
?>
&w=457<?php
} else {
echo wpsc_the_product_image($image_width, $image_height);
}
?>
" />
</a>
</div>
<?php
} else {
?>
<div class="product-image product-thumb item_no_image">
<a href="<?php
echo wpsc_the_product_permalink();
?>
">
<span><?php
_e('No Image Available', 'flexishop');
?>
</span>
</a>
</div>
<?php
}
?>
<div class="product-content">
<h2 class="prodtitles">
<?php
if (get_option('hide_name_link') == 1) {
?>
<span><?php
echo wpsc_the_product_title();
?>
</span>
<?php
} else {
?>
<a class="wpsc_product_title" href="<?php
echo wpsc_the_product_permalink();
?>
"><?php
echo wpsc_the_product_title();
?>
</a>
<?php
}
?>
</h2>
<!-- <div class="wpsc_product_price">
<?php
if (wpsc_product_is_donation()) {
?>
<label for='donation_price_<?php
echo wpsc_the_product_id();
?>
'><?php
echo __('Donation', 'flexishop');
?>
//.........这里部分代码省略.........
示例15: wpsc_latest_product
function wpsc_latest_product($args = null, $instance)
{
global $wpdb;
$args = wp_parse_args((array) $args, array('number' => 5));
$siteurl = get_option('siteurl');
$options = get_option('wpsc-widget_latest_products');
$number = isset($instance['number']) ? (int) $instance['number'] : 5;
$image = isset($instance['image']) ? (bool) $instance['image'] : FALSE;
if (isset($instance['width'])) {
$width = $instance['width'];
}
if (isset($instance['height'])) {
$height = $instance['height'];
}
$latest_products = get_posts(array('post_type' => 'wpsc-product', 'numberposts' => $number, 'orderby' => 'post_date', 'post_parent' => 0, 'post_status' => 'publish', 'order' => 'DESC'));
$output = '';
if (count($latest_products) > 0) {
$output .= '<ul class="wpsc-latest-products">';
foreach ($latest_products as $latest_product) {
$output .= '<li class="wpsc-latest-product">';
// Thumbnails, if required
if ($image) {
$output .= '<div class="item_image">';
$output .= '<a href="' . wpsc_product_url($latest_product->ID, null) . '">';
$thumbnail = wpsc_the_product_thumbnail($width, $height, $latest_product->ID, '');
if ($thumbnail) {
$output .= '<img src="' . esc_url($thumbnail) . '" title="' . apply_filters('the_title', $latest_product->post_title) . '" alt="' . apply_filters('the_title', $latest_product->post_title) . '" />';
} else {
$output .= '<img class="no-image" id="product_image_' . wpsc_the_product_id() . '" alt="' . esc_attr__('No Image', 'wpsc') . '" title="' . wpsc_the_product_title() . '" src="' . WPSC_URL . '/wpsc-theme/wpsc-images/noimage.png" width="' . $width . '" height="' . $height . '" />';
}
$output .= '</a>';
$output .= '</div>';
}
// Link
$output .= '<a href="' . esc_url(wpsc_product_url($latest_product->ID, null)) . '" class="wpsc-product-title">' . apply_filters('the_title', $latest_product->post_title) . '</a>';
$output .= '</li>';
}
$output .= "</ul>";
}
echo $output;
}