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

PHP wpsc_cart_item_count函数代码示例

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

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



在下文中一共展示了wpsc_cart_item_count函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: submenu_items

 /**
  * Add Menu Cart to menu
  * 
  * @return menu items including cart
  */
 public function submenu_items()
 {
     global $wpsc_cart, $options;
     $get_cart = wpsc_cart_item_count();
     $submenu_items = '';
     //see jigoshop/widgets/cart.php
     if (count($get_cart) > 0) {
         //foreach ( $get_cart as $cart_item_key => $values ) {
         while (wpsc_have_cart_items()) {
             wpsc_the_cart_item();
             //$_product = $values['data'];
             if (wpsc_cart_item_count() > 0) {
                 global $wpsc_cart, $options;
                 $item_thumbnail = '<img src=' . wpsc_cart_item_image() . '>';
                 $item_name = wpsc_cart_item_name();
                 $item_quantity = wpsc_cart_item_quantity();
                 $item_price = wpsc_cart_item_price();
                 // Item permalink
                 $item_permalink = wpsc_cart_item_url();
                 $submenu_items[] = array('item_thumbnail' => $item_thumbnail, 'item_name' => $item_name, 'item_quantity' => $item_quantity, 'item_price' => $item_price, 'item_permalink' => $item_permalink);
             }
             //}
         }
     } else {
         $submenu_items = '';
     }
     return $submenu_items;
 }
开发者ID:Atlas-Solutions-Group,项目名称:wp-menu-cart-pro,代码行数:33,代码来源:wpmenucart-wpec-pro.php


示例2: widget_wp_shopping_cart

function widget_wp_shopping_cart($args)
{
    global $wpsc_theme_path, $cache_enabled;
    extract($args);
    $options = get_option('widget_wp_shopping_cart');
    if (get_option('show_sliding_cart') == 1) {
        if (is_numeric($_SESSION['slider_state'])) {
            if ($_SESSION['slider_state'] == 0) {
                $collapser_image = 'plus.png';
            } else {
                $collapser_image = 'minus.png';
            }
            $fancy_collapser = "<a href='#' onclick='return shopping_cart_collapser()' id='fancy_collapser_link'><img src='" . WPSC_URL . "/images/{$collapser_image}' title='' alt='' id='fancy_collapser' /></a>";
        } else {
            if ($_SESSION['nzshpcrt_cart'] == null) {
                $collapser_image = 'plus.png';
            } else {
                $collapser_image = 'minus.png';
            }
            $fancy_collapser = "<a href='#' onclick='return shopping_cart_collapser()' id='fancy_collapser_link'><img src='" . WPSC_URL . "/images/{$collapser_image}' title='' alt='' id='fancy_collapser' /></a>";
        }
    } else {
        $fancy_collapser = "";
    }
    $title = empty($options['title']) ? __('Shopping Cart') : $options['title'];
    echo $before_widget;
    $full_title = $before_title . $title . $fancy_collapser . $after_title;
    echo $full_title;
    $display_state = "";
    if (($_SESSION['slider_state'] == 0 || wpsc_cart_item_count() < 1) && get_option('show_sliding_cart') == 1) {
        $display_state = "style='display: none;'";
    }
    $use_object_frame = false;
    if ($cache_enabled == true && (!defined('DONOTCACHEPAGE') || constant('DONOTCACHEPAGE') !== true)) {
        echo "    <div id='sliding_cart' class='shopping-cart-wrapper'>";
        if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE") == false && $use_object_frame == true) {
            ?>
				<object codetype="text/html" type="text/html" data="index.php?wpsc_action=cart_html_page"  border='0px'>
					<p><?php 
            _e('Loading...', 'wpsc');
            ?>
</p>
				</object>
				<?php 
        } else {
            ?>
			<div class='wpsc_cart_loading'><p><?php 
            _e('Loading...', 'wpsc');
            ?>
</p>
			<?php 
        }
        echo "    </div>";
    } else {
        echo "    <div id='sliding_cart' class='shopping-cart-wrapper' {$display_state}>";
        include wpsc_get_theme_file_path("cart_widget.php");
        echo "    </div>";
    }
    echo $after_widget;
}
开发者ID:alx,项目名称:SimplePress,代码行数:60,代码来源:shopping_cart_widget.php


示例3: wpsc_shopping_basket_internals

function wpsc_shopping_basket_internals($deprecated = false, $quantity_limit = false, $no_title = false)
{
    global $wpdb;
    $display_state = '';
    if ((isset($_SESSION['slider_state']) && $_SESSION['slider_state'] == 0 || wpsc_cart_item_count() < 1) && get_option('show_sliding_cart') == 1) {
        $display_state = "style='display: none;'";
    }
    echo "    <div id='sliding_cart' class='shopping-cart-wrapper' {$display_state}>";
    include_once wpsc_get_template_file_path('wpsc-cart_widget.php');
    echo '    </div>';
}
开发者ID:ashik968,项目名称:digiplot,代码行数:11,代码来源:shopping_cart_functions.php


示例4: wpsc_shopping_basket_internals

function wpsc_shopping_basket_internals($cart, $quantity_limit = false, $no_title = false)
{
    global $wpdb, $wpsc_theme_path;
    $display_state = "";
    if (($_SESSION['slider_state'] == 0 || wpsc_cart_item_count() < 1) && get_option('show_sliding_cart') == 1) {
        $display_state = "style='display: none;'";
    }
    echo "    <div id='sliding_cart' class='shopping-cart-wrapper' {$display_state}>";
    $cur_wpsc_theme_folder = apply_filters('wpsc_theme_folder', $wpsc_theme_path . WPSC_THEME_DIR);
    include_once $cur_wpsc_theme_folder . "/cart_widget.php";
    echo "    </div>";
    return $output;
}
开发者ID:papayalabs,项目名称:htdocs,代码行数:13,代码来源:shopping_cart_functions.php


示例5: widget_wp_shopping_cart

function widget_wp_shopping_cart($args)
{
    global $wpsc_theme_path;
    extract($args);
    $options = get_option('widget_wp_shopping_cart');
    if (get_option('show_sliding_cart') == 1) {
        if (is_numeric($_SESSION['slider_state'])) {
            if ($_SESSION['slider_state'] == 0) {
                $collapser_image = 'plus.png';
            } else {
                $collapser_image = 'minus.png';
            }
            $fancy_collapser = "<a href='#' onclick='return shopping_cart_collapser()' id='fancy_collapser_link'><img src='" . WPSC_URL . "/images/{$collapser_image}' title='' alt='' id='fancy_collapser' /></a>";
        } else {
            if ($_SESSION['nzshpcrt_cart'] == null) {
                $collapser_image = 'plus.png';
            } else {
                $collapser_image = 'minus.png';
            }
            $fancy_collapser = "<a href='#' onclick='return shopping_cart_collapser()' id='fancy_collapser_link'><img src='" . WPSC_URL . "/images/{$collapser_image}' title='' alt='' id='fancy_collapser' /></a>";
        }
    } else {
        $fancy_collapser = "";
    }
    $title = empty($options['title']) ? __('Shopping Cart') : $options['title'];
    echo $before_widget;
    $full_title = $before_title . $title . $fancy_collapser . $after_title;
    echo $full_title;
    $display_state = "";
    if (($_SESSION['slider_state'] == 0 || wpsc_cart_item_count() < 1) && get_option('show_sliding_cart') == 1) {
        $display_state = "style='display: none;'";
    }
    echo "    <div id='sliding_cart' class='shopping-cart-wrapper' {$display_state}>";
    $cur_wpsc_theme_folder = apply_filters('wpsc_theme_folder', $wpsc_theme_path . WPSC_THEME_DIR);
    include $cur_wpsc_theme_folder . "/cart_widget.php";
    echo "    </div>";
    echo $after_widget;
}
开发者ID:papayalabs,项目名称:htdocs,代码行数:38,代码来源:shopping_cart_widget.php


示例6: wpsc_cart_has_items

function wpsc_cart_has_items()
{
    return wpsc_cart_item_count() >= 1;
}
开发者ID:osuarcher,项目名称:WP-e-Commerce,代码行数:4,代码来源:conditional-tags.php


示例7: wpsc_get_cart

function wpsc_get_cart()
{
    global $wpdb, $wpsc_cart;
    ob_start();
    include_once wpsc_get_template_file_path('wpsc-cart_widget.php');
    $output = ob_get_contents();
    ob_end_clean();
    $output = str_replace(array("\n", "\r"), array("\\n", "\\r"), addslashes($output));
    echo "jQuery('div.shopping-cart-wrapper').html('{$output}');\n";
    if (get_option('show_sliding_cart') == 1) {
        if (wpsc_cart_item_count() > 0 || count($cart_messages) > 0) {
            $_SESSION['slider_state'] = 1;
            echo "\n            jQuery('#sliding_cart').slideDown('fast',function(){\n               jQuery('#fancy_collapser').attr('src', (WPSC_CORE_IMAGES_URL+'/minus.png'));\n            });\n      ";
        } else {
            $_SESSION['slider_state'] = 0;
            echo "\n            jQuery('#sliding_cart').slideUp('fast',function(){\n               jQuery('#fancy_collapser').attr('src', (WPSC_CORE_IMAGES_URL+'/plus.png'));\n            });\n      ";
        }
    }
    do_action('wpsc_alternate_cart_html', '');
    exit;
}
开发者ID:hornet9,项目名称:Morato,代码行数:21,代码来源:ajax.functions.php


示例8: wpsc_add_to_cart

/**
	* add_to_cart function, used through ajax and in normal page loading.
	* No parameters, returns nothing
*/
function wpsc_add_to_cart()
{
    global $wpdb, $wpsc_cart, $wpsc_theme_path;
    /// default values
    $default_parameters['variation_values'] = null;
    $default_parameters['quantity'] = 1;
    $default_parameters['provided_price'] = null;
    $default_parameters['comment'] = null;
    $default_parameters['time_requested'] = null;
    $default_parameters['custom_message'] = null;
    $default_parameters['file_data'] = null;
    $default_parameters['is_customisable'] = false;
    $default_parameters['meta'] = null;
    /// sanitise submitted values
    $product_id = (int) $_POST['product_id'];
    foreach ((array) $_POST['variation'] as $key => $variation) {
        $provided_parameters['variation_values'][(int) $key] = (int) $variation;
    }
    if ($_POST['quantity'] > 0 && !isset($_POST['wpsc_quantity_update'])) {
        $provided_parameters['quantity'] = (int) $_POST['quantity'];
    } else {
        if (isset($_POST['wpsc_quantity_update'])) {
            $wpsc_cart->remove_item($_POST['key']);
            $provided_parameters['quantity'] = (int) $_POST['wpsc_quantity_update'];
        }
    }
    //  exit('<pre>'.print_r($_POST, true).'</pre>');
    if ($_POST['is_customisable'] == 'true') {
        $provided_parameters['is_customisable'] = true;
        if (isset($_POST['custom_text'])) {
            $provided_parameters['custom_message'] = $_POST['custom_text'];
        }
        if (isset($_FILES['custom_file'])) {
            $provided_parameters['file_data'] = $_FILES['custom_file'];
        }
    }
    if ((double) $_POST['donation_price'] > 0) {
        $provided_parameters['provided_price'] = (double) $_POST['donation_price'];
    }
    $parameters = array_merge($default_parameters, (array) $provided_parameters);
    //echo "/*\n\r".print_r($parameters,true)."*/\n\r";
    $state = $wpsc_cart->set_item($product_id, $parameters);
    $product = $wpdb->get_row("SELECT * FROM `" . WPSC_TABLE_PRODUCT_LIST . "` WHERE `id`='" . $product_id . "' LIMIT 1", ARRAY_A);
    if ($state == true) {
        $cart_messages[] = str_replace("[product_name]", stripslashes($product['name']), TXT_WPSC_YOU_JUST_ADDED);
    } else {
        if ($parameters['quantity'] <= 0) {
            $cart_messages[] = TXT_WPSC_ZERO_QUANTITY_REQUESTED;
        } else {
            if ($wpsc_cart->get_remaining_quantity($product_id, $parameters['variation_values'], $parameters['quantity']) > 0) {
                $cart_messages[] = str_replace("[number]", $wpsc_cart->get_remaining_quantity($product_id, $parameters['variation_values'], $parameters['quantity']), TXT_WPSC_INSUFFICIENT_REMAINING);
            } else {
                $cart_messages[] = str_replace("[product_name]", $product['name'], TXT_WPSC_SORRY_NONE_LEFT);
            }
        }
    }
    if ($_GET['ajax'] == 'true') {
        if ($product_id != null && get_option('fancy_notifications') == 1) {
            echo "if(jQuery('#fancy_notification_content')) {\n\r";
            echo "  jQuery('#fancy_notification_content').html(\"" . str_replace(array("\n", "\r"), array('\\n', '\\r'), addslashes(fancy_notification_content($cart_messages))) . "\");\n\r";
            echo "  jQuery('#loading_animation').css('display', 'none');\n\r";
            echo "  jQuery('#fancy_notification_content').css('display', 'block');\n\r";
            echo "}\n\r";
            $error_messages = array();
        }
        ob_start();
        $cur_wpsc_theme_folder = apply_filters('wpsc_theme_folder', $wpsc_theme_path . WPSC_THEME_DIR);
        include_once $cur_wpsc_theme_folder . "/cart_widget.php";
        $output = ob_get_contents();
        ob_end_clean();
        //exit("/*<pre>".print_r($wpsc_cart,true)."</pre>*/");
        $output = str_replace(array("\n", "\r"), array("\\n", "\\r"), addslashes($output));
        //echo '<pre>'.print_r($parameters,true).'</pre>';
        echo "jQuery('div.shopping-cart-wrapper').html('{$output}');\n";
        //  echo "jQuery('#wpsc_quantity_update').val('".$provided_parameters['quantity']."');\n";
        if (get_option('show_sliding_cart') == 1) {
            if (wpsc_cart_item_count() > 0 || count($cart_messages) > 0) {
                $_SESSION['slider_state'] = 1;
                echo "\n\t\t\t\t\tjQuery('#sliding_cart').slideDown('fast',function(){\n\t\t\t\t\t\tjQuery('#fancy_collapser').attr('src', (WPSC_URL+'/images/minus.png'));\n\t\t\t\t\t});\n\t\t\t";
            } else {
                $_SESSION['slider_state'] = 0;
                echo "\n\t\t\t\t\tjQuery('#sliding_cart').slideUp('fast',function(){\n\t\t\t\t\t\tjQuery('#fancy_collapser').attr('src', (WPSC_URL+'/images/plus.png'));\n\t\t\t\t\t});\n\t\t\t";
            }
        }
        do_action('wpsc_alternate_cart_html', $cart_messages);
        exit;
    }
}
开发者ID:papayalabs,项目名称:htdocs,代码行数:92,代码来源:ajax.functions.php


示例9: widget

    /**
     * Widget Output
     *
     * @param $args (array)
     * @param $instance (array) Widget values.
     *
     */
    function widget($args, $instance)
    {
        extract($args);
        // Create fancy collapser
        $fancy_collapser = '';
        if ($instance['show_sliding_cart'] == 1) {
            if (isset($_SESSION['slider_state']) && is_numeric($_SESSION['slider_state'])) {
                if ($_SESSION['slider_state'] == 0) {
                    $collapser_image = 'plus.png';
                } else {
                    $collapser_image = 'minus.png';
                }
                $fancy_collapser = ' <a href="#" onclick="return shopping_cart_collapser()" id="fancy_collapser_link"><img src="' . WPSC_CORE_IMAGES_URL . '/' . $collapser_image . '" title="" alt="" id="fancy_collapser" /></a>';
            } else {
                if (!wpsc_get_customer_meta('nzshpcart')) {
                    $collapser_image = 'plus.png';
                } else {
                    $collapser_image = 'minus.png';
                }
                $fancy_collapser = ' <a href="#" onclick="return shopping_cart_collapser()" id="fancy_collapser_link"><img src="' . WPSC_CORE_IMAGES_URL . '/' . $collapser_image . '" title="" alt="" id="fancy_collapser" /></a>';
            }
        }
        // Start widget output
        $title = apply_filters('widget_title', empty($instance['title']) ? __('Shopping Cart', 'wpsc') : $instance['title']);
        echo $before_widget;
        if ($title) {
            echo $before_title . $title . $fancy_collapser . $after_title;
        }
        // Set display state
        $display_state = '';
        if ((isset($_SESSION['slider_state']) && $_SESSION['slider_state'] == 0 || wpsc_cart_item_count() < 1) && get_option('show_sliding_cart') == 1) {
            $display_state = 'style="display: none;"';
        }
        // Output start, if we are not allowed to save results ( WPSC_DONT_CACHE ) load the cart using ajax
        $use_object_frame = false;
        if (WPSC_PAGE_CACHE_IN_USE) {
            echo '<div id="sliding_cart" class="shopping-cart-wrapper">';
            if (strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE') == false && $use_object_frame == true) {
                ?>
				<object codetype="text/html" type="text/html" data="index.php?wpsc_action=cart_html_page" border="0">
					<p><?php 
                _e('Loading...', 'wpsc');
                ?>
</p>
				</object>
				<?php 
            } else {
                ?>
				<div class="wpsc_cart_loading"><p><?php 
                _e('Loading...', 'wpsc');
                ?>
</p></div>
				<?php 
            }
            echo '</div>';
        } else {
            echo '<div id="sliding_cart" class="shopping-cart-wrapper" ' . $display_state . '>';
            include wpsc_get_template_file_path('wpsc-cart_widget.php');
            echo '</div>';
        }
        // End widget output
        echo $after_widget;
    }
开发者ID:dreamteam111,项目名称:dreamteam,代码行数:70,代码来源:shopping_cart_widget.php


示例10: checkout_ids

        public function checkout_ids()
        {
            if (wpsc_cart_item_count() > 0) {
                global $wpsc_cart;
                $line_items = array();
                while (wpsc_have_cart_items()) {
                    wpsc_the_cart_item();
                    $current_item = $wpsc_cart->cart_item;
                    $parent = $this->get_parent_post($current_item->product_id);
                    if ($parent) {
                        $product_id = $parent->ID;
                        $product_name = $parent->post_title;
                    } else {
                        $product_id = wpsc_cart_item_product_id();
                        $product_name = wpsc_cart_item_name();
                    }
                    $line_item = (int) $product_id;
                    $line_items[] = $line_item;
                }
                echo '<script type="text/javascript">
			        var _ra = _ra || {};
			 	    _ra.checkoutIdsInfo =' . json_encode($line_items, JSON_PRETTY_PRINT) . '
			        if (_ra.ready !== undefined) {
				        _ra.checkoutIds(_ra.checkoutIdsInfo);
				  }
			</script>';
            }
        }
开发者ID:retargeting,项目名称:WP-eCommerce,代码行数:28,代码来源:wpec-retargeting.php


示例11: wpsc_get_cart

function wpsc_get_cart()
{
    global $wpdb, $wpsc_cart, $wpsc_theme_path;
    ob_start();
    $cur_wpsc_theme_folder = apply_filters('wpsc_theme_folder', $wpsc_theme_path . WPSC_THEME_DIR);
    include_once $cur_wpsc_theme_folder . "/cart_widget.php";
    $output = ob_get_contents();
    ob_end_clean();
    $output = str_replace(array("\n", "\r"), array("\\n", "\\r"), addslashes($output));
    echo "jQuery('div.shopping-cart-wrapper').html('{$output}');\n";
    if (get_option('show_sliding_cart') == 1) {
        if (wpsc_cart_item_count() > 0 || count($cart_messages) > 0) {
            $_SESSION['slider_state'] = 1;
            echo "\n\t\t\t\tjQuery('#sliding_cart').slideDown('fast',function(){\n\t\t\t\t\tjQuery('#fancy_collapser').attr('src', (WPSC_URL+'/images/minus.png'));\n\t\t\t\t});\n\t\t";
        } else {
            $_SESSION['slider_state'] = 0;
            echo "\n\t\t\t\tjQuery('#sliding_cart').slideUp('fast',function(){\n\t\t\t\t\tjQuery('#fancy_collapser').attr('src', (WPSC_URL+'/images/plus.png'));\n\t\t\t\t});\n\t\t";
        }
    }
    do_action('wpsc_alternate_cart_html', '');
    exit;
}
开发者ID:alx,项目名称:SBek-Arak,代码行数:22,代码来源:ajax.functions.php


示例12: wpsc_checkout

<?php

global $wpsc_cart, $wpdb, $wpsc_checkout, $wpsc_gateway, $wpsc_coupons, $wpsc_registration_error_messages;
$wpsc_checkout = new wpsc_checkout();
$alt = 0;
$coupon_num = wpsc_get_customer_meta('coupon');
if ($coupon_num) {
    $wpsc_coupons = new wpsc_coupons($coupon_num);
}
if (wpsc_cart_item_count() < 1) {
    echo __('Oops, there is nothing in your cart.', 'wp-e-commerce') . '<a href=' . esc_url(get_option('product_list_url', '')) . ">" . __('Please visit our shop', 'wp-e-commerce') . '</a>';
    return;
}
?>
<div id="checkout_page_container">
<h3><?php 
_e('Please review your order', 'wp-e-commerce');
?>
</h3>
<table class="checkout_cart">
   <tr class="header">
      <th colspan="2" ><?php 
_e('Product', 'wp-e-commerce');
?>
</th>
      <th><?php 
_e('Quantity', 'wp-e-commerce');
?>
</th>
      <th><?php 
_e('Price', 'wp-e-commerce');
开发者ID:benhuson,项目名称:WP-e-Commerce,代码行数:31,代码来源:wpsc-shopping_cart_page.php


示例13: jbst_wpec_cart_update

 function jbst_wpec_cart_update()
 {
     $cart_count = wpsc_cart_item_count();
     $total = wpsc_cart_item_count() . ' item(s) - ' . wpsc_cart_total_widget();
     echo 'jQuery(".cart-contents").html("' . $total . '");';
 }
开发者ID:jwlayug,项目名称:jbst,代码行数:6,代码来源:template-ecommerce.php


示例14: compare_logic


//.........这里部分代码省略.........
                     //Checks if the product name contains the condition value
                     preg_match("/(.*)" . $c['value'] . "(.*)/", $product_obj->quantity, $match);
                     if (!empty($match)) {
                         return true;
                     }
                     break;
                 case 'not_contain':
                     //Checks if the product name contains the condition value
                     preg_match("/(.*)" . $c['value'] . "(.*)/", $product_obj->quantity, $match);
                     if (empty($match)) {
                         return true;
                     }
                     break;
                 case 'begins':
                     //Checks if the product name begins with condition value
                     preg_match("/^" . $c['value'] . "/", $product_obj->quantity, $match);
                     if (!empty($match)) {
                         return true;
                     }
                     break;
                 case 'ends':
                     //Checks if the product name ends with condition value
                     preg_match("/" . $c['value'] . "\$/", $product_obj->quantity, $match);
                     if (!empty($match)) {
                         return true;
                     }
                     break;
                 case 'category':
                     //Checks if the product to see if its in the category
                     preg_match("/" . $c['value'] . "\$/", $product_obj->quantity, $match);
                     if (!empty($match)) {
                         return true;
                     }
                     break;
                 default:
                     return false;
             }
         } else {
             if ($c['property'] == 'total_quantity') {
                 $total_quantity = wpsc_cart_item_count();
                 //exit('Quantity :'.$total_quantity);
                 switch ($c['logic']) {
                     case 'equal':
                         //Checks if the quantity of products in the cart equals condition value
                         if ($total_quantity == $c['value']) {
                             return true;
                         }
                         break;
                     case 'greater':
                         //Checks if the quantity in the cart is greater than the condition value
                         if ($total_quantity > $c['value']) {
                             return true;
                         }
                         break;
                     case 'less':
                         //Checks if the quantity in the cart is less than the condition value
                         if ($total_quantity < $c['value']) {
                             return true;
                         }
                         break;
                     default:
                         return false;
                 }
             } else {
                 if ($c['property'] == 'subtotal_amount') {
                     $subtotal = wpsc_cart_total(false);
                     //exit('<pre>'.print_r($subtotal,true).'</pre>');
                     switch ($c['logic']) {
                         case 'equal':
                             //Checks if the subtotal of products in the cart equals condition value
                             if ($subtotal == $c['value']) {
                                 return true;
                             }
                             break;
                         case 'greater':
                             //Checks if the subtotal of the cart is greater than the condition value
                             //	exit('triggered here'.$subtotal.'>'.$c['value']);
                             if ($subtotal > $c['value']) {
                                 return true;
                             }
                             break;
                         case 'less':
                             //Checks if the subtotal of the cart is less than the condition value
                             if ($subtotal < $c['value']) {
                                 //exit('<pre>'.print_r($product_obj->cart->subtotal, true).'</pre>cValue'.$c['value']);
                                 return true;
                             } else {
                                 return false;
                             }
                             break;
                         default:
                             return false;
                     }
                 } else {
                     return apply_filters('wpsc_coupon_compare_logic', false, $c, $product_obj);
                 }
             }
         }
     }
 }
开发者ID:Jonathonbyrd,项目名称:wp-ecommerce,代码行数:101,代码来源:coupons.class.php


示例15: compare_logic


//.........这里部分代码省略.........
                     if ($product_obj->quantity > $c['value']) {
                         return true;
                     }
                     break;
                 case 'less':
                     //Checks if the quantity of a product is less than the condition value
                     if ($product_obj->quantity < $c['value']) {
                         return true;
                     }
                     break;
                 case 'contains':
                     //Checks if the product name contains the condition value
                     preg_match("/(.*)" . $c['value'] . "(.*)/", $product_obj->quantity, $match);
                     if (!empty($match)) {
                         return true;
                     }
                     break;
                 case 'not_contain':
                     //Checks if the product name contains the condition value
                     preg_match("/(.*)" . $c['value'] . "(.*)/", $product_obj->quantity, $match);
                     if (empty($match)) {
                         return true;
                     }
                     break;
                 case 'begins':
                     //Checks if the product name begins with condition value
                     preg_match("/^" . $c['value'] . "/", $product_obj->quantity, $match);
                     if (!empty($match)) {
                         return true;
                     }
                     break;
                 case 'ends':
                     //Checks if the product name ends with condition value
                     preg_match("/" . $c['value'] . "\$/", $product_obj->quantity, $match);
                     if (!empty($match)) {
                         return true;
                     }
                     break;
                 default:
                     return false;
             }
         } else {
             if ($c['property'] == 'total_quantity') {
                 $total_quantity = wpsc_cart_item_count();
                 switch ($c['logic']) {
                     case 'equal':
                         //Checks if the quantity of products in the cart equals condition value
                         if ($total_quantity == $c['value']) {
                             return true;
                         }
                         break;
                     case 'greater':
                         //Checks if the quantity in the cart is greater than the condition value
                         if ($total_quantity > $c['value']) {
                             return true;
                         }
                         break;
                     case 'less':
                         //Checks if the quantity in the cart is less than the condition value
                         if ($total_quantity < $c['value']) {
                             return true;
                         }
                         break;
                     default:
                         return false;
                 }
             } else {
                 if ($c['property'] == 'subtotal_amount') {
                     $subtotal = wpsc_cart_total(false);
                     switch ($c['logic']) {
                         case 'equal':
                             //Checks if the subtotal of products in the cart equals condition value
                             if ($subtotal == $c['value']) {
                                 return true;
                             }
                             break;
                         case 'greater':
                             //Checks if the subtotal of the cart is greater than the condition value
                             if ($subtotal > $c['value']) {
                                 return true;
                             }
                             break;
                         case 'less':
                             //Checks if the subtotal of the cart is less than the condition value
                             if ($subtotal < $c['value']) {
                                 return true;
                             } else {
                                 return false;
                             }
                             break;
                         default:
                             return false;
                     }
                 } else {
                     return apply_filters('wpsc_coupon_compare_logic', false, $c, $product_obj);
                 }
             }
         }
     }
 }
开发者ID:nikitanaumov,项目名称:WP-e-Commerce,代码行数:101,代码来源:coupons.class.php


示例16: menu_item

 public function menu_item()
 {
     global $wpsc_cart, $options;
     $menu_item = array('cart_url' => esc_url(get_option('shopping_cart_url')), 'shop_page_url' => esc_url(get_option('product_list_url')), 'cart_contents_count' => wpsc_cart_item_count(), 'cart_total' => wpsc_cart_total_widget(false, false, false));
     return $menu_item;
 }
开发者ID:raminabsari,项目名称:phonicsschool,代码行数:6,代码来源:wpmenucart-wpec.php


示例17: printf

        ?>
" />
					<input type="hidden" name="wpsc_update_quantity" value="true" />
					<input type='hidden' name='wpsc_ajax_action' value='wpsc_update_quantity' />
					<input class="remove_button" type="submit" />
				</form></td>
			</tr>
		<?php 
    }
    ?>
		</tbody>
		<tfoot>
			<tr class="cart-widget-total">
				<td class="cart-widget-count">
					<?php 
    printf(_n('%d item', '%d items', wpsc_cart_item_count(), 'wp-e-commerce'), wpsc_cart_item_count());
    ?>
				</td>
				<td class="pricedisplay checkout-total" colspan='4'>
					<?php 
    _e('Subtotal:', 'wp-e-commerce');
    ?>
 <?php 
    echo wpsc_cart_total_widget(false, false, false);
    ?>
<br />
					<small><?php 
    _e('excluding discount, shipping and tax', 'wp-e-commerce');
    ?>
</small>
				</td>
开发者ID:ashik968,项目名称:digiplot,代码行数:31,代码来源:wpsc-cart_widget.php


示例18: calculate_discount

 function calculate_discount()
 {
     global $wpdb, $wpsc_cart;
     $wpsc_cart->clear_cache();
     //Calculates the discount for the whole cart if there is no condition on this coupon.
     if ($this->conditions == '' || count($this->conditions) == 0) {
         // $this->is_percentage == '2' means "Free Shipping"
         if ($this->is_percentage == '2') {
             return $wpsc_cart->calculate_total_shipping();
         }
         // $this->is_percentage == '1' means "%" discount
         if ($this->is_percentage == '1') {
             $total_price = $wpsc_cart->calculate_subtotal();
             $this->discount = $total_price * $this->value / 100;
             return $this->discount;
             // Anything else means "Fixed amount" discount
         } else {
             if ($this->every_product == 1) {
                 $item_count = (int) wpsc_cart_item_count();
                 return $this->value * $item_count;
             } else {
                 return $this->value;
             }
         }
         // The coupon has conditions so may not apply to all items
     } else {
         //Loop throught all products in the shopping cart, apply coupons on the ones match the conditions.
         $cart =& $wpsc_cart->have_cart_items();
         foreach ($wpsc_cart->cart_items as $key => $item) {
             $product_data = $wpdb->get_results("SELECT * FROM " . $wpdb->posts . " WHERE id='{$item->product_id}'");
             $product_data = $product_data[0];
             $match = true;
             foreach ($this->conditions as $c) {
                 //Check if all the condictions are returning true, so it's an ALL logic, if anyone want to implement a ANY logic please do.
                 if (!$this->compare_logic($c, $item)) {
                     $match = false;
                     break;
                 }
             }
             // This product is eligible for discount
             if ($match) {
                 if ($this->is_percentage == '1') {
                     $this->discount = $item->unit_price * $item->quantity * $this->value / 100;
                     $item->discount = $this->discount;
                     if ($this->every_product == 1) {
                         $return += $this->discount;
                     } else {
                         return $this->discount;
                     }
                 } else {
                     $item->discount = $this->value;
                     if ($this->every_product == 1) {
                         $return += $item->discount;
                     } else {
                         return $item->discount;
                     }
                 }
                 // This product is not eligible for discount
             } else {
                 $this->discount = 0;
                 $item->discount = $this->discount;
                 $return += $this->discount;
             }
         }
     }
     return $return;
 }
开发者ID:hornet9,项目名称:Morato,代码行数:67,代码来源:coupons.class.php


示例19: bloginfo

                <div class="small-circle"></div>

                <div class="nav">
                    <span><a href="<?php 
bloginfo('home');
?>
">HOME</a></span>
                    <span><a href="<?php 
bloginfo('home');
?>
/all-exhibitions">EXHIBITIONS</a></span>
                    <span><a href="<?php 
bloginfo('home');
?>
/shop">SHOP</a></span>
                    <span><a href="http://seetheunseen.co.uk/enter" target="_blank">STUDIO</a></span>
                    <span class="basket"><a href="<?php 
bloginfo('home');
?>
/shop/checkout">BASKET <div class="itemcount">(<?php 
echo wpsc_cart_item_count();
?>
)</div></a></span>
                </div>

            </div>

        </div>

        <div class="container">
      
开发者ID:samtripp,项目名称:emporium-theme,代码行数:30,代码来源:header.php


示例20: sfpaper_theme_wpsc_cart_update

 /**
  * add a custom AJAX request handler
  */
 function sfpaper_theme_wpsc_cart_update()
 {
     $data = array('cart_count' => wpsc_cart_item_count(), 'cart_total' => wpsc_cart_total_widget());
     echo json_encode($data);
     exit;
 }
开发者ID:B1aZer,项目名称:yaltatoys_wp,代码行数:9,代码来源:functions.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP wpsc_cart_item_image函数代码示例发布时间:2022-05-23
下一篇:
PHP wpsc_calculate_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