Adding items in cart to page

HomeSupportImage StoreAdding items in cart to page

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #256388
    totallytech
    Participant

    Hey,

    I’ve been rrying to get a section on my site showing either: Items in basket: XX or Your basket is empty.

    I’ve found this but its showing Your cart is empty no matter how much is in the cart…

    Any ideas how to pull this info out?

    echo "<header class='clearfix art-header-image-store'>";
    			$cart = $_SESSION['wfcart'];
    			$count=0;
    			foreach($cart->items as $item){
    				$count+= $cart->itemqtys[$item];
    			}
    			if ($count != '0') {
    			echo "<a href='http://clients.iwphoto.co.uk/shopping-basket/' title='View Shopping Basket' alt='View Shopping Basket' />" . "Items in Basket: ". $count ."</a>";
    			} else { echo "Your shopping basket is empty."; }
    		echo "</header>"; 

    I’m assuming that $cart = $_SESSION[‘wfcart’]; is not correct, but I cannot find out where it is storing the number of items in the cart?

    #256957
    Xpark Media
    Keymaster

    @totallytech,

    you can access the entire cart data using the global $variable $ImStoreCart (object);

    To check if there is items in the cart use:

    if( !empty( $ImStoreCart->cart->items ){
       // do something here
    }

    to display the number of items in the cart:
    echo $ImStoreCart->cart->items

    #257209
    totallytech
    Participant

    Thank you 🙂

    I’ve added this code

    if (!empty($ImStoreCart->cart->items)) {
    			$count = $ImStoreCart->cart->items;
    			echo "Items in Basket: ". $count;
    		} else { 
    			echo "Your shopping basket is empty."; 
    		}

    however it always shows the shopping basket is empty even if it isnt.

    any ideas?

    #257219
    totallytech
    Participant

    Is there a list of variables that we can call?

    For example I have changed the single photo page layout slightly – http://goo.gl/MLgo1j

    It shows the Gallery Name -> Photo Name

    [Image] [Sidebar]
    [products]

    but I cannot work out how to find out the hyperlink for the gallery name.

    Plus, the link for [photos] [slideshow] [prices] [checkout] will all need adding.
    Is there a simple ‘$ImStoreCart->cart->checkout’ type code for each section?

    #257599
    Xpark Media
    Keymaster

    @totallytech,

    The “tools widget” removed the regular navigation and gives you a widget wit all tools that you can use in the sidebar.

    You can also create a page that you can use as a checkout page. using the shortcode

    [image-store car=true]

    for the car all you have to do is include the global object into scope just before your code use: global $ImStoreCart;

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.