public static function get_instance()
 {
     if (empty(self::$instance)) {
         self::$instance = new WPSC_Cart_Item_Table();
     }
     return self::$instance;
 }
    protected function cart_item_description($item, $key)
    {
        parent::cart_item_description($item, $key);
        if (!$this->log->is_transaction_completed()) {
            return;
        }
        $links = _wpsc_get_cart_item_downloadable_links($item, $this->log);
        ?>
		<div class="wpsc-cart-item-downloadable">
<?php 
        if (count($links) === 1) {
            ?>
			<strong><?php 
            esc_html_e('Download link: ', 'wp-e-commerce');
            ?>
</strong><br />
			<a href="<?php 
            echo esc_url($links[0]['url']);
            ?>
"><?php 
            echo esc_html($links[0]['name']);
            ?>
</a>
<?php 
        } else {
            ?>
			<strong><?php 
            esc_html_e('Digital Contents', 'wp-e-commerce');
            ?>
</strong>
			<ul>
<?php 
            foreach ($links as $link) {
                ?>
				<li><a href="<?php 
                echo esc_url($link['url']);
                ?>
"><?php 
                echo esc_html($link['name']);
                ?>
</a></li>
<?php 
            }
            ?>
			</ul>
<?php 
        }
        ?>
		</div>
<?php 
    }
Example #3
0
/**
 * Cart shortcode.
 *
 * Usage example: [wpsc-cart type="widget"]
 *
 * Available attributes:
 * 	- 'type': Can be set to 'form', 'widget', 'table'.
 * 	          'form' would display similarly to the Shopping Cart page
 * 	          'widget' would display similarly to the Cart widget
 * 	          'table' would display a plain table of items without form
 *
 * @param  array $atts    Attributes
 * @return string         Shortcode output
 */
function _wpsc_shortcode_cart($atts)
{
    global $wpsc_cart;
    ob_start();
    $defaults = array('type' => 'form');
    $atts = shortcode_atts($defaults, $atts, 'wpsc-cart');
    require_once WPSC_TE_V2_CLASSES_PATH . '/cart-item-table-widget-form.php';
    if (!count($wpsc_cart->cart_items)) {
        return '<p>' . __('No items in cart.', 'wp-e-commerce') . '</p>';
    }
    switch ($atts['type']) {
        case 'form':
            $table = new WPSC_Cart_Item_Table_Form();
            break;
        case 'widget':
            $table = new WPSC_Cart_Item_Table_Widget_Form();
            break;
        case 'table':
            $table = new WPSC_Cart_Item_Table();
            break;
    }
    $table->display();
    return ob_get_clean();
}
    protected function cart_item_description($item, $key)
    {
        $remove_url = add_query_arg('_wp_nonce', wp_create_nonce("wpsc-remove-cart-item-{$key}"), wpsc_get_cart_url('remove/' . absint($key)));
        ?>
		<div class="wpsc-cart-item-row-actions">
			<a alt="<?php 
        esc_attr_e('Remove from cart', 'wp-e-commerce');
        ?>
" class="wpsc-button wpsc-button-mini" href="<?php 
        echo esc_url($remove_url);
        ?>
"><i class="wpsc-icon-trash"></i> <?php 
        esc_html_e('Remove', 'wp-e-commerce');
        ?>
</a>
		</div>
		<?php 
        parent::cart_item_description($item, $key);
    }
Example #5
0
function wpsc_get_checkout_order_preview()
{
    require_once WPSC_TE_V2_CLASSES_PATH . '/cart-item-table.php';
    $cart_item_table = WPSC_Cart_Item_Table::get_instance();
    ob_start();
    $cart_item_table->display();
    return apply_filters('wpsc_get_checkout_order_preview', ob_get_clean());
}