2016-06-11 16 views
0

Ich benutze Joomla 2.5 und Virtuemart 2. Ich habe versucht, ein Skript, das aus PHP gebaut ist. So innerhalb der Kartendatei innerhalb der foreach Funktion, die durch jedes Produkt geht, muss ich zu einer variablen Produkt-ID, Quantität und Verkaufspreis speichern.Echo Preis des Produkts in virtuemart Warenkorb

Ich kann Produkt-ID und Menge wie diese zeigen:

$wantedproductid = $product->virtuemart_product_id; 
$wantedproductquantity = $product->quantity; 

aber ich habe ein Problem mit dem Preis. Ich wiederholte $this und ich bekomme diese:

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 
        ... 
... 

Was ich brauche, zum Beispiel ist dieser Wert: [salesPrice] => 54.32

Wie kann ich [salesPrice] in einem Wert speichern?

Antwort

0

Dies sollte den Trick:

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

Vielen Dank für Ihre Hilfe! Richtige Antwort: $ product-> product_price –

0

Das ist falsch, dass die Antwort nicht did't arbeiten noch den Kommentar unterhalb der Antwort. Dies funktioniert:

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

aber es zeigt, Verkaufspreis nur des letzten Produkts des Wagens nicht für jedes Produkt. Die Foreach-Bedingung funktioniert gut

+0

Sie haben Recht. Die erste Antwort funktioniert nicht, Ihre Arbeit aber wie Sie nur für das letzte Produkt gesagt haben. Irgendwelche Ideen? –