2016-06-11 60 views
0

我使用joomla 2.5和virtuemart 2.我試圖迴應一個腳本,它是從PHP構建的。 那麼經過每個產品的foreach函數裏面的cart文件我需要保存到一個可變的產品id,數量和銷售價格。virtmart購物車中產品的回聲價格

我可以顯示產品ID和數量如下:

$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]的價值呢?

回答

0

這應該做的伎倆:

echo $this->pricesUnformatted['salesPrice'] 
+0

謝謝你的幫助!正確答案:$ product-> product_price –

0

這是錯誤的,我以前不工作,不回答也不回答下面的評論。 這工作:

echo $this->cart->pricesUnformatted[$wantedproductid]['salesPrice']; 

,但它顯示的銷售價格只有車不是每個產品的最新產品。該foreach條件正常工作

+0

你說得對。第一個響應不起作用,你的工作,但你只告訴最後一個產品。有任何想法嗎? –

相關問題