Webseiten Aufbau

e cs hop Start se ite Produk te durch Sch lüssel w ör ter an ru fen

In let z ter Zeit , weil das Unternehmen EC S hop , die Start se ite muss einen bestimmten Teil der Waren auf ru fen , so dachte ich , durch die Sch lüssel w ör ter auf ru fen , nicht viel zu sagen , direkt auf den Code [...]

Artikel Ver zeich nis

In let z ter Zeit , weil das Unternehmen EC S hop wieder an fangen muss , muss die Start se ite einen bestimmten Teil der Waren auf ru fen , so dass ich dachte , durch Sch lüssel w ör ter auf ru fen , nicht viel zu sagen , direkt auf den Code :

1. Fü gen Sie diesen Absatz in /incl udes/lib _ go ods . ph p hin zu :

Funk tion get _ key word _ goods ($key word = "")

{

$time = g m time () ;

$order _ type = $G LO B AL S [ ' _ CF G ' ][ ' re com mend _ order ' ];

$s q l = ' S EL ECT g . go ods _ id , g . go ods _ name , g . go ods _ name _ style ,g.market_ Preis ,g.shop_ price AS organ _ price , g . promo te _ price , ' .

„ IF N ULL (mp . user _ pri ce ,g.shop_ price * ' $_ S ES SI ON [ dis count ] ') AS shop _ price , " .

„ promo te _ start _ date , promote _ end _ date , g . go ods _ br ief , g . go ods _ th umb , goods _ im g , b . brand _ name , " .

“g.isG . is _ best , g . is _ new , g . is _ hot , g . is _ promote , R AND () AS r nd .

„ V om " . $G LO B AL S [ ' e cs ' ] - > table (' go ods ').„ A ls g " .

„ L eft join " . $G LO B AL S [ ' e cs ' ] - > table (' brand ').„ AS b ON b . brand _ id = g . brand _ id " .

„ L eft Join " . $G LO B AL S [ ' e cs ' ] - > table (' m ember _ pri ce ').„ A ls MP . "

„ ON mp . go ods _ id = g . go ods _ id UN D mp . user _ rank = ' $_ S ES SI ON [ user _ rank ] ' " .

» Wog.is_ on _ sale = 1 und g . is _ al one _ sale = 1 und g . is _ de lete = 0 '.

" U nd g . key words wie ' % $K ey word % ' "

$s q l = $order _ type = 0 ?„ ORD ER BY g . s ort _ order , g . last _ update DES C " : „ ORD ER BY r nd " ;

$res ult = $G LO B AL S [ ' db ' ] - > get All ($s q l);

$go ods = array ();

fore ach ($res ult AS $id x = > $row)

{

wenn ($row [ ' promo te _ pri ce ' ] > 0)

{

$promo te _ price = bar gain _ price ($row [ ' promo te _ price ' ], $row [ ' promo te _ start _ date ' ], $row [ ' promo te _ end _ date ' ]);

$go ods [ $id x ][ ' promo te _ price ' ] = $promo te _ price > 0 ? price _ format ($promo te _ price): " ;

}

Mehr

{

$go ods [ $id x ][ ' promo te _ pri ce ' ] = " ;

}

$go ods [ $id x ] [ ' id ' ] = $row [ ' go ods _ id ' ];

$go ods [ $id x ][ ' name ' ] = $row [ ' go ods _ name ' ];

$go ods [ $id x ][ ' kur z ' ] = $row [ ' go ods _ br ief ' ];

$go ods [ $id x ][ ' brand _ name ' ] = $row [ ' brand _ name ' ];

$go ods [ $id x ] [ ' go ods _ style _ name ' ] = add _ style ($row [ ' go ods _ name ' ], $row [ ' go ods _ name _ style ' ]);

$go ods [ $id x ][ ' sh ort _ name ' ] = $G LO B AL S [ ' _ CF G ' ][ ' go ods _ name _ leng th ' ] > 0 ? sub _ str ($row [ ' go ods _ name ' ], $G LO B AL S [ ' _ CF G ' ][ ' go ods _ name _ leng th ' ]) : $row [ ' go ods _ name ' ];

$go ods [ $id x ][ ' sh ort _ style _ name ' ] = add _ style ($go ods [ $id x ][ ' sh ort _ name ' ], $row [ ' go ods _ name _ style ' ]);

$goods[$idx]['market_price'] = price_format($row['market_price']);

$goods[$idx] ['shop_price'] = price _ format($row['shop_price']);

$goods[$idx] ['thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);

$goods[$idx] ['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']);

$goods[$idx] ['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);

}

Rückgabe von $goods

}
2. Schreiben Sie diesen Abschnitt in der PHP-Datei (normalerweise index.php) vor assign _ dynamic ('index');

$smarty-> assign('keyword_1', get _ keyword _ goods ("USA");

Unter ihnen ist die Startseite des Einkaufszentrums das Schlüsselwort, das ich in der Spalte "Weitere Informationen" - "Produktschlüsselwort" für den Aufruf ausgefüllt habe.

3. In dwt oder lbi kann man die Ware mitforeach aufrufen.

<! - {vorher von=$keyword_1 item=goods} ->

<! - {/foreach} - >