Използвам joomla 2.5 и virtuemart 2. Опитах се да повторя скрипт, който е изграден от php. Така че вътре в файла с количката във функцията foreach, която минава през всеки продукт, който трябва да запазя в променлив идентификатор на продукта, количество и продажна цена.
Мога да покажа идентификатора на продукта и количеството така:
$wantedproductid = $product->virtuemart_product_id;
$wantedproductquantity = $product->quantity;
но имам проблем с цената. Повторих $this
и получавам това:
VirtueMartCart Object
(
[products] => Array
(
[812] => stdClass Object
(
[virtuemart_manufacturer_id] => 11
[slug] => hill-s-puppy-healthy-development-large-breed-koutavia-anaptyksi-kotopoulo-11kg
[published] => 1
...
...
[pricesUnformatted] => Array
(
[basePrice] => 70.6
[basePriceWithTax] => 0
[discountedPriceWithoutTax] => 60.31
[salesPrice] => 60.31
[taxAmount] => 0
[salesPriceWithDiscount] => 60.31
[discountAmount] => 57.4
[priceWithoutTax] => 70.6
[subTotalProducts] => 0
[2Diff] => -9.585
[812] => Array
(
[costPrice] => 63.90000
[basePrice] => 63.9
[basePriceVariant] => 63.9
[basePriceWithTax] => 0
[discountedPriceWithoutTax] => 54.32
[priceBeforeTax] => 63.9
[salesPrice] => 54.32
[taxAmount] => 0
[salesPriceWithDiscount] => 54.32
[salesPriceTemp] => 54.32
[unitPrice] => 0
[discountAmount] => 14.99
[priceWithoutTax] => 63.9
[variantModification] => 0
...
...
Това, от което се нуждая, е например тази стойност: [salesPrice] => 54.32
Как мога да запазя [salesPrice]
в стойност?