• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wpsc_product_on_special函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wpsc_product_on_special函数的典型用法代码示例。如果您正苦于以下问题:PHP wpsc_product_on_special函数的具体用法?PHP wpsc_product_on_special怎么用?PHP wpsc_product_on_special使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wpsc_product_on_special函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: wpsc_the_product_id

:</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 
        }
        ?>
								  <span id="product_price_<?php 
        echo wpsc_the_product_id();
        ?>
" class="pricedisplay"><?php 
开发者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&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');
开发者ID:nerdfiles,项目名称:sideshowtramps.com,代码行数:30,代码来源:single_product.php


示例5: 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;
}
开发者ID:Art2u,项目名称:pricing-deals-for-woocommerce,代码行数:66,代码来源:vtprd-parent-theme-functions.php


示例6: getSliderProducts


//.........这里部分代码省略.........
                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');
                ?>
:</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()) {
开发者ID:BGCX261,项目名称:zombie-craft-svn-to-git,代码行数:67,代码来源:functions.php



注:本文中的wpsc_product_on_special函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wpsc_product_postage_and_packaging函数代码示例发布时间:2022-05-23
下一篇:
PHP wpsc_product_normal_price函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap