本文整理汇总了PHP中get_product函数的典型用法代码示例。如果您正苦于以下问题:PHP get_product函数的具体用法?PHP get_product怎么用?PHP get_product使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_product函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: is_bulk_variation_form
public function is_bulk_variation_form()
{
global $post;
if (!$post) {
return false;
}
/** Remove validation (_bv_type) -- 03/02/2016 **/
if (!is_product()) {
return false;
}
/****/
/** Validate if exits role -- 03/02/2016 **/
if ($this->role_exists('wholesale_customer')) {
if (!current_user_can('wholesale_customer')) {
return false;
}
}
// 2.0 Compat
if (function_exists('get_product')) {
$product = get_product($post->ID);
} else {
$product = new WC_Product($post->ID);
}
if ($product && !$product->has_child() && !$product->is_type('variable')) {
return false;
}
return apply_filters('woocommerce_bv_render_form', true);
}
开发者ID:jmagallanes,项目名称:cultura-woo-bulk-variations,代码行数:28,代码来源:cultura-woo-bulk-variations.php
示例2: update_orders_value
public static function update_orders_value( $post_id, $post ) {
if ( is_int( wp_is_post_revision( $post_id ) ) ) return;
if ( is_int( wp_is_post_autosave( $post_id ) ) ) return;
if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) return $post_id;
if ( ! current_user_can( 'edit_post', $post_id ) ) return $post_id;
if ( $post->post_type != 'product' ) return $post_id;
if ( version_compare( WC()->version, '2.2.0', '<' ) ) {
$product = get_product( $post );
} else {
$product = wc_get_product( $post );
}
if ( $product ) {
if ( $product->is_on_sale() ) {
update_post_meta( $post_id, '_psad_onsale_order', 2 );
} else {
update_post_meta( $post_id, '_psad_onsale_order', 1 );
}
if ( $product->is_featured() ) {
update_post_meta( $post_id, '_psad_featured_order', 2 );
} else {
update_post_meta( $post_id, '_psad_featured_order', 1 );
}
}
}
开发者ID:helloworld-digital,项目名称:katemorgan,代码行数:25,代码来源:class-wc-psad-functions.php
示例3: add_to_cart_button
/**
* Build the "Add to cart" HTML.
*
* @param string $url
* @param string $stock_status
* @param string $type
* @return string
* @static
* @since 1.0.0
*/
public static function add_to_cart_button($product_id, $stock_status)
{
global $yith_wcwl;
if (function_exists('get_product')) {
$product = get_product($product_id);
} else {
$product = new WC_Product($product_id);
}
$url = $product->product_type == 'external' ? $yith_wcwl->get_affiliate_product_url($product_id) : $yith_wcwl->get_addtocart_url($product_id);
$label_option = get_option('yith_wcwl_add_to_cart_text');
$localize_label = function_exists('icl_translate') ? icl_translate('Plugins', 'plugin_yit_wishlist_button', $label_option) : $label_option;
$label = $product->product_type == 'variable' ? apply_filters('variable_add_to_cart_text', __('Choose an option', 'yit')) : apply_filters('yith_wcwl_add_to_cart_label', $localize_label);
$icon = get_option('yith_wcwl_use_button') == 'yes' && get_option('yith_wcwl_add_to_cart_icon') != 'none' ? '<i class="' . get_option('yith_wcwl_add_to_cart_icon') . '"></i>' : '';
$cartlink = '';
$redirect_to_cart = get_option('yith_wcwl_redirect_cart') == 'yes' && $product->product_type != 'variable' ? 'true' : 'false';
$style = '';
//indicates the style (background-color and font color)
if (get_option('yith_wcwl_use_button') == 'yes') {
if ($product->product_type == 'external') {
$cartlink .= '<a target="_blank" class="add_to_cart button alt button green standar-nowidth" href="' . $url . '"';
} else {
$js_action = esc_attr('check_for_stock(\'' . $url . '\',\'' . $stock_status . '\',\'' . $redirect_to_cart . '\');');
$cartlink .= '<a class="add_to_cart button alt button green standar-nowidth" onclick="' . $js_action . '"';
}
$cartlink .= $style . '>' . $icon . $label . '</a>';
} else {
if ($product->product_type == 'external') {
$cartlink .= '<a target="_blank" class="add_to_cart button alt button green standar-nowidth" href="' . $url . '">' . $icon . $label . '</a>';
} else {
$js_action = esc_attr('check_for_stock(\'' . $url . '\',\'' . $stock_status . '\',\'' . $redirect_to_cart . '\');');
$cartlink .= '<a class="add_to_cart button alt button green standar-nowidth" href="javascript:void(0);" onclick="' . $js_action . '">' . $icon . $label . '</a>';
}
}
return $cartlink;
}
开发者ID:sergioblanco86,项目名称:git-gitlab.com-kinivo-kinivo.com,代码行数:45,代码来源:class.yith-wcwl-ui.php
示例4: do_payment
function do_payment($payment_id, $member_id, $product_id, $price, $begin_date, $expire_date, &$vars)
{
global $db;
global $config;
if (is_array($vars['product_id'])) {
$p = $db->get_payment($payment_id);
$price_count = 0;
foreach ($p['data'][0]['BASKET_PRICES'] as $pp) {
if ($pp) {
$price_count++;
}
}
if ($price_count > 1) {
return "Only 1 paid product can be selected";
}
$product_id = $vars['product_id'][0];
}
$product =& get_product($product_id);
$vars = array('email' => $this->config['business'], 'amount' => $price, 'ordernumber' => $payment_id, 'description' => $product->config['title'], 'returnurl' => sprintf("%s/thanks.php?member_id=%d&product_id=%d&payment_id=%d", $config['root_url'], $member_id, $product_id, $payment_id));
//encode and send
$vars1 = array();
foreach ($vars as $kk => $vv) {
$v = urlencode($vv);
$k = urlencode($kk);
$vars1[] = "{$k}={$v}";
}
$vars = join('&', $vars1);
if ($this->config['testing']) {
html_redirect("https://demo.nochex.com/nochex.dll/checkout?{$vars}");
} else {
html_redirect("https://www.nochex.com/nochex.dll/checkout?{$vars}");
}
exit;
}
开发者ID:subashemphasize,项目名称:test_site,代码行数:34,代码来源:nochex.inc.php
示例5: do_payment
function do_payment($payment_id, $member_id, $product_id, $price, $begin_date, $expire_date, &$vars)
{
global $config, $db;
$products = $product_id;
$orig_product_id = $product_id;
if (is_array($product_id)) {
$product_id = $product_id[0];
}
$product =& get_product($product_id);
if (count($orig_product_id) > 1) {
$product->config['title'] = $config['multi_title'];
}
$member = $db->get_user($member_id);
$vars = array('merchant' => $this->config['merchant'], 'merchantemail' => $config['admin_email'], 'orderref' => $payment_id, 'orderinfo' => $product->config['title'], 'amount' => sprintf('%d', $price), 'name' => $member['name_f'] . ' ' . $member['name_l'], 'address' => $member['street'], 'postcode' => $member['zip'], 'town' => $member['city'], 'county' => $member['state'], 'country' => $member['country'], 'email' => $member['email'], 'phone' => $member['data']['phone'], 'requiredfields' => 'orderref,name,email', 'customeremail' => 1, 'callbackurl' => 1);
// add currency code
if (strlen($product->config['securetrading_currency'])) {
$vars['currency'] = $product->config['securetrading_currency'];
} else {
$vars['currency'] = 'USD';
}
$vars1 = array();
foreach ($vars as $kk => $vv) {
$v = urlencode($vv);
$k = urlencode($kk);
$vars1[] = "{$k}={$v}";
}
$vars = join('&', $vars1);
header("Location: https://securetrading.net/authorize/form.cgi?{$vars}");
exit;
}
开发者ID:subashemphasize,项目名称:test_site,代码行数:30,代码来源:securetrading.inc.php
示例6: woocommerce_grouped_price_html
public static function woocommerce_grouped_price_html($price, $product)
{
$tax_display_mode = get_option('woocommerce_tax_display_shop');
$child_prices = array();
foreach ($product->get_children() as $child_id) {
//$child_prices[] = get_post_meta( $child_id, '_price', true );
$child = get_product($child_id);
$child_prices[] = $child->get_price();
}
$child_prices = array_unique($child_prices);
$get_price_method = 'get_price_' . $tax_display_mode . 'uding_tax';
if (!empty($child_prices)) {
$min_price = min($child_prices);
$max_price = max($child_prices);
} else {
$min_price = '';
$max_price = '';
}
if ($min_price) {
if ($min_price == $max_price) {
$display_price = wc_price($product->{$get_price_method}(1, $min_price));
} else {
$from = wc_price($product->{$get_price_method}(1, $min_price));
$to = wc_price($product->{$get_price_method}(1, $max_price));
$display_price = sprintf(_x('%1$s–%2$s', 'Price range: from-to', 'woocommerce'), $from, $to);
}
$price = $display_price . $product->get_price_suffix();
}
return $price;
}
开发者ID:pellio11,项目名称:ns-select-project,代码行数:30,代码来源:class-wrp-grouped-admin.php
示例7: shortcode
/**
* Make Shortcode
*
* @package WooCommerce 360° Image
* @author Captain Theme <[email protected]>
* @since 1.0.0
*/
public function shortcode($atts)
{
// Load in an instance of the WC_360_Image_Display Class
$image_display = new WC_360_Image_Display();
// Array of default dimensions (used when shortcode doesn't define any)
$dimensions = $image_display->default_width();
$default_width = $dimensions;
// Shortcode Attributes
extract(shortcode_atts(array('width' => $default_width, 'height' => '', 'id' => ''), $atts));
// If ID passed use that, if not get the current page's ID
if ($id) {
$id = $id;
} else {
$id = get_the_ID();
}
// Enqueue the JS / CSS we need
wp_enqueue_script('jquery');
wp_enqueue_script('wc360-threesixty-js');
wp_enqueue_script('wc360-threesixty-fullscreen-js');
wp_enqueue_style('wc360-threesixty-css');
wp_enqueue_script('wc360-js');
wp_enqueue_style('wc360-css');
wp_localize_script('wc360-js', 'wc360_vars', $image_display->js_data_all($width, $height, $id));
// Start Shortcode Output
ob_start();
// We can only currently have one instance of the rotator per page, so only show it if the 'Replace Image with 360 Image' is unchecked
if (!get_post_meta(get_the_ID(), 'wc360_enable', true)) {
// Only continue if the ID received is a product
if (get_post_type($id) == 'product') {
$product = get_product($id);
$attachment_ids = $product->get_gallery_attachment_ids();
// Only continue if there are gallery images
if ($attachment_ids) {
do_action('wc360_shortcode_before_image');
$content = '<div id="container" class="wc360-container shortcode" style="width:' . $width . 'px">';
$content .= '<div class="wc360 threesixty">';
$content .= '<div class="spinner">';
$content .= '<span>0%</span>';
$content .= '</div>';
$content .= '<ol class="threesixty_images"></ol>';
$content .= '</div>';
$content .= '</div>';
echo apply_filters('wc360_shortcode_image_output', $content);
do_action('wc360_shortcode_after_image');
} else {
// Error
echo sprintf(__('%s There are no gallery images for this product!', 'woocommerce-360-image'), '<strong>' . __('Note:', 'woocommerce-360-image') . '</strong>');
}
} else {
// Error
echo sprintf(__('%s This is not a valid product ID!', 'woocommerce-360-image'), '<strong>' . __('Note:', 'woocommerce-360-image') . '</strong>');
}
} else {
// Error
echo sprintf(__('%s There can only be one rotator per page!', 'woocommerce-360-image'), '<strong>' . __('Note:', 'woocommerce-360-image') . '</strong>');
}
$data = ob_get_clean();
// End Shortcode Output
return $data;
}
开发者ID:rsantellan,项目名称:wordpress-ecommerce,代码行数:67,代码来源:class-wc360-shortcode.php
示例8: do_payment
function do_payment($payment_id, $member_id, $product_id, $price, $begin_date, $expire_date, &$vars)
{
global $config;
global $db;
$product =& get_product($product_id);
if (!$product->config['is_recurring']) {
return $this->do_not_recurring_payment($payment_id, $member_id, $product_id, $price, $begin_date, $expire_date, $vars);
}
$varsx = array('product_id' => $product->config['twocheckout_id'], 'sid' => $this->config['seller_id'], 'amem_payment_id' => $payment_id, 'verify' => md5($this->config['seller_id'] . $product->config['twocheckout_id'] . $price), 'c_prod' => $product_id, 'id_type' => 1, 'c_name' => $product->config['title'], 'c_description' => $product->config['title'], 'c_price' => $price, 'c_tangible' => 'N', 'merchant_order_id' => $payment_id);
$varsx['recuring'] = 'Y';
//if ($this->config['demo'] == 'Y')
// $varsx['demo'] = 'Y';
$vars1 = array();
foreach ($varsx as $kk => $vv) {
$v = urlencode($vv);
$k = urlencode($kk);
$vars1[] = "{$kk}={$vv}";
}
$varsx = join('&', $vars1);
if ($this->config['seller_id'] >= 200000 || $this->config['use_v2']) {
header($s = "Location: https://www2.2checkout.com/2co/buyer/purchase?fixed=Y&" . $varsx);
} else {
header($s = "Location: https://www.2checkout.com/cgi-bin/crbuyers/recpurchase.2c?" . $varsx);
}
return '';
}
开发者ID:subashemphasize,项目名称:test_site,代码行数:26,代码来源:twocheckout_r.inc.php
示例9: cart_get_items
function cart_get_items()
{
$items = array();
foreach ($_SESSION['cart'] as $product_id => $quantity) {
// Get product data from db
$product = get_product($product_id);
$list_price = $product['listPrice'];
$discount_percent = $product['discountPercent'];
$quantity = intval($quantity);
// Calculate discount
$discount_amount = round($list_price * ($discount_percent / 100.0), 2);
$unit_price = $list_price - $discount_amount;
$line_price = round($unit_price * $quantity, 2);
// Store data in items array
$items[$product_id]['name'] = $product['productName'];
$items[$product_id]['description'] = $product['description'];
$items[$product_id]['list_price'] = $list_price;
$items[$product_id]['discount_percent'] = $discount_percent;
$items[$product_id]['discount_amount'] = $discount_amount;
$items[$product_id]['unit_price'] = $unit_price;
$items[$product_id]['quantity'] = $quantity;
$items[$product_id]['line_price'] = $line_price;
}
return $items;
}
开发者ID:hessemanj2100,项目名称:guitar_shop,代码行数:25,代码来源:cart.php
示例10: cs_product_parceled_single
/**
* Displays the Installments on the product page.
*
* @return string Price in 3 installments.
*/
function cs_product_parceled_single()
{
$product = get_product();
?>
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<p style="margin: 0;" itemprop="price" class="price">
<?php
echo $product->get_price_html();
?>
</p>
<p>
<span style="color: #666; font-size: 100%" class="price"><?php
_e('ou até 3x de');
?>
<?php
echo cs_product_parceled();
?>
</span>
</p>
<meta itemprop="priceCurrency" content="<?php
echo get_woocommerce_currency();
?>
" />
<link itemprop="availability" href="http://schema.org/<?php
echo $product->is_in_stock() ? 'InStock' : 'OutOfStock';
?>
" />
</div>
<?php
}
开发者ID:zerocowl,项目名称:desventuras,代码行数:37,代码来源:plg_parcela.php
示例11: validate_add_cart_item
public function validate_add_cart_item($passed, $product_id, $qty)
{
$product = get_product($product_id);
if ($product->product_type !== 'trip') {
return $passed;
}
$stockOk = false;
foreach ($this->package_types as $package) {
if (isset($_POST['wc_trip_' . $package . "_package"])) {
$post = $_POST['wc_trip_' . $package . "_package"];
$stockCheck = $product->check_package_stock($package, $post);
if ($stockCheck) {
$stockOk = true;
} else {
wc_add_notice("Sorry, " . $post . " is out of stock", 'error');
return false;
}
}
}
if ($stockOk) {
return true;
} else {
wc_add_notice("Couldn't find specified packages, try again", 'error');
return false;
}
}
开发者ID:NerdyDillinger,项目名称:ovrride,代码行数:26,代码来源:class-wc-trips-cart.php
示例12: renew_handler
/**
* Handle a renewal url
*/
public function renew_handler()
{
if (!empty($_GET['renew_licence']) && is_user_logged_in()) {
global $wpdb;
$licence_key = sanitize_text_field($_GET['renew_licence']);
$licence = $wpdb->get_row($wpdb->prepare("\n\t\t\t\tSELECT * FROM {$wpdb->prefix}wp_plugin_licencing_licences\n\t\t\t\tWHERE licence_key = %s\n\t\t\t\tAND ( user_id = %d OR user_id = 0 )\n\t\t\t", $licence_key, get_current_user_id()));
// Renewable?
if (!$licence) {
wc_add_notice(__('Invalid licence', 'wp-plugin-licencing'), 'error');
return;
}
if (!$licence->date_expires || strtotime($licence->date_expires) > current_time('timestamp')) {
wc_add_notice(__('This licence does not need to be renewed yet', 'wp-plugin-licencing'), 'notice');
return;
}
// Purchasable?
$product = get_product($licence->product_id);
if (!$product->is_purchasable()) {
wc_add_notice(__('This product can no longer be purchased', 'wp-plugin-licencing'), 'error');
return;
}
// Add to cart
WC()->cart->empty_cart();
WC()->cart->add_to_cart($licence->product_id, 1, '', '', array('renewing_key' => $licence_key));
// Message
wc_add_notice(sprintf(__('The product has been added to your cart with a %d%% discount.', 'wp-plugin-licencing'), apply_filters('wp_plugin_licencing_renewal_discount_percent', 30)), 'success');
// Redirect to checkout
wp_redirect(get_permalink(wc_get_page_id('checkout')));
exit;
}
}
开发者ID:ChromeOrange,项目名称:wp-plugin-licencing,代码行数:34,代码来源:class-wp-plugin-licencing-renewals.php
示例13: do_payment
function do_payment($payment_id, $member_id, $product_id, $price, $begin_date, $expire_date, &$vars)
{
global $config, $db, $plugin_config;
$payment = $db->get_payment($payment_id);
$member = $db->get_user($member_id);
$product =& get_product($product_id);
$this_config = $plugin_config['payment']['gate2shop'];
if ($this_config['testing']) {
// currently HTTP POST requests use version=3.0.0 while HTTP GET requests use version=1.0.0
$version = '1.0.0';
} else {
$version = '3.0.0';
}
$time_stamp = gmdate("Y-m-d.H:i:s");
// current GMT time in the following format: YYYY-MM-DD.HH:MM:SS
$vars = array('version' => $version, 'merchant_id' => $this_config['merchant_id'], 'merchant_site_id' => $this_config['site_id'], 'currency' => $product->config['gate2shop_currency'] ? $product->config['gate2shop_currency'] : 'USD', 'numberofitems' => '1', 'item_name_1' => $product->config['title'], 'item_amount_1' => $product->config['price'], 'item_quantity_1' => 1, 'total_amount' => $price, 'time_stamp' => $time_stamp, 'total_tax' => $payment['data']['TAX_AMOUNT'], 'productId' => $product_id, 'merchantLocale' => 'en_US', 'userid' => $member['member_id'], 'first_name' => $member['name_f'], 'last_name' => $member['name_l'], 'address1' => $member['street'], 'city' => $member['city'], 'state' => $member['state'], 'country' => $member['country'], 'zip' => $member['zip'], 'email' => $member['email'], 'invoice_id' => $payment['payment_id'] . "-" . $this->get_rand(3), 'customField1' => $payment['payment_id'], 'customData' => $payment['payment_id']);
$vars['checksum'] = md5($this_config['secret'] . $vars['merchant_id'] . $vars['currency'] . $vars['total_amount'] . $vars['item_name_1'] . $vars['item_amount_1'] . $vars['item_quantity_1'] . $vars['time_stamp']);
if ($this_config['method'] == 'GET') {
$this->encode_and_redirect('https://secure.Gate2Shop.com/ppp/purchase.do', $vars);
exit;
} else {
$t =& new_smarty();
$t->assign('vars', $vars);
$t->display(str_replace("c:\\", '/', dirname(__FILE__) . '/form.html'));
exit;
}
}
开发者ID:subashemphasize,项目名称:test_site,代码行数:27,代码来源:gate2shop.inc.php
示例14: wcs_is_product_switchable_type
/**
* Checks if a given product is of a switchable type
*
* @param int|WC_Product $product A WC_Product object or the ID of a product to check
* @return bool
* @since 2.0
*/
function wcs_is_product_switchable_type($product)
{
if (!is_object($product)) {
$product = get_product($product);
}
if (empty($product)) {
$is_product_switchable = false;
} else {
$allow_switching = get_option(WC_Subscriptions_Admin::$option_prefix . '_allow_switching', 'no');
switch ($allow_switching) {
case 'variable':
$is_product_switchable = $product->is_type(array('variable-subscription', 'subscription_variation')) ? true : false;
break;
case 'grouped':
$is_product_switchable = 0 !== $product->post->post_parent ? true : false;
break;
case 'variable_grouped':
$is_product_switchable = $product->is_type(array('variable-subscription', 'subscription_variation')) || 0 !== $product->post->post_parent ? true : false;
break;
case 'no':
default:
$is_product_switchable = false;
break;
}
}
return apply_filters('wcs_is_product_switchable', $is_product_switchable, $product);
}
开发者ID:slavic18,项目名称:cats,代码行数:34,代码来源:wcs-switch-functions.php
示例15: do_payment
function do_payment($payment_id, $member_id, $product_id, $price, $begin_date, $expire_date, &$vars)
{
global $config, $db;
$products = $product_id;
$orig_product_id = $product_id;
if (is_array($product_id)) {
$product_id = $product_id[0];
}
$product =& get_product($product_id);
if (count($orig_product_id) > 1) {
$product->config['title'] = $config['multi_title'];
}
$member = $db->get_user($member_id);
if (preg_match('/^\\d\\d\\d\\d-\\d\\d-\\d\\d$/', $product->config['start_date'])) {
$begin_date = $product->config['start_date'];
} else {
$begin_date = date('Y-m-d');
}
if (true || $product->config['is_recurring']) {
// only subscriptions (for reason of Trials), if not recurring will use cycles == 1
$vars = array("_ipn_act" => "_ipn_subscription", "fid" => "", "itestmode" => $this->config['testmode'] ? "on" : "off", "notifyURL" => $config['root_url'] . "/plugins/payment/safepay/ipn.php", "returnURL" => sprintf("%s/thanks.php?member_id=%d&product_id=%d", $config['root_url'], $member_id, $product_id), "cancelURL" => $config['root_url'] . "/cancel.php", "notifyEml" => $this->config['notifyEml'], "iowner" => $this->config['owner'], "ireceiver" => $this->config['owner'], "iamount" => sprintf('%.2f', $price), "itemName" => $product->config['title'], "itemNum" => "1", "idescr" => $product->config['description'], "cycleLength" => $product->config['expire_days'] ? get_date_day_diff(time(), strtotime($product->get_expire($begin_date, 'expire_days'))) : '0', "cycles" => $product->config['is_recurring'] ? "0" : "1", "trialPeriod" => $product->config['trial1_days'] ? get_date_day_diff(time(), strtotime($product->get_expire($begin_date, 'trial1_days'))) : '0', "trialCycles" => "1", "trialAmount" => $product->config['trial1_price'], "idelivery" => "1", "iquantity" => "1", "imultiplyPurchase" => "n", "custom1" => $payment_id, "custom2" => "", "custom3" => "", "custom4" => "", "custom5" => "", "colortheme" => "");
} else {
// DISABLED! (no Trials support here)
$vars = array("_ipn_act" => "_ipn_payment", "fid" => "", "itestmode" => $this->config['testmode'] ? "on" : "off", "notifyURL" => $config['root_url'] . "/plugins/payment/safepay/ipn.php", "returnURL" => sprintf("%s/thanks.php?member_id=%d&product_id=%d", $config['root_url'], $member_id, $product_id), "cancelURL" => $config['root_url'] . "/cancel.php", "notifyEml" => $this->config['notifyEml'], "iowner" => $this->config['owner'], "ireceiver" => $this->config['owner'], "iamount" => sprintf('%.2f', $price), "itemName" => $product->config['title'], "itemNum" => "1", "idescr" => $product->config['description'], "idelivery" => "1", "iquantity" => "1", "imultiplyPurchase" => "n", "custom1" => $payment_id, "custom2" => "", "custom3" => "", "custom4" => "", "custom5" => "", "colortheme" => "");
}
$vars1 = array();
foreach ($vars as $kk => $vv) {
$v = urlencode($vv);
$k = urlencode($kk);
$vars1[] = "{$k}={$v}";
}
$vars = join('&', $vars1);
html_redirect("https://www.safepaysolutions.com/index.php?{$vars}", '', 'Please wait', 'Please wait');
exit;
}
开发者ID:subashemphasize,项目名称:test_site,代码行数:35,代码来源:safepay.inc.php
示例16: do_payment
function do_payment($payment_id, $member_id, $product_id, $price, $begin_date, $expire_date, &$vars)
{
global $config, $db;
$products = $product_id;
$orig_product_id = $product_id;
if (is_array($product_id)) {
$product_id = $product_id[0];
}
$product =& get_product($product_id);
if (count($orig_product_id) > 1) {
$product->config['title'] = $config['multi_title'];
}
$member = $db->get_user($member_id);
$vars = array('pay_to_email' => $this->config['business'], 'pay_from_email' => $member['email'], 'transaction_id' => $payment_id, 'return_url' => sprintf("%s/thanks.php?payment_id=%d", $config['root_url'], $payment_id), 'cancel_url' => $config['root_url'] . "/cancel.php", 'status_url' => $config['root_url'] . "/plugins/payment/moneybookers/ipn.php", 'amount' => sprintf('%.2f', $price), 'detail1_text' => $product->config['title'], 'firstname' => $member['name_f'], 'lastname' => $member['name_l'], 'address' => $member['street'], 'postal_code' => $member['zip'], 'city' => $member['city'], 'state' => $member['state'], 'country' => $member['country']);
// add currency code
if (strlen($product->config['moneybookers_currency'])) {
$vars['currency'] = $product->config['moneybookers_currency'];
} else {
$vars['currency'] = 'USD';
}
if ($product->config['is_recurring']) {
unset($vars['amount']);
$vars += array('rec_amount' => sprintf('%.2f', $price), 'rec_cycle' => "day", 'rec_period' => $this->get_days($product->config['expire_days']));
}
$vars1 = array();
foreach ($vars as $kk => $vv) {
$v = urlencode($vv);
$k = urlencode($kk);
$vars1[] = "{$k}={$v}";
}
$vars = join('&', $vars1);
header("Location: https://www.moneybookers.com/app/payment.pl?{$vars}");
exit;
}
开发者ID:subashemphasize,项目名称:test_site,代码行数:34,代码来源:moneybookers.inc.php
示例17: getAllReviews
protected function getAllReviews()
{
global $wpdb;
$query = "SELECT comment_post_ID AS product_id, \n\t\t\t\t\t\t comment_author AS display_name, \n\t\t\t\t\t\t comment_date AS date,\n\t\t\t\t\t\t comment_author_email AS user_email, \n\t\t\t\t\t\t comment_content AS review_content, \n\t\t\t\t\t\t meta_value AS review_score,\n\t\t\t\t\t\t post_content AS product_description,\n\t\t\t\t\t\t post_title AS product_title,\n\t\t\t\t\t\t user_id\n\t\t\t\t FROM `" . $wpdb->prefix . "comments` \n\t\t\t\t INNER JOIN `" . $wpdb->prefix . "posts` ON `" . $wpdb->prefix . "posts`.`ID` = `" . $wpdb->prefix . "comments`.`comment_post_ID` \n\t\t\t\t INNER JOIN `" . $wpdb->prefix . "commentmeta` ON `" . $wpdb->prefix . "commentmeta`.`comment_id` = `" . $wpdb->prefix . "comments`.`comment_ID` \n\t\t\t\t WHERE `post_type` = 'product' AND meta_key='rating'";
$results = $wpdb->get_results($query);
$all_reviews = array();
foreach ($results as $value) {
$product_instance = get_product($value->product_id);
$current_review = array();
$review_content = $this->cleanContent($value->review_content);
$current_review['review_title'] = $this->getFirstWords($review_content);
$current_review['review_content'] = $review_content;
$current_review['display_name'] = $this->cleanContent($value->display_name);
$current_review['user_email'] = $value->user_email;
$current_review['user_type'] = woocommerce_customer_bought_product($value->user_email, $value->user_id, $value->product_id) ? 'verified_buyer' : '';
$current_review['review_score'] = $value->review_score;
$current_review['date'] = $value->date;
$current_review['sku'] = $value->product_id;
$current_review['product_title'] = $this->cleanContent($value->product_title);
$current_review['product_description'] = $this->cleanContent($product_instance->get_post_data()->post_excerpt);
$current_review['product_url'] = get_permalink($value->product_id);
$current_review['product_image_url'] = wc_yotpo_get_product_image_url($value->product_id);
$all_reviews[] = $current_review;
}
return $all_reviews;
}
开发者ID:brian3t,项目名称:orchidmate,代码行数:26,代码来源:class-wc-yotpo-export-reviews.php
示例18: custom_override_checkout_fields
function custom_override_checkout_fields($fields)
{
global $woocommerce;
$hasPhysicalProduct = false;
if (!empty($woocommerce->cart->cart_contents)) {
// Cart is not empty, now loop through the cart
$cart = $woocommerce->cart->get_cart();
foreach ($cart as $key => $values) {
$_product = get_product($values['variation_id'] ? $values['variation_id'] : $values['product_id']);
if (!empty($_product) && $_product->exists() && $values['quantity'] > 0) {
if ($_product->virtual == 'no' && $_product->downloadable == 'no') {
$hasPhysicalProduct = true;
}
}
}
}
if ($hasPhysicalProduct == false) {
unset($fields['billing']['billing_address_1']);
unset($fields['billing']['billing_address_2']);
unset($fields['billing']['billing_company']);
unset($fields['billing']['billing_city']);
unset($fields['billing']['billing_postcode']);
unset($fields['billing']['billing_country']);
unset($fields['billing']['billing_state']);
unset($fields['billing']['billing_phone']);
}
return $fields;
}
开发者ID:EliasGoldberg,项目名称:troop-sim,代码行数:28,代码来源:woocommerce-checkout-downloads.php
示例19: wcva_register_my_scripts
public function wcva_register_my_scripts()
{
global $post, $product;
if (!$post) {
return;
}
$displaytypenumber = 0;
$product = get_product($post->ID);
if (is_product()) {
$displaytypenumber = wcva_return_displaytype_number($product, $post);
}
wp_register_style('wcva-frontend', wcva_PLUGIN_URL . 'css/front-end.css');
$goahead = 1;
if (isset($_SERVER['HTTP_USER_AGENT'])) {
$agent = $_SERVER['HTTP_USER_AGENT'];
}
if (preg_match('/(?i)msie [5-8]/', $agent)) {
$goahead = 0;
}
if ($displaytypenumber > 0 && $goahead == 1) {
wp_deregister_script('wc-add-to-cart-variation');
wp_dequeue_script('wc-add-to-cart-variation');
wp_register_script('wc-add-to-cart-variation', wcva_PLUGIN_URL . 'js/manage-variation-selection.js', array('jquery'), false, true);
}
if (is_product()) {
if ($displaytypenumber > 0 && $goahead == 1) {
wp_enqueue_script('wc-add-to-cart-variation');
}
wp_enqueue_style('wcva-frontend');
}
}
开发者ID:rinodung,项目名称:live-theme,代码行数:31,代码来源:class_wcva_register_scripts_styles.php
示例20: get_all_image_ids
public function get_all_image_ids($id)
{
$allImages = array();
$show_gallery = false;
if (has_post_thumbnail($id)) {
$allImages[] = get_post_thumbnail_id($id);
} else {
$prod = get_post($id);
$prodParentId = $prod->post_parent;
if ($prodParentId && has_post_thumbnail($prodParentId)) {
$allImages[] = get_post_thumbnail_id($prodParentId);
} else {
$allImages[] = 'placeholder';
}
$show_gallery = true;
}
if (get_post_type($id) == 'product_variation') {
$wtAttachments = array_filter(explode(',', get_post_meta($id, '_wpb_variation_images', true)));
$allImages = array_merge($allImages, $wtAttachments);
}
if (get_post_type($id) == 'product' || $show_gallery) {
$product = get_product($id);
$attachIds = $product->get_gallery_attachment_ids();
if (!empty($attachIds)) {
$allImages = array_merge($allImages, $attachIds);
}
}
return $allImages;
}
开发者ID:shirso,项目名称:wc-product-builder,代码行数:29,代码来源:class-common-functions.php
注:本文中的get_product函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论