Plugin Directory

Changeset 738588


Ignore:
Timestamp:
07/10/2013 07:14:27 AM (13 years ago)
Author:
garyc40
Message:

Synced with GitHub

Location:
wp-e-commerce/trunk
Files:
78 added
20 edited

Legend:

Unmodified
Added
Removed
  • wp-e-commerce/trunk/.gitignore

    r670272 r738588  
    1 .idea
     1cookbooks
     2tmp
  • wp-e-commerce/trunk/readme.txt

    • Property svn:executable set to *
    r734598 r738588  
    55Requires at least: 3.4
    66Tested up to: 3.6
    7 Stable tag: 3.8.12
     7Stable tag: 3.8.12.1
    88
    99WP e-Commerce is a free WordPress Shopping Cart Plugin that lets customers buy your products, services and digital downloads online.
     
    147147== Changelog ==
    148148
     149= 3.8.12.1 =
     150* Fix: Fatal error in wpsc_product_list_exclude_child_categories() due to other themes
     151       or plugins calling get_posts() before the main query is set up
     152
    149153= 3.8.12 =
    150154* New: Filter to hide drafts on the front-end: "wpsc_product_display_status"
    151155* New: Shipwire staging / production option
    152 * New: Database upgrade routine to migrate product metadata from old installations
    153156* Change: Remove deprecated and unused javascript (and by extension, CSS) from core
    154157* Change: Remove nusoap
  • wp-e-commerce/trunk/wp-shopping-cart.php

    r734596 r738588  
    44  * Plugin URI: http://getshopped.org/
    55  * Description: A plugin that provides a WordPress Shopping Cart. See also: <a href="http://getshopped.org" target="_blank">GetShopped.org</a> | <a href="http://getshopped.org/forums/" target="_blank">Support Forum</a> | <a href="http://docs.getshopped.org/" target="_blank">Documentation</a>
    6   * Version: 3.8.12-beta
     6  * Version: 3.8.13-dev
    77  * Author: Instinct Entertainment
    88  * Author URI: http://getshopped.org/
     
    1818class WP_eCommerce {
    1919    private $components = array(
    20         'merchant' => array(),
     20        'merchant'    => array(),
     21        'marketplace' => array(),
    2122    );
    2223
     
    2728     * @uses add_action()   Attaches to 'wpsc_components' hook
    2829     */
    29     function WP_eCommerce() {
     30    function __construct() {
    3031        add_action( 'plugins_loaded' , array( $this, 'init' ), 8 );
    31         add_action( 'wpsc_components', array( $this, '_register_core_components' ) );
     32        add_filter( 'wpsc_components', array( $this, '_register_core_components' ) );
    3233    }
    3334
     
    5758
    5859    /**
    59      * @todo we need documentation finished here
    60      *
    61      * @param   array   $components
    62      *
    63      * @return  array
     60     * New WPSC components API.
     61     *
     62     * Allows for modular coupling of different functionalities within WPSC.
     63     * This is the way we'll be introducing cutting-edge APIs
     64     *
     65     * @since 3.8.9.5
     66     *
     67     * @param   array $components
     68     * @return  array $components
    6469     */
    6570    public function _register_core_components( $components ) {
    6671        $components['merchant']['core-v2'] = array(
    67             'title' => __( 'WP e-Commerce Merchant API v2', 'wpsc' ),
     72            'title'    => __( 'WP e-Commerce Merchant API v2', 'wpsc' ),
    6873            'includes' =>
    6974                WPSC_FILE_PATH . '/wpsc-components/merchant-core-v2/merchant-core-v2.php'
     
    7176
    7277        $components['theme-engine']['core-v1'] = array(
    73             'title' => __( 'WP e-Commerce Theme Engine v1', 'wpsc' ),
     78            'title'    => __( 'WP e-Commerce Theme Engine v1', 'wpsc' ),
    7479            'includes' =>
    7580                WPSC_FILE_PATH . '/wpsc-components/theme-engine-v1/theme-engine-v1.php'
     81        );
     82
     83        $components['marketplace']['core-v1'] = array(
     84            'title'    => __( 'WP e-Commerce Marketplace API v1', 'wpsc' ),
     85            'includes' =>
     86                WPSC_FILE_PATH . '/wpsc-components/marketplace-core-v1/marketplace-core-v1.php'
    7687        );
    7788
     
    99110
    100111        //load text domain
    101         if( !load_plugin_textdomain( 'wpsc', false, '../languages/' ) )
     112        if ( ! load_plugin_textdomain( 'wpsc', false, '../languages/' ) )
    102113            load_plugin_textdomain( 'wpsc', false, dirname( plugin_basename( __FILE__ ) ) . '/wpsc-languages/' );
    103114
     
    193204        do_action( 'wpsc_before_init' );
    194205
    195         // Setup the customer ID just in case to make sure it's set up correctly
    196         _wpsc_action_create_customer_id( 'create' );
    197 
    198206        // Setup the core WPEC globals
    199207        wpsc_core_setup_globals();
    200208
    201         // Setup the core WPEC cart
    202         wpsc_core_setup_cart();
     209        // Setup the customer ID just in case to make sure it's set up correctly
     210        add_action( 'init', '_wpsc_action_setup_customer', 1 );
    203211
    204212        // Load the purchase log statuses
     
    227235    function install() {
    228236        global $wp_version;
    229         if((float)$wp_version < 3.0){
    230              deactivate_plugins(plugin_basename(__FILE__)); // Deactivate ourselves
    231              wp_die( __('Looks like you\'re running an older version of WordPress, you need to be running at least WordPress 3.0 to use WP e-Commerce 3.8', 'wpsc'), __('WP e-Commerce 3.8 not compatible', 'wpsc'), array('back_link' => true));
     237
     238        if ( ( float ) $wp_version < 3.0 ) {
     239             deactivate_plugins( plugin_basename( __FILE__ ) ); // Deactivate ourselves
     240             wp_die( __( 'Looks like you\'re running an older version of WordPress, you need to be running at least WordPress 3.0 to use WP e-Commerce 3.8', 'wpsc' ), __( 'WP e-Commerce 3.8 not compatible', 'wpsc' ), array( 'back_link' => true ) );
    232241            return;
    233242        }
  • wp-e-commerce/trunk/wpsc-admin/admin.php

    r725142 r738588  
    5959    return $vars;
    6060}
     61
     62/**
     63 * Admin Edit Posts Order
     64 *
     65 * @since 3.8.12
     66 * @access public
     67 *
     68 * @param   string  $orderby_sql  Order by SQL.
     69 * @return  string  Filtered order by SQL.
     70 */
     71function wpsc_admin_edit_posts_orderby( $orderby_sql ) {
     72    global $wp_query, $wpdb;
     73    if ( 'dragndrop' == get_option( 'wpsc_sort_by' ) ) {
     74        if ( function_exists( 'is_main_query' ) && is_main_query() && 'wpsc-product' == get_query_var( 'post_type' ) && is_tax( 'wpsc_product_category' ) ) {
     75            if ( ! empty( $orderby_sql ) )
     76                $orderby_sql = ', ' . $orderby_sql;
     77            $orderby_sql = " {$wpdb->term_relationships}.term_order ASC" . $orderby_sql;
     78            remove_filter( 'posts_orderby', 'wpsc_admin_edit_posts_orderby' );
     79        }
     80    }
     81    return $orderby_sql;
     82}
     83add_filter( 'posts_orderby', 'wpsc_admin_edit_posts_orderby' );
    6184
    6285/**
  • wp-e-commerce/trunk/wpsc-admin/ajax.php

    r725142 r738588  
    531531    }
    532532
     533    // Validate data before exposing to action
     534    $category = isset( $_POST['category_id'] ) ? get_term_by( 'slug', $_POST['category_id'], 'wpsc_product_category' ) : false;
     535    do_action( 'wpsc_save_product_order', $products, $category );
     536
    533537    if ( ! empty( $failed ) ) {
    534538        $error_data = array(
     
    543547    );
    544548}
     549
     550/**
     551 * Save Category Product Order
     552 *
     553 * Note that this uses the 'term_order' field in the 'term_relationships' table to store
     554 * the order. Although this column presently seems to be unused by WordPress, the intention
     555 * is it should be used to store the order of terms associates to a post, not the order
     556 * of posts as we are doing. This shouldn't be an issue for WPEC unless WordPress adds a UI
     557 * for this. More info at http://core.trac.wordpress.org/ticket/9547
     558 *
     559 * @since 3.9
     560 * @access private
     561 *
     562 * @uses $wpdb   WordPress database object used for queries
     563 */
     564function _wpsc_save_category_product_order( $products, $category ) {
     565    global $wpdb;
     566 
     567    // Only save category product order if in category
     568    if ( ! $category )
     569        return;
     570 
     571    // Save product order in term_relationships table
     572    foreach ( $products as $order => $product_id ) {
     573        $wpdb->update( $wpdb->term_relationships,
     574            array( 'term_order' => $order ),
     575            array( 'object_id' => $product_id, 'term_taxonomy_id' => $category->term_taxonomy_id ),
     576            array( '%d' ),
     577            array( '%d', '%d' )
     578        );
     579    }
     580}
     581add_action( 'wpsc_save_product_order', '_wpsc_save_category_product_order', 10, 2 );
    545582
    546583/**
  • wp-e-commerce/trunk/wpsc-admin/db-upgrades/routines/4.php

    r708401 r738588  
    2020    );
    2121
    22     wpsc_flush_theme_transients( true );
     22    if ( function_exists( 'wpsc_flush_theme_transients' ) )
     23        wpsc_flush_theme_transients( true );
    2324
    2425    //Make sure the theme has actually been moved.
  • wp-e-commerce/trunk/wpsc-admin/display-items.page.php

    r734596 r738588  
    8686 * @param  boolean $has_variations Whether the product has variations
    8787 *
    88  * @uses esc_html_e()           Safe HTML with translation
    89  * @uses get_post_meta()        Gets post meta given key and post_id
    90  * @uses maybe_unserialize()    Unserialize value only if it was serialized.
    91  * @uses wpsc_convert_weight()  Does weight conversions
    92  * @uses esc_html()             Makes sure things are safe
     88 * @uses esc_html_e()                Safe HTML with translation
     89 * @uses get_post_meta()             Gets post meta given key and post_id
     90 * @uses maybe_unserialize()         Unserialize value only if it was serialized.
     91 * @uses wpsc_convert_weight()       Does weight conversions
     92 * @uses esc_html()                  Makes sure things are safe
     93 * @uses wpsc_weight_unit_display()  Gets weight unit for display
    9394 */
    9495function _wpsc_manage_products_column_weight( $post, $post_id, $has_variations ) {
     
    118119    $unit = $product_data['meta']['_wpsc_product_metadata']['weight_unit'];
    119120
    120     switch( $unit ) {
    121         case "pound":
    122             $unit = __(" lbs.", "wpsc");
    123         break;
    124         case "ounce":
    125             $unit = __(" oz.", "wpsc");
    126         break;
    127         case "gram":
    128             $unit = __(" g", "wpsc");
    129         break;
    130         case "kilograms":
    131         case "kilogram":
    132             $unit = __(" kgs.", "wpsc");
    133         break;
    134     }
    135     echo $weight.$unit;
     121    echo $weight . wpsc_weight_unit_display( $unit );
    136122    echo '<div id="inline_' . $post->ID . '_weight" class="hidden">' . esc_html( $weight ) . '</div>';
    137123}
  • wp-e-commerce/trunk/wpsc-admin/includes/display-items-functions.php

    r708401 r738588  
    417417}
    418418
     419/**
     420 * Dimension Units
     421 *
     422 * @since   3.8.13
     423 *
     424 * @return  array  List of valid dimension units.
     425 */
     426function wpsc_dimension_units() {
     427    return array(
     428        'in'    => __( 'inches', 'wpsc' ),
     429        'cm'    => __( 'cm', 'wpsc' ),
     430        'meter' => __( 'meters', 'wpsc' )
     431    );
     432}
     433
     434/**
     435 * Weight Units
     436 *
     437 * @since   3.8.13
     438 *
     439 * @return  array  List of valid weight units.
     440 */
     441function wpsc_weight_units() {
     442    return array(
     443        'pound'    => __( 'pounds', 'wpsc' ),
     444        'ounce'    => __( 'ounces', 'wpsc' ),
     445        'gram'     => __( 'grams', 'wpsc' ),
     446        'kilogram' => __( 'kilograms', 'wpsc' )
     447    );
     448}
     449
     450/**
     451 * Weight Unit Display
     452 *
     453 * Returns a weight unit abbreviation for display.
     454 *
     455 * @since   3.8.13
     456 *
     457 * @param   string  $unit  Weight unit.
     458 * @return  string         Weight unit string.
     459 */
     460function wpsc_weight_unit_display( $unit ) {
     461    switch ( $unit ) {
     462        case 'pound' :
     463            return __( ' lbs.', 'wpsc' );
     464        case 'ounce' :
     465            return __( ' oz.', 'wpsc' );
     466        case 'gram' :
     467            return __( ' g', 'wpsc' );
     468        case 'kilograms' :
     469        case 'kilogram' :
     470            return __( ' kgs.', 'wpsc' );
     471    }
     472    return '';
     473}
     474
     475/**
     476 * Validate Dimension Unit
     477 *
     478 * Returns a valid dimensions unit.
     479 * If the unit is not set or invalid it will be filtered using 'wpsc_default_dimension_unit'
     480 * so that an alternative default unit can be set.
     481 *
     482 * @since   3.8.13
     483 *
     484 * @param   string  $unit  Dimension unit.
     485 * @return  string         Dimension unit string.
     486 *
     487 * @uses    wpsc_default_dimension_unit
     488 */
     489function wpsc_validate_dimension_unit( $unit = '' ) {
     490    $default_unit = apply_filters( 'wpsc_default_dimension_unit', $unit );
     491    if ( empty( $unit ) && array_key_exists( $default_unit, wpsc_dimension_units() ) )
     492        $unit = $default_unit;
     493    return $unit;
     494}
     495
     496/**
     497 * Validate Weight Unit
     498 *
     499 * Returns a valid weight unit.
     500 * If the unit is not set or invalid it will be filtered using 'wpsc_default_weight_unit'
     501 * so that an alternative default unit can be set.
     502 *
     503 * @since   3.8.13
     504 *
     505 * @param   string  $unit  Weight unit.
     506 * @return  string         Weight unit string.
     507 *
     508 * @uses    wpsc_default_weight_unit
     509 */
     510function wpsc_validate_weight_unit( $unit = '' ) {
     511    $default_unit = apply_filters( 'wpsc_default_weight_unit', $unit );
     512    if ( empty( $unit ) && array_key_exists( $default_unit, wpsc_weight_units() ) )
     513        $unit = $default_unit;
     514    return $unit;
     515}
     516
     517/**
     518 * Product Shipping Forms
     519 *
     520 * @uses  wpsc_validate_weight_unit()
     521 * @uses  wpsc_validate_dimension_unit()
     522 */
    419523function wpsc_product_shipping_forms( $product = false, $field_name_prefix = 'meta[_wpsc_product_metadata]', $bulk = false ) {
    420524    if ( ! $product )
     
    429533    $defaults = array(
    430534        'weight' => '',
    431         'weight_unit' => '',
     535        'weight_unit' => wpsc_validate_weight_unit(),
    432536        'dimensions' => array(),
    433537        'shipping'   => array(),
     
    436540    );
    437541    $dimensions_defaults = array(
    438         'height_unit' => '',
    439         'width_unit' => '',
    440         'length_unit' => '',
     542        'height_unit' => wpsc_validate_dimension_unit(),
     543        'width_unit' => wpsc_validate_dimension_unit(),
     544        'length_unit' => wpsc_validate_dimension_unit(),
    441545        'height' => 0,
    442546        'width' => 0,
     
    459563    $weight = wpsc_convert_weight( $weight, 'pound', $weight_unit );
    460564
    461     $dimension_units = array(
    462         'in'    => __( 'inches', 'wpsc' ),
    463         'cm'    => __( 'cm', 'wpsc' ),
    464         'meter' => __( 'meters', 'wpsc' )
    465     );
    466 
    467     $weight_units = array(
    468         'pound'    => __( 'pounds', 'wpsc' ),
    469         'ounce'    => __( 'ounces', 'wpsc' ),
    470         'gram'     => __( 'grams', 'wpsc' ),
    471         'kilogram' => __( 'kilograms', 'wpsc' )
    472     );
     565    $dimension_units = wpsc_dimension_units();
     566    $weight_units = wpsc_weight_units();
    473567
    474568    $measurements = $dimensions;
  • wp-e-commerce/trunk/wpsc-components/merchant-core-v2/helpers/admin.php

    r708401 r738588  
    7979        $return = array(
    8080            'name'              => $selected_gateway_data['name'],
    81             'form_fields'       => $output . $selected_gateway_data['form'](),
     81            'form_fields'       => $output . call_user_func( $selected_gateway_data['form'] ),
    8282            'has_submit_button' => 0,
    8383        );
  • wp-e-commerce/trunk/wpsc-components/theme-engine-v1/classes/wpsc-products-by-category.php

    r734596 r738588  
    5757
    5858            $this->sql_components['join']     = $join;
    59             $this->sql_components['fields']   = "{$wpdb->posts}.*, {$wpdb->term_taxonomy}.term_id";
     59            $this->sql_components['fields']   = "{$wpdb->posts}.*, {$wpdb->term_taxonomy}.term_id, {$wpdb->term_relationships}.term_order";
    6060            $this->sql_components['group_by'] = $groupby;
    6161
     
    6464                $whichcat .= " AND $wpdb->postmeta.meta_key = '_wpsc_price'";
    6565            }else{
     66                $this->sql_components['order_by'] = "{$wpdb->term_taxonomy}.term_id";
    6667
    67                 $this->sql_components['order_by'] = "{$wpdb->term_taxonomy}.term_id";
     68                // Term Taxonomy ID Ordering
     69                if ( $q['orderby'] == 'menu_order' ) {
     70                    if ( $term_data ) {
     71                        $this->sql_components['order_by'] = "{$wpdb->term_relationships}.term_order ASC";
     72                    }
     73                }
    6874            }
    6975            $this->sql_components['where']    = $whichcat;
  • wp-e-commerce/trunk/wpsc-core/js/wp-e-commerce.js

    r734596 r738588  
    437437}
    438438
    439 // submit the fancy notifications forms.
     439//submit the fancy notifications forms.
    440440function wpsc_fancy_notification(parent_form){
    441441    if(typeof(WPSC_SHOW_FANCY_NOTIFICATION) == 'undefined'){
     
    443443    }
    444444    if((WPSC_SHOW_FANCY_NOTIFICATION == true) && (jQuery('#fancy_notification') != null)){
    445         var options = {
    446             margin: 1 ,
    447             border: 1 ,
    448             padding: 1 ,
    449             scroll: 1
    450         };
    451 
    452         form_button_id = jQuery(parent_form).attr('id') + "_submit_button";
    453         var button_offset = jQuery('#'+form_button_id).offset();
    454 
    455         jQuery('#fancy_notification').css("left", (button_offset.left - 130) + 'px');
    456         jQuery('#fancy_notification').css("top", (button_offset.top + 40) + 'px');
    457 
     445        jQuery('#fancy_notification').css({
     446                position:'fixed',
     447                left: (jQuery(window).width() - jQuery('#fancy_notification').outerWidth())/2,
     448                top: (jQuery(window).height() - jQuery('#fancy_notification').outerHeight())/2
     449            });
    458450
    459451        jQuery('#fancy_notification').css("display", 'block');
  • wp-e-commerce/trunk/wpsc-core/wpsc-constants.php

    r734596 r738588  
    2929        define( 'WPSC_URL',       plugins_url( '', __FILE__ ) );
    3030    // Define Plugin version
    31     define( 'WPSC_VERSION', '3.8.12-beta' );
    32     define( 'WPSC_MINOR_VERSION', '55f8cfa0d7' );
    33     define( 'WPSC_PRESENTABLE_VERSION', '3.8.12-beta' );
     31    define( 'WPSC_VERSION', '3.8.13-dev' );
     32    define( 'WPSC_MINOR_VERSION', '819b5037cc' );
     33    define( 'WPSC_PRESENTABLE_VERSION', '3.8.13-dev' );
    3434    define( 'WPSC_DB_VERSION', 5 );
    3535
     
    260260    else
    261261        $GLOBALS['wpsc_cart'] = new wpsc_cart();
     262
     263    $GLOBALS['wpsc_cart']->get_shipping_method();
    262264}
    263265
  • wp-e-commerce/trunk/wpsc-core/wpsc-functions.php

    r734596 r738588  
    206206 */
    207207function wpsc_core_load_shipping_modules() {
    208     global $wpsc_shipping_modules, $wpsc_cart;
     208    global $wpsc_shipping_modules;
    209209
    210210    $shipping_directory     = WPSC_FILE_PATH . '/wpsc-shipping';
     
    219219    $wpsc_shipping_modules = apply_filters( 'wpsc_shipping_modules', $wpsc_shipping_modules );
    220220
    221     if ( ! get_option( 'do_not_use_shipping' ) && empty( $wpsc_cart->selected_shipping_method ) )
     221    if ( ! get_option( 'do_not_use_shipping' ) )
     222        add_action( 'wpsc_setup_customer', '_wpsc_action_get_shipping_method' );
     223}
     224
     225/**
     226 * If shipping is enabled and shipping methods have not been initialized, then
     227 * do so.
     228 *
     229 * @access private
     230 * @since 3.8.13
     231 */
     232function _wpsc_action_get_shipping_method() {
     233    global $wpsc_cart;
     234    if ( empty( $wpsc_cart->selected_shipping_method ) )
    222235        $wpsc_cart->get_shipping_method();
    223236}
     
    429442    global $wpdb, $wpsc_start_time, $wpsc_cart;
    430443
     444    if ( is_admin() )
     445        return;
     446
    431447    // avoid flooding transients with bots hitting feeds
    432448    if ( is_feed() ) {
     
    457473function wpsc_get_page_post_names() {
    458474    $wpsc_page['products']            = basename( get_option( 'product_list_url' ) );
     475    if ( empty($wpsc_page['products']) || false !== strpos($wpsc_page['products'], '?page_id=') ) {
     476        // Products page either doesn't exist, or is a draft
     477        // Default to /product/xyz permalinks for products
     478        $wpsc_page['products'] = 'product';
     479    }
    459480    $wpsc_page['checkout']            = basename( get_option( 'checkout_url' ) );
    460481    $wpsc_page['transaction_results'] = basename( get_option( 'transact_url' ) );
     
    717738
    718739/**
    719  * Create customer ID upon 'plugins_loaded' to make sure there's one exists before
    720  * anything else.
     740 * Setup current user object and customer ID as well as cart.
     741 *
     742 * @uses  do_action() Calls 'wpsc_setup_customer' after customer data is ready
    721743 *
    722744 * @access private
    723  * @since  3.8.9
    724  */
    725 function _wpsc_action_create_customer_id() {
     745 * @since  3.8.13
     746 */
     747function _wpsc_action_setup_customer() {
    726748    wpsc_get_current_customer_id( 'create' );
     749    wpsc_core_setup_cart();
     750    do_action( 'wpsc_setup_customer' );
    727751}
    728752
  • wp-e-commerce/trunk/wpsc-core/wpsc-includes.php

    r734596 r738588  
    4949include_once( WPSC_FILE_PATH . '/wpsc-widgets/admin_menu_widget.php' );
    5050
     51// Meta
     52require_once( WPSC_FILE_PATH . '/wpsc-includes/wpsc-meta-init.php' );
     53
    5154// Gregs ASH Shipping
    5255require_once( WPSC_FILE_PATH . '/wpsc-includes/shipping.helper.php' );
  • wp-e-commerce/trunk/wpsc-includes/cart.class.php

    r734596 r738588  
    208208
    209209/**
     210 * Product Minimum Cart Quantity
     211 *
     212 * @since  3.8.13
     213 * @access public
     214 *
     215 * @param  int  $prod_id    Optional. Product ID.
     216 * @return int              The minimum quantity that can be added to the cart.
     217 *
     218 * @uses   apply_filters    Calls 'wpsc_product_min_cart_quantity' passing product ID.
     219 */
     220function wpsc_product_min_cart_quantity( $product_id = 0 ) {
     221    $product_id = absint( $product_id );
     222    return apply_filters( 'wpsc_product_min_cart_quantity', 1, $product_id );
     223}
     224
     225/**
    210226 * Validate Product Cart Quantity
    211227 * Checks that the quantity is within the permitted bounds and return a valid quantity.
     
    219235 *
    220236 * @uses   wpsc_product_max_cart_quantity    Gets the maximum product cart quantity.
     237 * @uses   wpsc_product_min_cart_quantity    Gets the minimum product cart quantity.
    221238 */
    222239function wpsc_validate_product_cart_quantity( $quantity, $product_id = 0 ) {
    223240    $max_quantity = wpsc_product_max_cart_quantity( $product_id );
     241    $min_quantity = wpsc_product_min_cart_quantity( $product_id );
    224242    if ( $quantity > $max_quantity )
    225243        return $max_quantity;
     244    if ( $quantity < $min_quantity )
     245        return $min_quantity;
    226246    return $quantity;
    227247}
     
    367387     $this->wpsc_refresh_cart_items();
    368388     $this->unique_id = sha1(uniqid(rand(), true));
    369      $this->get_shipping_method();
    370389  }
    371390
  • wp-e-commerce/trunk/wpsc-includes/coupons.class.php

    r725142 r738588  
    164164                    $id = $product_data->post_parent;
    165165
    166                 return has_term( $condition['value'], 'wpsc_product_category', $id );
     166                $category_condition = $condition['value'];
     167                if ( false !== strpos( $category_condition, ',' ) ) {
     168                    $category_condition = explode( ',', $condition['value'] );
     169                    $category_condition = array_map( 'trim', $cond );
     170                }
     171                return has_term( $category_condition, 'wpsc_product_category', $id );
    167172            break;
    168173
  • wp-e-commerce/trunk/wpsc-includes/product-template.php

    r734596 r738588  
    1010 * @subpackage wpsc-template-functions
    1111 */
     12
     13/**
     14 * Get The Product Excerpt
     15 *
     16 * WPEC uses the excerpt field in the database to store additional product details.
     17 * This means that where themes output the excerpt (like in search results) the product's
     18 * additional details are displayed which is not the expected behaviour.
     19 *
     20 * This function filters the excerpt early and returns an empty string which forces the default
     21 * WordPress behaviour to use a truncated version of the content instead.
     22 *
     23 * Always use wpsc_the_product_additional_description() to return the addition product description.
     24 *
     25 * @since  3.8.13
     26 *
     27 * @param   string  $excerpt  The post excerpt (which for products is the additional description).
     28 * @return  string            The empty excerpt.
     29 */
     30function wpsc_get_the_excerpt( $excerpt ) {
     31    if ( 'wpsc-product' == get_post_type() )
     32        return '';
     33    return $excerpt;
     34}
     35add_filter( 'get_the_excerpt', 'wpsc_get_the_excerpt', 2 );
    1236
    1337/**
  • wp-e-commerce/trunk/wpsc-languages/wpsc-it_IT.po

    r402326 r738588  
    40914091
    40924092#: wpsc-theme/wpsc-shopping_cart_page.php:88
    4093 msgid "Enter coupon code"
     4093msgid "Enter coupon code :"
    40944094msgstr "Inserire il codice coupon"
    40954095
  • wp-e-commerce/trunk/wpsc-updates/database_template.php

    r725142 r738588  
    209209$wpsc_database_template[$table_name]['indexes']['cart_submitted'] = "KEY `cart_submitted` ( `cart_submitted` )";
    210210
     211// code to create or update the all of the wpsc custom meta tables that are managed using the wordpress meta functionalilty
     212// the meta object types should be those listed in the wpsc_meta_core_object_types() function, they are repeated here to allow
     213// the database init and upgrade to happen prior to the include of the meta function defintions
     214$meta_object_types = array( 'cart_item', 'visitor' );
     215foreach ( $meta_object_types as $meta_object_type ) {
     216    $table_name = $wpdb->prefix.$meta_object_type.'_meta'; // this is the same as the function wpsc_meta_table_name( $meta_object_type );
     217    $wpsc_database_template[$table_name]['columns']['meta_id'] = "bigint(20) unsigned NOT NULL AUTO_INCREMENT ";
     218    $wpsc_database_template[$table_name]['columns'][$meta_object_type.'_id'] = "bigint(20) unsigned NOT NULL DEFAULT '0' ";
     219    $wpsc_database_template[$table_name]['columns']['meta_key'] = "varchar(255) default NULL ";
     220    $wpsc_database_template[$table_name]['columns']['meta_value'] = "longtext ";
     221    $wpsc_database_template[$table_name]['columns']['meta_timestamp'] = "timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ";
     222    $wpsc_database_template[$table_name]['indexes']['PRIMARY'] = "PRIMARY KEY  ( `meta_id` ) ";
     223    $wpsc_database_template[$table_name]['indexes']['meta_key'] = "KEY `meta_key` ( `meta_key`(191) ) ";
     224    $wpsc_database_template[$table_name]['indexes']['meta_value'] = "KEY `meta_value` ( `meta_value`(20) ) ";
     225    $wpsc_database_template[$table_name]['indexes']['meta_key_and_value'] = "KEY `meta_key_and_value` ( `meta_key`(191), `meta_value`(32) ) ";
     226    $wpsc_database_template[$table_name]['indexes']['meta_timestamp_index'] = "KEY meta_timestamp_index (meta_timestamp) ";
     227    $wpsc_database_template[$table_name]['indexes'][$meta_object_type.'_id'] = 'KEY '.$meta_object_type.'_id ( `' . $meta_object_type . '_id` ) ';
     228    if ( function_exists( $meta_migrate_function_name = 'wpsc_meta_migrate_'.$meta_object_type ) ) {
     229        $wpsc_database_template[$table_name]['actions']['after']['all'] = $meta_migrate_function_name;
     230    }
     231}
    211232
    212233?>
Note: See TracChangeset for help on using the changeset viewer.