Zum Inhalt springen

inStock wird nicht reduziert

Erstellt am 21. Juli 2006 · 8 Antworten · letzte Antwort am 25. Juli 2006

Tags: Frage

colemcmurphy ·

Hallo Typo3 Gemeinde,

ich habe schon das ganze Forum durchsucht, Posts gefunden, die mir nicht weitergeholfen haben.

Ich lege ein Produkt an, setze das auf z.B. 1 Stück. In der MySql Tabelle "inStock" ist es auch mit "1" eingetragen. Habe im Setup als auch in Cst "plugin.tt_products.alwaysInStock = 0". Kaufe ich ein Produkt wird es nicht reduziert. In der MySQL Tabelle steht nach wie vor "1". Wenn ich es auf "0" setzte ist der Artikel verschwunden.

Jetzt frage ich mich, warum wird der Wert in der Tabelle nicht reduziert. Ich finde den Fehler einfach nicht.

Hier mein Setup des Shop TMP, wobei ich schon alles mal auskommentiert hatte, eben nur plugin.tt_products.alwaysInStock = 0 setzte.

tt_content.textpic.20.1.imageLinkWrap.bodyTag = <body bgcolor="#33CC00">

page.1 = TEMPLATE
page.1 {
template = FILE
template.file = fileadmin/tmp2.html
workOnSubpart = DOCUMENT_BODY
subparts.CONTENT < styles.content.get
subparts.RIGHT < styles.content.getRight
}


plugin.tt_products.alwaysInStock = 0


plugin.tt_products {
  statusCodes {
# 1: Eingehende Bestellung    
    1 = Bestellung 
# 2-49: Nutzung durch Shopadmin
     2 = Ihre Bestellung ist eingegangen
    10 = Der Shop erwartet Waren eines Drittanbieters
    11 = Der Shop erwartet Ihren Zahlungseingang
    12 = Der Shop erwartet Ihre Materiallieferung
    13 = Die Bestellung ist bezahlt    
    20 = Ihre Bestellung wurde versandt
    21 = Geschenkgutscheine wurden versandt
    30 = Die Waren mussten für Sie bestellt werden.
# 50-99: Nutzung durch den Kunden
# 50-59: Generelle, statische Meldungen vom Kunden (Drop-Down Kommentar-Header)
    50 = Kunde möchte Bestellung stornieren
    51 = Nachricht des Kunden an den Shop
# 60-69: Spezielle Meldungen
    60 = Send gift certificate message to receiver
# 100-299 : Bestellung abgeschlossen.
    100 = Die Bestellung ist versandt und abgeschlossen
    101 = Die Bestellung ist abgeschlossen
    200 = Die Bestellung wurd storniert

  statusDate_stdWrap.strftime= %e-%m-%y %H:%M
  orderDate_stdWrap.strftime= %e-%m-%y
  }

  stdSearchFieldExt = subtitle

  ##This fills the marker ###DOMAIN### with your Domain
plugin.domain = pxxxx.typo3server.info
}

plugin.tt_products.shipping >

## shipping config:
plugin.tt_products.shipping {
  TAXpercentage = 0
  10.title = DHL
  10.priceTax = 10,80
  10.excludePayment = 40

  #20.title = Paketdienst
  #20.priceTax = 12

  40.title = Selbstabholer 
  40.excludePayment = 10,50

}

plugin.tt_products.payment >
## payment config:
plugin.tt_products.payment {
  radio = 1
  TAXpercentage = 16
  10.title = Vorkasse
  10.priceTax = 
  10.calculationScript = EXT:tt_products/pi/products_comp_calcScript.inc

  40.title = Zahlung bei Abholung
  40.priceTax = 0
  40.percentOfGoodstotal = 0

  50.title = Nachnahme
  50.image.file = 
  50.priceTax = 4
}

Constants

plugin.tt_products {
orderBy = title
file.templateFile = fileadmin/template_de.html
}

plugin.tt_products.wrap2 = <span class="tx-ttproducts1"> | </span>
plugin.tt_products.wrap1 = <span class="tx-ttproducts2"> | </span>
plugin.tt_products.orderEmail_fromName = GmbH 
plugin.tt_products.limit = 4
plugin.tt_products.priceDecPoint = ,
plugin.tt_products.maxW_list = 100
plugin.tt_products.TAXpercentage = 16
plugin.tt_products.orderEmail_from = shop@xx.de
plugin.tt_products.maxW_listcat = 100
plugin.tt_products.maxH_listcat = 100
plugin.tt_products.maxH_list = 100
plugin.tt_products.orderEmail_subject = Ihre Bestellung
plugin.tt_products.orderEmail_htmlmail = 1
plugin.tt_products.basketMaxQuantity = 10000
plugin.tt_products.displayBasketCatHeader = 0
plugin.tt_products.PIDstoreRoot = 5
plugin.tt_products.orderEmail_to = shop@xx.de
plugin.tt_products.basketPic = kaufen.gif
plugin.tt_products.createUsers = 0
plugin.tt_products.PIDbasket = 181
plugin.tt_products.domain = shop.xx.de
plugin.tt_products.clickIntoBasket = 0
plugin.tt_products.maxW_single = 150
#plugin.tt_products.alwaysAdvanceOrderNumber = 1
#plugin.tt_products.quantityIsFloat = 1
#plugin.tt_products.useArticles = 1

plugin.tt_products.alwaysInStock = 0

Bitte um Hilfe!

Viele Grüße

Jan

Flink ·

In lib/class.tx_ttproducts_order.php

function init
...
		if ($this->conf['alwaysInStock'] == '{$plugin.tt_products.alwaysInStock}')	{
			$this->conf['alwaysInStock'] = '';
		}
		if ($this->conf['AlwaysInStock'] == '{$plugin.tt_products.AlwaysInStock}')	{
			$this->conf['AlwaysInStock'] = '';
		}
colemcmurphy ·

Hallo Flink, vielen Dank für Deine schnelle Antwort und Deinen unermüdlichen Einsatz hier im Forum!

Oh Graus, ...

Ich habe in lib/class.tx_ttproducts_order.php deinen Code hoffentlich richtig zugefügt:

function init(&$pibase, &$conf, &$tt_products, &$tt_products_articles, &$tt_products_cat, &$basket) {
		 $this->pibase = &$pibase;
		 $this->conf = &$conf;
		 $this->basket = &$basket;

//		 $this->config = &$config;
//		 $this->page = &$page;
//		 $this->tt_content = &$tt_content;
		 $this->tt_products = &$tt_products;
		 $this->tt_products_articles = &$tt_products_articles;
		 $this->tt_products_cat = &$tt_products_cat;
	


                if ($this->conf['alwaysInStock'] == '{$plugin.tt_products.alwaysInStock}')      {
                        $this->conf['alwaysInStock'] = '';
                }
                if ($this->conf['AlwaysInStock'] == '{$plugin.tt_products.AlwaysInStock}')      {
                        $this->conf['AlwaysInStock'] = '';
                }
                }

Daraufhin bekomme ich folgende Fehlermeldung:

Fatal error: Call to a member function on a non-object in /html/typo3conf/ext/tt_products/lib/class.tx_ttproducts_order.php on line 445

Wahrscheinlich habe ich ein Fehler beim Einfügen des Codes gemacht?

Grüße
Jan

Flink ·
colemcmurphy schrieb

Daraufhin bekomme ich folgende Fehlermeldung:

Fatal error: Call to a member function on a non-object in /html/typo3conf/ext/tt_products/lib/class.tx_ttproducts_order.php on line 445

Welcher Code ist dort?

if (!$this->conf['alwaysInStock'] && !$this->conf['AlwaysInStock']) {
	$rc = $viewTable->reduceInStock($this->basket->itemArray, $this->conf['useArticles']);		}

Ggf. durch Debug herausfinden, falls $viewTable kein Objekt sein sollte.

colemcmurphy ·

An dieser Stelle ist dieser Code:

	// Fetching the order Record by selecing the newly saved one...
		// $orderRecord = $this->getRecord($orderUid);  needed?

		if (!$this->conf['alwaysInStock'] && !$this->conf['AlwaysInStock']) {
			$rc = $viewTables->reduceInStock($this->basket->itemArray, $this->conf['useArticles']);
		}

		$this->createMM($orderUid, $this->basket->itemArray);
		$addcsv = '';
		// Generate CSV for each order
		if ($this->conf['generateCSV'])	{
			include_once (PATH_BE_ttproducts.'lib/class.tx_ttproducts_csv.php');
			$csv = t3lib_div::makeInstance('tx_ttproducts_csv');
			$csv->init($this->pibase,$this->conf,$this->basket->itemArray,$this->basket->calculatedArray,$price,$this);
			$csvfilepath = PATH_site.'/'. $this->conf['CSVdestination'];
			$csvorderuid = $this->basket->recs['tt_products']['orderUid'];
			$csv->create($this->basket, $csvorderuid, $csvfilepath, $error_message);
			$addcsv = $csvfilepath;
		}
colemcmurphy ·

Hallo Flink,

vielen, vielen Dank für Deine Hilfe. Ich weiss zwar nicht richtig warum die folgende Korrektur funktioniert, aber es geht! #paralyzed#

Auf jeden Fall nehme ich mir jetzt vor PHP zu lernen 😉

Ich habe Deinen Code eingefügt, und dann habe ich auf Zeile 430 "$viewTables" in "$viewTable" getauscht. Dann ging es!

Da ich die Version 2.5 nicht installiert habe, weiss ich nicht ob da auch der Fehler auftritt. Falls das "$viewTables" ein Fehler ist, wo kann man den melden.

Noch einmal Großen Dank.

Viele Grüße
Jan

b.​kraus ·

Wenn du dir das aktuelle 2.5 Relase auf typo3.org anschaust, kannst du dir unter "Details" den Code der entsprechenden Datei anzeigen lassen. Falls der Fehler da noch drin ist, kannst du den Fehler unter http://bugs.typo3.org melden.