Forums

[resolved] Call a wp e-commerce variable (4 posts)

  1. dunskii
    Member
    Posted 1 year ago #

    Hi all,
    Just wondering if there is an easy way to call wp e-commerce session variables.
    I basically want to have a real basic cart that only shows qty and total if the user isn't on a shop page.
    cheers,
    d

  2. dunskii
    Member
    Posted 1 year ago #

    Never mind I solved it. Just had to find the right bits of the shopping_cart_functions.php file
    D

    FYI (note i haven't added shipping)
    To get QTY
    $cart = $_SESSION['nzshpcrt_cart'];
    $cart_count = 0;

    foreach((array)$cart as $item) {

    $cart_count += $item->quantity;

    }
    echo $cart_count;

    To get sub total
    foreach($cart as $cart_item) {

    $product_id = $cart_item->product_id;

    $quantity = $cart_item->quantity;
    $price = $quantity * calculate_product_price($product_id, $cart_item->product_variations,'stay',$cart_item->extras);
    $total += $price;
    }
    echo nzshpcrt_currency_display(($total), 1);

  3. bzmillerboy
    Member
    Posted 8 months ago #

    I'm trying to the the same thing but I'm not fully following your code above, can someone help with the details? Thanks!

    http://brianandlindsaymiller.com/hardwalking/product

  4. jtmink1
    Member
    Posted 2 months ago #

    I believe this will give you what your looking for:

    <?php echo(wpsc_cart_total()); ?>
    <?php echo(wpsc_cart_item_count()); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic