Hilfe bei PHP-Link

susan_freise

Grünschnabel
Hilfe bei PHP-Code *Neu*

Habe ein Problem mit einem Link.

Der sieht folgendermaßen aus:
Code:
Code:
$this_url = tep_href_link(PRODUKT_INFO, 'name=' . str_replace(" ", "_", $this_name). '&products_id=' . $this_id . (($this_language_code == DEFAULT_LANGUAGE) ? '' : ('&language=' . $this_language_code)), 'NONSSL', false);

Und gibt folgenden Link aus:
produkt_info.php?name=TSHIRT_XL_SL&products_id=5&language=en


Wie kann ich den obigen Code so verändern, so das mir "&language=en" nicht mit ausgegeben wird? Habe schon rumprobiert, bekomme es aber nicht ohne Fehler hin.


Vielen Dank Im Voraus

Susaaa
 
Zuletzt bearbeitet:
PHP:
 $this_url = tep_href_link(PRODUKT_INFO, 'name=' . str_replace(" ", "_", $this_name). '&products_id=' . $this_id, 'NONSSL', false);
 
Schönen guten Abend, habe mal wieder eine Frage zu einem PHP Link.

Habe hier 2 if abfragen und ich bekomm die nicht in eine Abfrage hinein.
Hier mal der Code:
Code:
<?php if(SOLD_OUT_SHOW == 'true'){ ?>
<?php if ($product_info['products_quantity'] > 0) { ?>
<tr>
<td class="pageHeading" align="right" valign="top"><img src="images/sold.gif"></td>
</tr>
<?php } } ?>
</table>
Es soll also der html code nur ausgegeben werden wenn beide if abfragen zutreffen.

Vieleicht könnt Ihr mir weiterhelfen.

LG Susa
 
PHP:
<?php
if(SOLD_OUT_SHOW == true && $product_info['products_quantity'] > 0)
{
  ?>
  <tr>
<td class="pageHeading" align="right" valign="top"><img src="images/sold.gif"></td>
</tr>
<?php } ?>
</table>
 
Hallo KristophS,


das funktioniert nun, aber leider noch nicht so wie ich das will.

Ich beschreib mal eben noch um was es überhaupt geht.
Und zwar möchte ich im Onlineshop, das wenn der Artikelbestand unter 1 fällt das es ein Bild anzeigt (nicht Lieferbar!). Diese Funktion soll man aber über den Adminbereich ein und ausschalten können, dies geschieht mit SOLD_OUT_SHOW (true ja, false nein).

Wenn ich jetzt den Code einbaue, dann zeigt er mir das Bild auch wenn ich SOLD_OUT_SHOW false eingestellt und der Artikel bestand unter 1 ist!

Code:
<?php if(SOLD_OUT_SHOW == true && $product_info['products_quantity'] < 1) { ?>
<tr><td class="pageHeading" align="right" valign="top"><img src="images/sold.gif"></td></tr>
<?php } ?> 
</table>

Was könnte da jetzt noch falsch sein? Oder muss noch elseif für das false rein?

LG Susa
 
Habs jetzt selber hinbekommen :) .

Nun habe ich ein neues Problem.

Wie kann ich nun die Zeile mit einer IF Abfrage ersetzen?
Code:
'<a title=' . TEXT_NEW_PRODUCTS_BUY_NOW . ' href="' . tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $new_products['products_id']) . '">' . '<font color=#000000>' . TEXT_NEW_PRODUCTS_BUY_NOW . '</a><br>' .

Der if code ist wie folgt aufgebaut:
Code:
<?php
$a = SOLD_OUT_SHOW == 'false';
$b = SOLD_OUT_SHOW == 'true';
$c = $product_info['products_quantity'] < 1;
$d = $product_info['products_quantity'] > 1;
if ($a) {		 betroffene zeile	 ); }
if ($b && $c) { echo "	 "; }
if ($b && $d) {		 betroffene zeile	 ); }
?>

Der komplette Code, wo die neue if Abfrage rein soll. Die betroffene Zeile ist mit <--->xxx<---> gekennzeichnet.
Code:
<?php
$info_box_contents = array();
$info_box_contents[] = array('text' => sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')));
new contentBoxHeading($info_box_contents);
if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
	$new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by rand() desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
} else {
	$new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' order by rand() desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
}
$row = 0;
$col = 0;
$info_box_contents = array();
while ($new_products = tep_db_fetch_array($new_products_query)) {
	$new_products['products_name'] = tep_get_products_name($new_products['products_id']);
	$info_box_contents[$row][$col] = array('align' => 'center',
										 'params' => 'class="smallText" width="33%" valign="top"',
'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'class=shadow1') . '</a><br>
<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><br>
<a title=' . TEXT_NEW_PRODUCTS_MORE_INFO . ' href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . '<font color=#000000>' . TEXT_NEW_PRODUCTS_MORE_INFO . '</a>&nbsp;&nbsp;|&nbsp;&nbsp;' .
 
<--->xxx<---> '<a title=' . TEXT_NEW_PRODUCTS_BUY_NOW . ' href="' . tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $new_products['products_id']) . '">' . '<font color=#000000>' . TEXT_NEW_PRODUCTS_BUY_NOW . '</a><br>' .
 
(($new_products['products_price'] > 0) ? $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) : '')); 
 
	$col ++;
	if ($col > 2) {
	 $col = 0;
	 $row ++;
	}
}
new contentBox($info_box_contents);
?>


Hoffe Ihr könnt mir weiterhelfen.

LG Susa
 
Alter.. so langsam weiss ich was damit gemeint ist..
Schreibt die Scripte bitte nicht mit CODE sondern mit PHP in den EckigenKlammern.. man verliert ja komplett die übersicht so !

PHP:
<a title=' . TEXT_NEW_PRODUCTS_BUY_NOW . ' href="' . tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $new_products['products_id']) . '">' . '<font color=#000000>' . TEXT_NEW_PRODUCTS_BUY_NOW . '</a><br>

Was genau meinst du damit? in eine If Abfrage umzuwandeln? Ich versteh die Fragestellung nicht ganz!

=) ich glaube wenn du so einer bist wie ich, dann vielierst du glaub ich noch öfter die Durchsicht.. manchmal steig ich bei mir auch nciht mehr durch
 
Zurück