function wp_cart_button_handler($atts) { extract(shortcode_atts(array('name' => '', 'price' => '', 'shipping' => '0'), $atts)); if (empty($name)) { return '<div style="color:red;">Error! You must specify a product name in the shortcode.</div>'; } if (empty($price)) { return '<div style="color:red;">Error! You must specify a price for your product in the shortcode.</div>'; } return print_wp_cart_button_for_product($name, $price, $shipping); }
function wp_cart_display_product_handler($atts) { extract(shortcode_atts(array('name' => '', 'item_number' => '', 'price' => '', 'shipping' => '0', 'var1' => '', 'var2' => '', 'var3' => '', 'thumbnail' => '', 'thumb_target' => '', 'description' => '', 'button_image' => '', 'file_url' => '', 'stamp_pdf' => ''), $atts)); if (empty($name)) { return '<div style="color:red;">' . __("Error! You must specify a product name in the shortcode.", "wordpress-simple-paypal-shopping-cart") . '</div>'; } if (empty($price)) { return '<div style="color:red;">' . __("Error! You must specify a price for your product in the shortcode.", "wordpress-simple-paypal-shopping-cart") . '</div>'; } if (empty($thumbnail)) { return '<div style="color:red;">' . __("Error! You must specify a thumbnail image for your product in the shortcode.", "wordpress-simple-paypal-shopping-cart") . '</div>'; } $price = wspsc_strip_char_from_price_amount($price); $shipping = wspsc_strip_char_from_price_amount($shipping); $thumbnail_code = '<img src="' . $thumbnail . '">'; if (!empty($thumb_target) && preg_match("/http/", $thumb_target)) { $thumbnail_code = '<a href="' . $thumb_target . '"><img src="' . $thumbnail . '"></a>'; } $thumbnail_code = apply_filters('wspsc_product_box_thumbnail_code', $thumbnail_code, $atts); $currency_symbol = get_option('cart_currency_symbol'); $formatted_price = print_payment_currency($price, $currency_symbol); $button_code = print_wp_cart_button_for_product($name, $price, $shipping, $var1, $var2, $var3, $atts); $display_code = <<<EOT <div class="wp_cart_product_display_box"> <div class="wp_cart_product_thumbnail"> {$thumbnail_code} </div> <div class="wp_cart_product_display_bottom"> <div class="wp_cart_product_name"> {$name} </div> <div class="wp_cart_product_description"> {$description} </div> <div class="wp_cart_product_price"> {$formatted_price} </div> <div class="wp_cart_product_button"> {$button_code} </div> </div> </div> EOT; return $display_code; }
<!-- The spinner is displayed while the form is being sent via AJAX --> <div class="registrationsTEC-spinner"> <img title="Tribe Loading Animation Image" alt="Tribe Loading Animation Image" class="tribe-events-spinner-medium" src=<?php echo plugins_url() . "/the-events-calendar/src/resources/images/tribe-loading.gif"; ?> > </div> <p id="registrationsTEC-success-message" class="success-message tribe-events-notices">Success! Check your email for a confirmation message.</p> <!-- Show the "add to cart" button for users to pay with PayPal after registration only if WP Simple PayPal Cart is installed --> <?php if (defined('WP_CART_VERSION')) { ?> <div id="registrationsTEC-payment-wrapper" class="tribe-events-notices"> <p>Click the button below to pay your registration fee</p> <div> <?php $product = "Registration fee for " . get_the_title() . " on " . tribe_get_start_date(); $cost = tribe_get_cost(); echo print_wp_cart_button_for_product($product, $cost); ?> </div> </div> <?php } // WP PayPal cart is installed