Viewing 12 replies - 16 through 27 (of 27 total)
  • When I put this code where I want the total items to appear, I get this error: Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\wordpress\wp-content\plugins\exec-php\includes\runtime.php(42) : eval()’d code on line 13 0.

    Plugin Author bluey80

    (@bluey80)

    You probably have a typo in the code — can you paste your exact php code.

    Im putting this on the store page so it says something like “you have this many items in your shopping cart”.

    <?php
    $cart = $_SESSION['wfcart'];
    $count=0;
    foreach($cart->items as $item){
        $count+= intval($cart->itemqtys[$item]);
    }
    echo $count;
    ?>
    Plugin Author bluey80

    (@bluey80)

    Where are you placing this code? Try

    $cart = $_SESSION['wfcart'];
    print_r($cart);

    and send the output. It looks like it isn’t getting the cart data would be my guess.

    I’m putting it at the top of a WordPress page.

    $cart = $_SESSION['wfcart'];
    print_r($cart);

    comes up with no output?

    Thanks so much for your help ??

    Plugin Author bluey80

    (@bluey80)

    This is php — it shouldn’t go in a wordpress page but in the plugin code. Take a look at SCABN’s templates/default.php for some examples and making your own template that has custom php code.

    Where do I find SCABN’s templates?

    And would there be a shortcode to call the total number of items on a WordPress page?

    Plugin Author bluey80

    (@bluey80)

    In your filesystem, under WordPress install directory will be
    wp-content/plugins/simple-cart-buy-now/templates/default.php

    There isn’t a shortcode for the total number of items, although you could add one. What v8s_uk did was put that number in the shopping cart output.

    Im using WordPress Simple Paypal Shopping Cart, not the Simple Cart Buy Now. I’m sorry I’m not super good at this stuff. How could I add a shortcode for the total items for WordPress Simple Paypal Shopping Cart?

    Plugin Author bluey80

    (@bluey80)

    You should ask in the forum for WordPress Simple Paypal Shopping Cart

    Oh my. I’m so sorry. I thought this was for the same plugin. I do have a post there. This is what I get for not sleeping for a few days. Sigh.

Viewing 12 replies - 16 through 27 (of 27 total)
  • The topic ‘Simple Show Number Of Items In Cart?’ is closed to new replies.