/** * Add to cart shortcode * * Usage example: [wpsc-add-to-cart id="35"] * * Available attributes: * - id: Post ID of the product for which you want to display the add to cart form * @param array $atts Attributes * @return string Output */ function _wpsc_shortcode_add_to_cart($atts) { $defaults = array('id' => 0); $atts = array_map('absint', shortcode_atts($defaults, $atts)); if (empty($atts['id'])) { return ''; } return wpsc_get_add_to_cart_form($atts['id']); }
/** * Echo the HTML output for the Add to cart form * * @since 0.1 * @uses wpsc_get_add_to_cart_form() Get the HTML for the form * @param int $id Optional. Product ID. Defaults to the current product in the loop */ function wpsc_add_to_cart_form($id = null) { echo wpsc_get_add_to_cart_form($id); }