Poniżej krótki kod dla wyświetlenie elementów obiektu Jcart.
<?php $koszyk=$_SESSION['jcart']; ?>
A oto wynik wyświetlenia:
object(Jcart)#1 (8) {
["config"]=>
array(12) {
["jcartPath"]=>
string(6) "jcart/"
["checkoutPath"]=>
string(14) "./checkout.php"
["item"]=>
array(7) {
["id"]=>
string(10) "my-item-id"
["name"]=>
string(12) "my-item-name"
["price"]=>
string(13) "my-item-price"
["qty"]=>
string(11) "my-item-qty"
["url"]=>
string(11) "my-item-url"
["obrazek"]=>
string(15) "my-item-obrazek"
["add"]=>
string(13) "my-add-button"
}
["paypal"]=>
array(5) {
["id"]=>
string(38) "seller_1282188508_biz@conceptlogic.com"
["https"]=>
bool(true)
["sandbox"]=>
bool(false)
["returnUrl"]=>
string(0) ""
["notifyUrl"]=>
string(0) ""
}
["currencyCode"]=>
string(3) "PLN"
["csrfToken"]=>
bool(false)
["text"]=>
array(14) {
["cartTitle"]=>
string(12) "Twój koszyk"
["singleItem"]=>
string(7) "Produkt"
["multipleItems"]=>
string(10) "Produktów"
["subtotal"]=>
string(4) "Suma"
["update"]=>
string(8) "Przelicz"
["checkout"]=>
string(3) "Kup"
["checkoutPaypal"]=>
string(28) "Kup za pośrednictwem PayPal"
["removeLink"]=>
string(5) "Usuń"
["emptyButton"]=>
string(9) "Wyczyść"
["emptyMessage"]=>
string(23) "Twój koszyk jest pusty"
["itemAdded"]=>
string(6) "Dodano"
["priceError"]=>
string(25) "Niewłaściwy format ceny"
["quantityError"]=>
string(38) "Wartość musi być liczbą całowitą"
["checkoutError"]=>
string(41) "Wystąpiły problemy z Twoim zamówieniem"
}
["button"]=>
array(4) {
["checkout"]=>
string(0) ""
["paypal"]=>
string(0) ""
["update"]=>
string(0) ""
["empty"]=>
string(0) ""
}
["tooltip"]=>
bool(true)
["decimalQtys"]=>
bool(false)
["decimalPlaces"]=>
int(1)
["priceFormat"]=>
array(3) {
["decimals"]=>
int(2)
["dec_point"]=>
string(1) "."
["thousands_sep"]=>
string(1) ","
}
}
["items:private"]=>
array(2) {
[0]=>
string(1) "2"
[1]=>
string(1) "1"
}
["names:private"]=>
array(2) {
[2]=>
string(9) "Bułeczka"
[1]=>
string(7) "Chlebek"
}
["prices:private"]=>
array(2) {
[2]=>
string(4) "0.50"
[1]=>
string(4) "1.00"
}
["qtys:private"]=>
array(2) {
[2]=>
string(1) "2"
[1]=>
string(1) "3"
}
["urls:private"]=>
array(2) {
[2]=>
string(25) "jcart/images/buleczka.jpg"
[1]=>
string(0) ""
}
["subtotal:private"]=>
float(4)
["itemCount:private"]=>
int(5)
}
Pytanie:
Jak wyciągnąć element "Bułeczka" z tego obiektu. Niestety nie potrafię skonstruować odpowiedniego odwołania.