本文整理汇总了PHP中wpsc_product_normal_price函数的典型用法代码示例。如果您正苦于以下问题:PHP wpsc_product_normal_price函数的具体用法?PHP wpsc_product_normal_price怎么用?PHP wpsc_product_normal_price使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpsc_product_normal_price函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: get_related_products
/**
* Related Products
*/
function get_related_products($product_id, $cats_search = true, $width, $height, $number = 20)
{
global $wpdb;
// Related products are found from category and tag
$tags_array = array(0);
$cats_array = array(0);
$tags = '';
$cats = '';
// Get tags
$terms = wp_get_post_terms($product_id, 'product_tag');
foreach ($terms as $term) {
$tags_array[] = $term->term_id;
}
$tags = implode(',', $tags_array);
$terms = wp_get_post_terms($product_id, 'wpsc_product_category');
foreach ($terms as $term) {
$cats_array[] = $term->term_id;
}
$cats = implode(',', $cats_array);
if ($cats_search) {
$cats_search = "\n\t\t\t\t(\n\t\t\t\t\ttt.taxonomy ='wpsc_product_category'\n\t\t\t\t\tAND tt.term_taxonomy_id = tr.term_taxonomy_id\n\t\t\t\t\tAND tr.object_id = p.ID\n\t\t\t\t\tAND tt.term_id IN ({$cats})\n\t\t\t\t)\n\t\t\t\tOR \n ";
} else {
$cats_search = '';
}
$q = "\n\t\tSELECT p.ID\n\t\tFROM {$wpdb->term_taxonomy} AS tt, {$wpdb->term_relationships} AS tr, {$wpdb->posts} AS p\n\t\tWHERE \n\t\t\tp.ID != {$product_id}\n\t\t\tAND p.post_status = 'publish'\n\t\t\tAND p.post_type = 'wpsc-product'\n\t\t\tAND\n\t\t\t(\n {$cats_search}\n\t\t\t\t(\n\t\t\t\t\ttt.taxonomy ='product_tag'\n\t\t\t\t\tAND tt.term_taxonomy_id = tr.term_taxonomy_id\n\t\t\t\t\tAND tr.object_id = p.ID\n\t\t\t\t\tAND tt.term_id IN ({$tags})\n\t\t\t\t)\n\t\t\t)\n\t\tGROUP BY tr.object_id\n\t\tORDER BY RAND()\n\t\tLIMIT {$number};";
$related = $wpdb->get_col($q);
if (sizeof($related) > 0) {
$args = array('post__in' => $related, 'post__not_in' => array($product_id), 'post_type' => 'wpsc-product', 'ignore_sticky_posts' => 1, 'posts_per_page' => $number, 'orderby' => 'rand');
$related_query = new WP_Query($args);
if ($related_query->have_posts()) {
$_i = 0;
while ($related_query->have_posts()) {
$related_query->the_post();
$_i++;
$id = get_the_ID();
$variants_exist = $wpdb->get_row("SELECT * FROM {$wpdb->posts} WHERE `post_parent`={$id} AND `post_type`='wpsc-product'", 'ARRAY_A');
$related_array[$_i]['id'] = get_the_ID();
$related_array[$_i]['title'] = esc_attr(get_the_title());
$related_array[$_i]['image'] = etheme_get_image(0, $width, $height, false, $id);
$related_array[$_i]['permalink'] = get_permalink();
if ($variants_exist) {
if (wpsc_product_on_special($id)) {
$related_array[$_i]['normal_price'] = wpsc_product_normal_price($id);
$related_array[$_i]['price'] = wpsc_the_product_price($id);
} else {
$related_array[$_i]['normal_price'] = 0;
$related_array[$_i]['price'] = wpsc_the_product_price($id);
}
} else {
$related_array[$_i]['normal_price'] = the_product_price($id);
$related_array[$_i]['price'] = the_product_price($id, true);
}
unset($variants_exist);
}
}
wp_reset_postdata();
}
return $related_array;
}
开发者ID:Nguyenkain,项目名称:hanghieusales,代码行数:62,代码来源:products.php
示例2: __
?>
' 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
}
?>
<span id="product_price_<?php
echo wpsc_the_product_id();
?>
" class="pricedisplay"><?php
echo wpsc_the_product_price();
?>
</span><?php
echo __('Price', 'wpsc');
?>
:<br/>
开发者ID:Jonathonbyrd,项目名称:wp-ecommerce,代码行数:31,代码来源:single_product.php
示例3: wpsc_the_product_price_display
function wpsc_the_product_price_display($args = array())
{
if (empty($args['id'])) {
$id = get_the_ID();
} else {
$id = (int) $args['id'];
}
$defaults = array('id' => $id, 'old_price_text' => __('Old Price: %s', 'wp-e-commerce'), 'price_text' => __('Price: %s', 'wp-e-commerce'), 'you_save_text' => __('You save: %s', 'wp-e-commerce'), 'old_price_class' => 'pricedisplay wpsc-product-old-price ' . $id, 'old_price_before' => '<p %s>', 'old_price_after' => '</p>', 'old_price_amount_id' => 'old_product_price_' . $id, 'old_price_amount_class' => 'oldprice', 'old_price_amount_before' => '<span class="%1$s" id="%2$s">', 'old_price_amount_after' => '</span>', 'price_amount_id' => 'product_price_' . $id, 'price_class' => 'pricedisplay wpsc-product-price ' . $id, 'price_before' => '<p %s>', 'price_after' => '</p>', 'price_amount_class' => 'currentprice pricedisplay ' . $id, 'price_amount_before' => '<span class="%1$s" id="%2$s">', 'price_amount_after' => '</span>', 'you_save_class' => 'pricedisplay wpsc-product-you-save product_' . $id, 'you_save_before' => '<p %s>', 'you_save_after' => '</p>', 'you_save_amount_id' => 'yousave_' . $id, 'you_save_amount_class' => 'yousave', 'you_save_amount_before' => '<span class="%1$s" id="%2$s">', 'you_save_amount_after' => '</span>', 'output_price' => true, 'output_old_price' => true, 'output_you_save' => true);
$r = wp_parse_args($args, $defaults);
/**
* wpsc_the_product_price_display_args filter args for product price display
*
* Paramters used to format price display can be set globally using this filter
*
* @since 4.0
*
* @type array $args array of parameters used to format product price
* @type int $product_id WPeC Product ID for the current product
*/
$r = apply_filters('wpsc_the_product_price_display_args', $r, $id);
extract($r);
// if the product has no variations, these amounts are straight forward...
$old_price = wpsc_product_normal_price($id);
$current_price = wpsc_the_product_price(false, false, $id);
$you_save = wpsc_you_save(array('type' => 'amount', 'product_id' => $id));
$show_old_price = $show_you_save = wpsc_product_on_special($id);
// Don't output old price HTML if not on sale.
if (!wpsc_product_on_special($id)) {
$output_old_price = $output_you_save = false;
}
// but if the product has variations and at least one of the variations is on special, we have
// a few edge cases...
if (wpsc_product_has_variations($id) && wpsc_product_on_special($id)) {
// generally it doesn't make sense to display "you save" amount unless the user has selected
// a specific variation
$show_you_save = false;
$old_price_number = wpsc_product_variation_price_from($id, array('only_normal_price' => true));
$current_price_number = wpsc_product_variation_price_from($id);
// if coincidentally, one of the variations are not on special, but its price is equal to
// or lower than the lowest variation sale price, old price should be hidden, and current
// price should reflect the "normal" price, not the sales price, to avoid confusion
if ($old_price_number == $current_price_number) {
$show_old_price = false;
$current_price = wpsc_product_normal_price($id);
}
}
// replace placeholders in arguments with correct values
$old_price_class = apply_filters('wpsc_the_product_price_display_old_price_class', $old_price_class, $id);
$old_price_amount_class = apply_filters('wpsc_the_product_price_display_old_price_amount_class', $old_price_amount_class, $id);
$attributes = 'class="' . esc_attr($old_price_class) . '"';
if (!$show_old_price) {
$attributes .= ' style="display:none;"';
}
$old_price_before = sprintf($old_price_before, $attributes);
$old_price_amount_before = sprintf($old_price_amount_before, esc_attr($old_price_amount_class), esc_attr($old_price_amount_id));
$price_class = 'class="' . esc_attr(apply_filters('wpsc_the_product_price_display_price_class', esc_attr($price_class), $id)) . '"';
$price_amount_class = apply_filters('wpsc_the_product_price_display_price_amount_class', esc_attr($price_amount_class), $id);
$price_before = sprintf($price_before, $price_class);
$price_amount_before = sprintf($price_amount_before, esc_attr($price_amount_class), esc_attr($price_amount_id));
$you_save_class = apply_filters('wpsc_the_product_price_display_you_save_class', $you_save_class, $id);
$you_save_amount_class = apply_filters('wpsc_the_product_price_display_you_save_amount_class', $you_save_amount_class, $id);
$attributes = 'class="' . esc_attr($you_save_class) . '"';
if (!$show_you_save) {
$attributes .= ' style="display:none;"';
}
$you_save_before = sprintf($you_save_before, $attributes);
$you_save_amount_before = sprintf($you_save_amount_before, esc_attr($you_save_amount_class), esc_attr($you_save_amount_id));
$you_save = wpsc_currency_display($you_save);
$old_price = $old_price_amount_before . $old_price . $old_price_amount_after;
$current_price = $price_amount_before . $current_price . $price_amount_after;
$you_save = $you_save_amount_before . $you_save . $you_save_amount_after;
$old_price_text = sprintf($old_price_text, $old_price);
$price_text = sprintf($price_text, $current_price);
$you_save_text = sprintf($you_save_text, $you_save);
if ($output_old_price) {
echo $old_price_before . $old_price_text . $old_price_after . "\n";
}
if ($output_price) {
echo $price_before . $price_text . $price_after . "\n";
}
if ($output_you_save) {
echo $you_save_before . $you_save_text . $you_save_after . "\n";
}
}
开发者ID:AngryBird3,项目名称:WP-e-Commerce,代码行数:84,代码来源:template-tags.php
示例4: wpsc_the_product_id
<input type="text" id='wpsc_quantity_update' name="wpsc_quantity_update[<?php echo wpsc_the_product_id(); ?>]" size="2" value="1"/>
<input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>"/>
<input type="hidden" name="wpsc_update_quantity" value="true"/>
</fieldset>
<?php endif ;?>
<div class="wpsc_product_price">
<?php if(wpsc_product_is_donation()) : ?>
<label for='donation_price_<?php echo wpsc_the_product_id(); ?>'><?php echo __('Donation', 'wpsc'); ?>:</label>
<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&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');
} ?>
开发者ID:nerdfiles,项目名称:sideshowtramps.com,代码行数:31,代码来源:single_product.php
示例5: vtprd_show_product_list_price
function vtprd_show_product_list_price($product_id = null)
{
global $post, $vtprd_info, $vtprd_setup_options;
//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;
}
if ($post->ID > ' ') {
$product_id = $post->ID;
}
if (!$product_id) {
return;
}
$amt = vtprd_get_product_list_price_amt($product_id);
//CUSTOM function created by CUSTOMER
if (function_exists('custom_show_product_list_price_amt')) {
custom_show_product_list_price_amt($product_id, $amt);
return;
}
if ($amt) {
?>
<p class="pricedisplay <?php
echo wpsc_the_product_id();
?>
"><?php
_e('Old Price', 'wpsc');
?>
: <span class="oldprice" id="old_product_price_<?php
echo wpsc_the_product_id();
?>
"><?php
echo $amt;
?>
</span></p>
<?php
} else {
//original code from wpsc-single_product.php
?>
<?php
if (wpsc_product_on_special()) {
?>
<p class="pricedisplay <?php
echo wpsc_the_product_id();
?>
"><?php
_e('Old Price', 'wpsc');
?>
: <span class="oldprice" id="old_product_price_<?php
echo wpsc_the_product_id();
?>
"><?php
echo wpsc_product_normal_price();
?>
</span></p>
<?php
}
?>
<?php
}
return;
}
开发者ID:Art2u,项目名称:pricing-deals-for-woocommerce,代码行数:64,代码来源:vtprd-parent-theme-functions.php
示例6: __
?>
' size='6' />
<br />
<?php
} else {
?>
<?php
if (wpsc_product_on_special()) {
?>
<span class='oldprice'><?php
echo __('Price', 'wpsc');
?>
: <?php
echo wpsc_product_normal_price(get_option('wpsc_hide_decimals'));
?>
</span><br />
<?php
}
?>
<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/>
开发者ID:Jonathonbyrd,项目名称:wp-ecommerce,代码行数:31,代码来源:products_page.php
示例7: wpsc_the_product_permalink
<link><![CDATA[<?php
echo wpsc_the_product_permalink();
?>
]]></link>
<description><![CDATA[<?php
echo wpsc_the_product_description();
?>
]]></description>
<pubDate><![CDATA[<?php
echo wpsc_product_creation_time('D, d M Y H:i:s +0000');
?>
]]></pubDate>
<guid><![CDATA[<?php
echo wpsc_the_product_permalink();
?>
]]></guid>
<g:price><![CDATA[<?php
echo wpsc_product_normal_price(true);
?>
]]></g:price>
<g:image_link><![CDATA[<?php
echo wpsc_the_product_thumbnail();
?>
]]></g:image_link>
</item>
<?php
}
?>
</channel>
</rss>
开发者ID:osuarcher,项目名称:WP-e-Commerce,代码行数:30,代码来源:rss.php
示例8: foreach
if ($term_list) {
$html_term = '';
foreach ($term_list as $term) {
$html_term .= '<a href="#">' . $term->name . '</a>, ';
//is the name of the price
}
}
$html_content .= $html_term;
}
$html_content .= '</div>';
} elseif ($item_key == 'WPeC_old_price') {
$html_content .= '<div class="element element_' . $item_id . ' ' . $item_key . '" >';
$is_product = get_post_type(get_the_ID());
$active_plugins = get_option('active_plugins');
if (in_array('wp-e-commerce/wp-shopping-cart.php', (array) $active_plugins) && $is_product == 'wpsc-product') {
$html_content .= wpsc_product_normal_price();
}
$html_content .= '</div>';
} elseif ($item_key == 'WPeC_sale_price') {
$html_content .= '<div class="element element_' . $item_id . ' ' . $item_key . '" >';
$is_product = get_post_type(get_the_ID());
$active_plugins = get_option('active_plugins');
if (in_array('wp-e-commerce/wp-shopping-cart.php', (array) $active_plugins) && $is_product == 'wpsc-product') {
$html_content .= wpsc_the_product_price();
}
$html_content .= '</div>';
} elseif ($item_key == 'WPeC_rating_star') {
$html_content .= '<div class="element element_' . $item_id . ' ' . $item_key . '" >';
$is_product = get_post_type(get_the_ID());
$active_plugins = get_option('active_plugins');
if (in_array('wp-e-commerce/wp-shopping-cart.php', (array) $active_plugins) && $is_product == 'wpsc-product') {
开发者ID:brettratner,项目名称:TCNJ-IMM-Showcase-2016,代码行数:31,代码来源:layer-content.php
示例9: getSliderProducts
//.........这里部分代码省略.........
</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');
?>
:</label>
<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', 'flexishop');
?>
: <?php
echo wpsc_product_normal_price(get_option('wpsc_hide_decimals'));
?>
</span><br />
<?php
}
?>
<span id="product_price_<?php
echo wpsc_the_product_id();
?>
" class="pricedisplay <?php
if (wpsc_product_on_special()) {
echo "sale-price";
}
?>
"><?php
if (wpsc_product_on_special()) {
echo __("Sale Price: ", 'flexishop');
}
echo wpsc_the_product_price(get_option('wpsc_hide_decimals'));
?>
</span>
<?php
}
?>
</div> -->
<?php
if (wpsc_the_product_additional_description()) {
?>
<div class="description">
<?php
$value = '';
$the_addl_desc = wpsc_the_product_additional_description();
if (is_serialized($the_addl_desc)) {
$addl_descriptions = @unserialize($the_addl_desc);
} else {
$addl_descriptions = array('addl_desc', $the_addl_desc);
}
if (isset($addl_descriptions['addl_desc'])) {
$value = $addl_descriptions['addl_desc'];
}
if (function_exists('wpsc_addl_desc_show')) {
echo wpsc_addl_desc_show($addl_descriptions);
} else {
echo stripslashes(wpautop($the_addl_desc, $br = 1));
}
?>
</div>
<?php
}
?>
<a href="<?php
echo wpsc_the_product_permalink();
?>
" class="buy-now"><?php
_e('Buy Now', 'flexishop');
?>
</a>
</div>
</li>
<?php
}
}
}
开发者ID:BGCX261,项目名称:zombie-craft-svn-to-git,代码行数:101,代码来源:functions.php
注:本文中的wpsc_product_normal_price函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论