Jump to content
xt:Commerce Community Forum

wiedermal eigene Felder


EnzephaloN

Recommended Posts

Hi

Ich habe meiner products-Tabelle ein weiteres Feld verpasst products_oldprice

Nun habe ich in den includes/new_products.php, includes/default,php, inc/products.inc.php, includes/classes/product.php in den sql-Abfragen dieses Feld hinzugefügt und in den entsprechenden Templatedateien die entsprechende Abfrage eingefügt:


{if $PRODUCTS_OLDPRICE > $PRODUCTS_PRICE}{#old_price#}<span style="text-decoration:line-through;color:#CCCCCC;font-style:italic;">{$PRODUCTS_OLDPRICE}</span><br>{/if}

                {$PRODUCTS_PRICE}</div>

bzw.

{if $module_data.PRODUCTS_OLDPRICE > $module_data.PRODUCTS_PRICE}{#old_price#}<span style="text-decoration:line-through;color:#CCCCCC;font-style:italic;">{$module_data.PRODUCTS_OLDPRICE}</span><br>{/if}

Leider wird in an gewünschter Stelle immer noch nix angezeigt!

Wo muß ich denn noch das PRODUCTS_OLDPRICE registrieren???

Danke!

EnzephaloN

Link to comment
Share on other sites

Hallo

Mmh, ich dächte, ich hätte an allen notwendigen Stellen die Änderungen vorgenommen...

/includes/classes/product.php:


function buildDataArray(&$array,$image='thumbnail') {

		global $xtPrice,$main;


			$tax_rate = $xtPrice->TAX[$array['products_tax_class_id']];


			$products_price = $xtPrice->xtcGetPrice($array['products_id'], $format = true, 1, $array['products_tax_class_id'], $array['products_price'], 1);

			$products_oldprice = $xtPrice->xtcGetPrice($array['products_id'], $format = true, 1, $array['products_tax_class_id'], $array['products_oldprice'], 1);


			if ($_SESSION['customers_status']['customers_status_show_price'] != '0') {

			if ($_SESSION['customers_status']['customers_fsk18'] == '1') {

				if ($array['products_fsk18'] == '0')

					$buy_now = $this->getBuyNowButton($array['products_id'], $array['products_name']);


			} else {

				$buy_now = $this->getBuyNowButton($array['products_id'], $array['products_name']);

			}

			}




			$shipping_status_name = $main->getShippingStatusName($array['products_shippingtime']);

			$shipping_status_image = $main->getShippingStatusImage($array['products_shippingtime']);



		return array ('PRODUCTS_NAME' => $array['products_name'], 

				'COUNT'=>$array['ID'],

				'PRODUCTS_ID'=>$array['products_id'],

				'PRODUCTS_VPE' => $this->getVPEtext($array, $products_price['plain']), 

				'PRODUCTS_IMAGE' => $this->productImage($array['products_image'], $image), 

				'PRODUCTS_LINK' => xtc_href_link(FILENAME_PRODUCT_INFO, xtc_product_link($array['products_id'], $array['products_name'])), 

				'PRODUCTS_PRICE' => $products_price['formated'], 

				'PRODUCTS_OLDPRICE' => $products_oldprice['formated'], 

				'PRODUCTS_TAX_INFO' => $main->getTaxInfo($tax_rate), 

				'PRODUCTS_SHIPPING_LINK' => $main->getShippingLink(), 

				'PRODUCTS_BUTTON_BUY_NOW' => $buy_now,

				'PRODUCTS_SHIPPING_NAME'=>$shipping_status_name,

				'PRODUCTS_SHIPPING_IMAGE'=>$shipping_status_image, 

				'PRODUCTS_DESCRIPTION' => $array['products_description'],

				'PRODUCTS_EXPIRES' => $array['expires_date'],

				'PRODUCTS_CATEGORY_URL'=>$array['cat_url'],

				'PRODUCTS_SHORT_DESCRIPTION' => $array['products_short_description'], 

				'PRODUCTS_FSK18' => $array['products_fsk18'],

				'PRODUCTS_QUANTITY' => $array['products_quantity'],);		

}

In includes/modules/default.php gibt es keine smarty-Assigns, da habe ich nur bei den sql-Abfragen das zusätzliche Feld hinzugefügt. includes/modules/product_info.php:

nähe Zeile 80:

$info_smarty->assign('PRODUCTS_OLDPRICE',$products_oldprice['formated']);

inc/xtx_get_products_inc.php:

oben: SQL-Abfrage um Feld erweitert

...

nähe Zeile 55:

// dirty workaround

          $xtPrice = new xtcPrice($session['currency'],$session['customers_status']['customers_status_id']);

          $products_price=$xtPrice->xtcGetPrice($products['products_id'],

                                        $format=false,

                                        $session['cart']->contents[$products_id]['qty'],

                                        $products['products_tax_class_id'],

                                        $products['products_price']);



          $products_array[] = array('id' => $products_id,

                                    'name' => $products['products_name'],

                                    'model' => $products['products_model'],

                                    'image' => $products['products_image'],

                                    'price' => $products_price+attributes_price($products_id,$session),

                                    'quantity' => $session['cart']->contents[$products_id]['qty'],

                                    'standard' => $products['products_std'],

                                    'old_price' => $products['products_oldprice'];

                                    'shipping_time' => $products['products_shippingtime'],//eingefügt EnzephaloN IT-Solutions

                                    'weight' => $products['products_weight'],

                                    'final_price' => ($products_price+attributes_price($products_id,$session)),

                                    'tax_class_id' => $products['products_tax_class_id'],

                                    'attributes' => $session['contents'][$products_id]['attributes']);

Was habe ich wo noch vergessen?

Link to comment
Share on other sites

  • 2 weeks later...

jetzt bin ich dem "Fehler" auf die Schliche gekommen!!!

in PRODUCTS_PRICE und PRODUCTS_OLDPRICE werden ja keine Zahlen, sondern ein String (zB 11,99 EUR) übergeben, weswegen ein Vergleich mit größer und kleiner nicht funktioniert.

Nun will ich aber das PRODUCTS_OLDPRICE nur anzeigen, wenn der Wert größer ist als der Wert von PRODUCTS_PRICE.

Gibt es ne Mögichkeit in der Templatedatei da mittels einer Funktion den String in ein Real umzuwandeln?

EnzephaloN

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
  • Create New...