Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8746389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:11:09+00:00 2026-06-13T12:11:09+00:00

I found this peice of php which prints out an array from the vm

  • 0

I found this peice of php which prints out an array from the vm session:

<?php print_r(unserialize($_SESSION['__vm']['vmcart'])); ?>

thiss is the array which is printed out:

stdClass Object
(
[products] =&gt; Array
    (
        [1] =&gt; stdClass Object
            (
                [virtuemart_manufacturer_id] =&gt; Array
                    (
                    )

                [slug] =&gt; basic
                [published] =&gt; 1
                [virtuemart_product_price_id] =&gt; 1
                [virtuemart_product_id] =&gt; 1
                [virtuemart_shoppergroup_id] =&gt; 
                [product_price] =&gt; 10.00000
                [override] =&gt; 
                [product_override_price] =&gt; 0.00000
                [product_tax_id] =&gt; 0
                [product_discount_id] =&gt; 0
                [product_currency] =&gt; 52
                [virtuemart_vendor_id] =&gt; 1
                [product_parent_id] =&gt; 0
                [product_sku] =&gt; 001
                [product_name] =&gt; Basic
                [product_s_desc] = d
                [product_weight] =&gt; 0.0000
                [product_weight_uom] =&gt; KG
                [product_length] =&gt; 0.0000
                [product_width] =&gt; 0.0000
                [product_height] =&gt; 0.0000
                [product_lwh_uom] =&gt; M
                [product_in_stock] =&gt; 0
                [product_ordered] =&gt; 2
                [product_sales] =&gt; 0
                [product_unit] =&gt; KG
                [product_packaging] =&gt; 0.0000
                [min_order_level] =&gt; 
                [max_order_level] =&gt; 
                [virtuemart_media_id] =&gt; Array
                    (
                    )

                [categories] =&gt; Array
                    (
                        [0] =&gt; 1
                    )

                [virtuemart_category_id] =&gt; 1
                [category_name] =&gt; Policies
                [link] =&gt; /locksure-upgrade/index.php/our-policies/policies/basic-detail
                [packaging] =&gt; 0
                [quantity] =&gt; 2
                [amount] =&gt; 2
                [url] =&gt; /locksure-upgrade/index.php/our-policies/policies/basic-detail
                [customfields] =&gt; 
                [cart_item_id] =&gt; 1
            )

    )

[vendorId] =&gt; 1
[lastVisitedCategoryId] =&gt; 0
[virtuemart_shipmentmethod_id] =&gt; 1
[virtuemart_paymentmethod_id] =&gt; 1
[automaticSelectedShipment] =&gt; 1
[automaticSelectedPayment] =&gt; 1
[order_number] =&gt; 
[BT] =&gt; Array
    (
        [company] =&gt; 
        [email] =&gt; sean@rmspr.co.uk
        [title] =&gt; 
        [first_name] =&gt; lock
        [middle_name] =&gt; 
        [last_name] =&gt; sure
        [address_1] =&gt; 20 market street
        [address_2] =&gt; 
        [zip] =&gt; wa141pf
        [city] =&gt; altrincham
        [virtuemart_country_id] =&gt; 222
        [virtuemart_state_id] =&gt; 65
        [phone_1] =&gt; 01619273131
        [phone_2] =&gt; 
        [fax] =&gt; 
    )

[ST] =&gt; 0
[tosAccepted] =&gt; 
[customer_comment] =&gt; 
[couponCode] =&gt; 
[cartData] =&gt; Array
    (
        [duty] =&gt; 1
        [payment] =&gt; 0
        [paymentName] =&gt; <span class="vmpayment_name">payment</span>
        [totalProduct] =&gt; 1
        [DBTaxRulesBill] =&gt; Array
            (
            )

        [taxRulesBill] =&gt; Array
            (
            )

        [DATaxRulesBill] =&gt; Array
            (
            )

        [shipmentName] =&gt; <span class="vmshipment_name">shipment</span>
    )

[lists] =&gt; Array
    (
        [shipTo] =&gt; 
<input name="shipto" id="shipto1" value="1" checked="checked" type="radio">
<label for="shipto1" id="shipto1-lbl" class="radiobtn"><a href="/locksure-upgrade/index.php/our-policies/user/editaddresscartBT?virtuemart_userinfo_id=1">- Default (Same as Billing)</a><br></label>

        [billTo] =&gt; 1
    )

[pricesUnformatted] =&gt; Array
    (
        [basePrice] =&gt; 20
        [basePriceWithTax] =&gt; 0
        [discountedPriceWithoutTax] =&gt; 0
        [salesPrice] =&gt; 20
        [taxAmount] =&gt; 0
        [salesPriceWithDiscount] =&gt; 0
        [discountAmount] =&gt; 0
        [priceWithoutTax] =&gt; 20
        [subTotalProducts] =&gt; 0
        [1] =&gt; Array
            (
                [costPrice] =&gt; 10.00000
                [basePrice] =&gt; 10
                [basePriceVariant] =&gt; 10
                [basePriceWithTax] =&gt; 0
                [discountedPriceWithoutTax] =&gt; 0
                [priceBeforeTax] =&gt; 10
                [salesPrice] =&gt; 10
                [taxAmount] =&gt; 0
                [salesPriceWithDiscount] =&gt; 0
                [salesPriceTemp] =&gt; 10
                [unitPrice] =&gt; 0
                [discountAmount] =&gt; 0
                [priceWithoutTax] =&gt; 10
                [variantModification] =&gt; 0
                [DBTax] =&gt; Array
                    (
                    )

                [Tax] =&gt; Array
                    (
                    )

                [VatTax] =&gt; Array
                    (
                    )

                [DATax] =&gt; Array
                    (
                    )

                [subtotal_with_tax] =&gt; 20
                [subtotal_tax_amount] =&gt; 0
                [subtotal_discount] =&gt; 0
                [subtotal] =&gt; 20
            )

        [discountBeforeTaxBill] =&gt; 0
        [withTax] =&gt; 20
        [discountAfterTax] =&gt; 20
        [shipmentValue] =&gt; 0
        [shipmentTax] =&gt; 0
        [shipmentTotal] =&gt; 0
        [salesPriceShipment] =&gt; 0
        [shipment_calc_id] =&gt; 0
        [cost] =&gt; 0
        [paymentValue] =&gt; 0
        [paymentTax] =&gt; 0
        [paymentTotal] =&gt; 0
        [salesPricePayment] =&gt; 0
        [payment_calc_id] =&gt; 0
        [billSub] =&gt; 20
        [billDiscountAmount] =&gt; 0
        [billTaxAmount] =&gt; 0
        [billTotal] =&gt; 20
    )

[pricesCurrency] =&gt; 52
[paymentCurrency] =&gt; 52
[_inCheckOut] =&gt; 1
[_dataValidated] =&gt; 
[_confirmDone] =&gt; 
[STsameAsBT] =&gt; 0
)

from that array how would i extract the amount of items in the cart? if its even possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T12:11:10+00:00Added an answer on June 13, 2026 at 12:11 pm

    Solved using the following code for anyone who needs it:

    <?php $array = unserialize($_SESSION['__vm']['vmcart']); 
    $amount = $array->products[1]->amount; 
    if ($amount != 0){ echo $amount; } else { echo 0; } ?> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been here and accordingly found out that this piece of code here var
I was looking for gz-compression in PHP and I found this piece of code:
I found (from this question - Hide div if screen is smaller than a
I'm having a problem with this piece of PHP. It's meant to print out
I found this piece of code and I'd like to understand why the developer
I have found this piece of code in the Haskell sendfile package: http://patch-tag.com/r/mae/sendfile/snapshot/current/content/pretty/src/Network/Socket/SendFile/Linux.hsc --
I use this piece of code (found on stackoverflow) to generate an OrderBy static
Found this while reading the Neo4j manual, specifically here , I found the sentence:
Found This: tyty stack, Social Icons not working with Infinite Scrolling on Wordpress I'm
found this little code snippet that seems to do what i want, but im

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.