当前位置: 首页>>代码示例>>PHP>>正文


PHP edd_get_cart_total函数代码示例

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


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

示例1: sumobi_edd_show_discount_field

/**
 * Show discount field by default
 * If you want a button, simply add <a class="edd-submit button" href="#">Apply discount</a> after the input field.
 * Because the discount is applied when you click outside the field, it will work in the exact same way
*/
function sumobi_edd_show_discount_field()
{
    if (!isset($_GET['payment-mode']) && count(edd_get_enabled_payment_gateways()) > 1 && !edd_is_ajax_enabled()) {
        return;
    }
    // Only show once a payment method has been selected if ajax is disabled
    if (edd_has_active_discounts() && edd_get_cart_total()) {
        ?>
	<fieldset id="edd_discount_code">
		<p>
			<label class="edd-label" for="edd-discount">
				<?php 
        _e('Discount', 'my-child-theme');
        ?>
				<img src="<?php 
        echo EDD_PLUGIN_URL;
        ?>
assets/images/loading.gif" id="edd-discount-loader" style="display:none;"/>
			</label>
			<span class="edd-description"><?php 
        _e('Enter a coupon code if you have one.', 'my-child-theme');
        ?>
</span>
			<input class="edd-input" type="text" id="edd-discount" name="edd-discount" placeholder="<?php 
        _e('Enter discount', 'my-child-theme');
        ?>
"/>
			
		</p>
	</fieldset>
	<?php 
    }
}
开发者ID:mintplugins,项目名称:library,代码行数:38,代码来源:show-discount-field.php

示例2: sumobi_edd_hide_payment_icons

/**
 * Hide payment icons when cart total is free
*/
function sumobi_edd_hide_payment_icons()
{
    $cart_total = edd_get_cart_total();
    if ($cart_total) {
        return;
    }
    remove_action('edd_payment_mode_top', 'edd_show_payment_icons');
    remove_action('edd_checkout_form_top', 'edd_show_payment_icons');
}
开发者ID:mintplugins,项目名称:library,代码行数:12,代码来源:hide-payment-icons-when-free.php

示例3: edd_no_gateway_error

/**
 * Sets an error on checkout if no gateways are enabled
 *
 * @since 1.3.4
 * @return void
 */
function edd_no_gateway_error()
{
    $gateways = edd_get_enabled_payment_gateways();
    if (empty($gateways) && edd_get_cart_total() > 0) {
        edd_set_error('no_gateways', __('You must enable a payment gateway to use Easy Digital Downloads', 'easy-digital-downloads'));
    } else {
        edd_unset_error('no_gateways');
    }
}
开发者ID:pderksen,项目名称:Easy-Digital-Downloads,代码行数:15,代码来源:actions.php

示例4: sumobi_edd_force_account_creation_by_cart_total

function sumobi_edd_force_account_creation_by_cart_total($ret)
{
    // enter the cart total amount that should force account creation
    $limit = 100;
    // get the cart total
    $cart_total = edd_get_cart_total();
    if ($cart_total >= $limit) {
        // if the cart total is greater than or equal to the limit, force account creation
        $ret = (bool) true;
    }
    return $ret;
}
开发者ID:mintplugins,项目名称:library,代码行数:12,代码来源:force-account-creation-by-cart-total.php

示例5: cl_remove_gateway_fees_by_cart_total

function cl_remove_gateway_fees_by_cart_total($fee)
{
    // enter the cart total for no gateway fees
    $limit = 5;
    // get the cart total
    $cart_total = edd_get_cart_total();
    if ($cart_total >= $limit) {
        // if the cart total is greater than or equal to the limit, remove gateway fees
        return 0;
    } else {
        return $fee;
        // else return the fee we had before
    }
}
开发者ID:mintplugins,项目名称:library,代码行数:14,代码来源:easy-digital-downloads-conditional-gateway-fees.php

示例6: edd_process_purchase_form

/**
 * Process Purchase Form
 *
 * Handles the purchase form process.
 *
 * @access      private
 * @since       1.0
 * @version     1.0.8.1
 * @return      void
 */
function edd_process_purchase_form()
{
    // Make sure the cart isn't empty
    if (!edd_get_cart_contents()) {
        edd_set_error('empty_cart', __('Your cart is empty', 'edd'));
    } else {
        // Validate the form $_POST data
        $valid_data = edd_purchase_form_validate_fields();
        // Allow themes and plugins to hoook to errors
        do_action('edd_checkout_error_checks', $valid_data, $_POST);
    }
    $is_ajax = isset($_POST['edd_ajax']);
    $user = edd_get_purchase_form_user($valid_data);
    if (edd_get_errors() || !$user) {
        if ($is_ajax) {
            do_action('edd_ajax_checkout_errors');
            edd_die();
        } else {
            return false;
        }
    }
    if ($is_ajax) {
        echo 'success';
        edd_die();
    }
    // Setup user information
    $user_info = array('id' => $user['user_id'], 'email' => $user['user_email'], 'first_name' => $user['user_first'], 'last_name' => $user['user_last'], 'discount' => $valid_data['discount']);
    // Setup purchase information
    $purchase_data = array('downloads' => edd_get_cart_contents(), 'fees' => edd_get_cart_fees(), 'subtotal' => edd_get_cart_subtotal(), 'discount' => edd_get_cart_discounted_amount(), 'tax' => edd_get_cart_tax(), 'price' => edd_get_cart_total(), 'purchase_key' => strtolower(md5(uniqid())), 'user_email' => $user['user_email'], 'date' => date('Y-m-d H:i:s'), 'user_info' => $user_info, 'post_data' => $_POST, 'cart_details' => edd_get_cart_content_details(), 'gateway' => $valid_data['gateway'], 'card_info' => $valid_data['cc_info']);
    // Add the user data for hooks
    $valid_data['user'] = $user;
    // Allow themes and plugins to hook before the gateway
    do_action('edd_checkout_before_gateway', $_POST, $user_info, $valid_data);
    // Allow the purchase data to be modified before it is sent to the gateway
    $purchase_data = apply_filters('edd_purchase_data_before_gateway', $purchase_data, $valid_data);
    // If the total amount in the cart is 0, send to the manaul gateway. This emulates a free download purchase
    if (!$purchase_data['price']) {
        // Revert to manual
        $valid_data['gateway'] = 'manual';
    }
    // Used for showing download links to non logged-in users after purchase, and for other plugins needing purchase data.
    edd_set_purchase_session($purchase_data);
    // Send info to the gateway for payment processing
    edd_send_to_gateway($valid_data['gateway'], $purchase_data);
    edd_die();
}
开发者ID:bangtienmanh,项目名称:Easy-Digital-Downloads,代码行数:56,代码来源:process-purchase.php

示例7: edd_wallet_process_incentive

function edd_wallet_process_incentive()
{
    if ($_REQUEST['gateway'] == 'wallet') {
        EDD()->session->set('wallet_has_incentives', '1');
    } else {
        EDD()->session->set('wallet_has_incentives', null);
    }
    // Refresh the cart
    if (empty($_POST['billing_country'])) {
        $_POST['billing_country'] = edd_get_shop_country();
    }
    ob_start();
    edd_checkout_cart();
    $cart = ob_get_clean();
    $response = array('html' => $cart, 'tax_raw' => edd_get_cart_tax(), 'tax' => html_entity_decode(edd_cart_tax(false), ENT_COMPAT, 'UTF-8'), 'tax_rate_raw' => edd_get_tax_rate(), 'tax_rate' => html_entity_decode(edd_get_formatted_tax_rate(), ENT_COMPAT, 'UTF-8'), 'total' => html_entity_decode(edd_cart_total(false), ENT_COMPAT, 'UTF-8'), 'total_raw' => edd_get_cart_total());
    echo json_encode($response);
    edd_die();
}
开发者ID:easydigitaldownloads,项目名称:edd-wallet,代码行数:18,代码来源:ajax-functions.php

示例8: edd_purchase_form_required_fields

/**
 * Purchase Form Required Fields
 *
 * @access      private
 * @since       1.5
 * @return      array
 */
function edd_purchase_form_required_fields()
{
    $required_fields = array('edd_email' => array('error_id' => 'invalid_email', 'error_message' => __('Please enter a valid email address', 'easy-digital-downloads')), 'edd_first' => array('error_id' => 'invalid_first_name', 'error_message' => __('Please enter your first name', 'easy-digital-downloads')));
    // Let payment gateways and other extensions determine if address fields should be required
    $require_address = apply_filters('edd_require_billing_address', edd_use_taxes() && edd_get_cart_total());
    if ($require_address) {
        $required_fields['card_zip'] = array('error_id' => 'invalid_zip_code', 'error_message' => __('Please enter your zip / postal code', 'easy-digital-downloads'));
        $required_fields['card_city'] = array('error_id' => 'invalid_city', 'error_message' => __('Please enter your billing city', 'easy-digital-downloads'));
        $required_fields['billing_country'] = array('error_id' => 'invalid_country', 'error_message' => __('Please select your billing country', 'easy-digital-downloads'));
        $required_fields['card_state'] = array('error_id' => 'invalid_state', 'error_message' => __('Please enter billing state / province', 'easy-digital-downloads'));
    }
    return apply_filters('edd_purchase_form_required_fields', $required_fields);
}
开发者ID:Balamir,项目名称:Easy-Digital-Downloads,代码行数:20,代码来源:process-purchase.php

示例9: edd_ajax_apply_discount

/**
 * Validates the supplied discount sent via AJAX.
 *
 * @since 1.0
 * @return void
 */
function edd_ajax_apply_discount()
{
    if (isset($_POST['code']) && check_ajax_referer('edd_checkout_nonce', 'nonce')) {
        $user = isset($_POST['user']) ? $_POST['user'] : $_POST['email'];
        $return = array('msg' => '', 'code' => $_POST['code']);
        if (edd_is_discount_used($_POST['code'], $user)) {
            // Called twice if discount is not used (again by edd_is_discount_valid) but allows for beter usr msg and less execution if discount is used.
            $return['msg'] = __('This discount code has been used already', 'edd');
        } else {
            if (edd_is_discount_valid($_POST['code'], $user)) {
                $discount = edd_get_discount_by_code($_POST['code']);
                $amount = edd_format_discount_rate(edd_get_discount_type($discount->ID), edd_get_discount_amount($discount->ID));
                $discounts = edd_set_cart_discount($_POST['code']);
                $total = edd_get_cart_total($discounts);
                $return = array('msg' => 'valid', 'amount' => $amount, 'total' => html_entity_decode(edd_currency_filter(edd_format_amount($total)), ENT_COMPAT, 'UTF-8'), 'code' => $_POST['code'], 'html' => edd_get_cart_discounts_html($discounts));
            } else {
                $return['msg'] = __('The discount you entered is invalid', 'edd');
            }
        }
        echo json_encode($return);
    }
    edd_die();
}
开发者ID:bangtienmanh,项目名称:Easy-Digital-Downloads,代码行数:29,代码来源:ajax-functions.php

示例10: show_gateway

 /**
  * Maybe show the gateway
  *
  * @access      public
  * @since       1.0.0
  * @param       array $gateways The enabled gateways
  * @return      array $gateways The updated gateways
  */
 public function show_gateway($gateways)
 {
     if (is_user_logged_in() && !is_admin()) {
         // Get the current user
         $user_id = get_current_user_id();
         // Get the wallet value
         $value = edd_wallet()->wallet->balance($user_id);
         // Get the cart total
         $total = edd_get_cart_total();
         // Make sure we aren't making a deposit from our wallet
         $fee = EDD()->fees->get_fee('edd-wallet-deposit');
         if ((double) $value < (double) $total || $fee) {
             unset($gateways['wallet']);
         }
     }
     return $gateways;
 }
开发者ID:easydigitaldownloads,项目名称:edd-wallet,代码行数:25,代码来源:class.edd-wallet-gateway.php

示例11: do_action

		<?php 
}
?>

		<tr class="edd_cart_footer_row">
			<?php 
do_action('edd_checkout_table_footer_first');
?>
			<th colspan="<?php 
echo edd_checkout_cart_columns();
?>
" class="edd_cart_total"><?php 
esc_html_e('Total', 'helium');
?>
: <span class="edd_cart_amount" data-subtotal="<?php 
echo edd_get_cart_total();
?>
" data-total="<?php 
echo edd_get_cart_total();
?>
"><?php 
edd_cart_total();
?>
</span></th>
			<?php 
do_action('edd_checkout_table_footer_last');
?>
		</tr>
	</tfoot>
</table>
开发者ID:yemingyuen,项目名称:mingsg,代码行数:30,代码来源:checkout_cart.php

示例12: esc_url

    echo esc_url(url_shop_page());
    ?>
" class="link--naked"><?php 
    _e('&laquo; Continue shopping', 'yoastcom');
    ?>
</a>
				<?php 
}
?>
			</div>
			<div class="three-seventh small-four-fifth"><?php 
_e('Total', 'yoastcom');
?>
</div>
			<div class="one-seventh small-one-fifth edd_cart_total">
				<span class="edd_cart_amount" data-subtotal="<?php 
echo esc_attr(edd_get_cart_total());
?>
" data-total="<?php 
echo esc_attr(edd_get_cart_total());
?>
">
					<?php 
edd_cart_total();
?>
				</span>
			</div>
		</div>
	</div>
</div>
<?php 
开发者ID:apsolut,项目名称:Yoast-theme-public,代码行数:31,代码来源:checkout-cart.php

示例13: edd_ajax_recalculate_taxes

/**
 * Recalculate cart taxes
 *
 * @since 1.6
 * @return void
 */
function edd_ajax_recalculate_taxes()
{
    if (!edd_get_cart_contents()) {
        return false;
    }
    if (empty($_POST['billing_country'])) {
        $_POST['billing_country'] = edd_get_shop_country();
    }
    ob_start();
    edd_checkout_cart();
    $cart = ob_get_clean();
    $response = array('html' => $cart, 'tax_raw' => edd_get_cart_tax(), 'tax' => html_entity_decode(edd_cart_tax(false), ENT_COMPAT, 'UTF-8'), 'tax_rate_raw' => edd_get_tax_rate(), 'tax_rate' => html_entity_decode(edd_get_formatted_tax_rate(), ENT_COMPAT, 'UTF-8'), 'total' => html_entity_decode(edd_cart_total(false), ENT_COMPAT, 'UTF-8'), 'total_raw' => edd_get_cart_total());
    echo json_encode($response);
    edd_die();
}
开发者ID:upsellpl,项目名称:Easy-Digital-Downloads,代码行数:21,代码来源:ajax-functions.php

示例14: add_edd_cart_js_events

 public static function add_edd_cart_js_events()
 {
     $cart_items = edd_get_cart_contents();
     if ($cart_items) {
         foreach ($cart_items as $key => $item) {
             do_action('cio_js_track', 'Product in Cart', array('item_name' => get_the_title($item['id']), 'options' => $item['options'], 'time' => time()));
         }
     }
     do_action('cio_js_track', 'Cart', array('total' => edd_get_cart_total(), 'time' => time()));
 }
开发者ID:SproutApps,项目名称:segment-io,代码行数:10,代码来源:EDD_Hooks.php

示例15: do_action

				<?php do_action( 'edd_checkout_table_subtotal_last' ); ?>
			</tr>
		<?php endif; ?>

		<tr class="edd_cart_footer_row edd_cart_discount_row" <?php if( ! edd_cart_has_discounts() )  echo ' style="display:none;"'; ?>>
			<?php do_action( 'edd_checkout_table_discount_first' ); ?>
			<th colspan="<?php echo edd_checkout_cart_columns(); ?>" class="edd_cart_discount">
				<?php edd_cart_discounts_html(); ?>
			</th>
			<?php do_action( 'edd_checkout_table_discount_last' ); ?>
		</tr>

		<?php if( edd_use_taxes() ) : ?>
			<tr class="edd_cart_footer_row edd_cart_tax_row"<?php if( ! edd_is_cart_taxed() ) echo ' style="display:none;"'; ?>>
				<?php do_action( 'edd_checkout_table_tax_first' ); ?>
				<th colspan="<?php echo edd_checkout_cart_columns(); ?>" class="edd_cart_tax">
					<?php _e( 'Tax', 'edd' ); ?>:&nbsp;<span class="edd_cart_tax_amount" data-tax="<?php echo edd_get_cart_tax( false ); ?>"><?php echo esc_html( edd_cart_tax() ); ?></span>
				</th>
				<?php do_action( 'edd_checkout_table_tax_last' ); ?>
			</tr>

		<?php endif; ?>

		<tr class="edd_cart_footer_row">
			<?php do_action( 'edd_checkout_table_footer_first' ); ?>
			<th colspan="<?php echo edd_checkout_cart_columns(); ?>" class="edd_cart_total"><?php _e( 'Total', 'edd' ); ?>: <span class="edd_cart_amount" data-subtotal="<?php echo edd_get_cart_total(); ?>" data-total="<?php echo edd_get_cart_total(); ?>"><?php edd_cart_total(); ?></span></th>
			<?php do_action( 'edd_checkout_table_footer_last' ); ?>
		</tr>
	</tfoot>
</table>
开发者ID:harish94,项目名称:Easy-Digital-Downloads,代码行数:30,代码来源:checkout_cart.php


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