So sick! Posted December 26, 2011 Report Posted December 26, 2011 (edited) Šo fīču taisīju vienam interneta veikalam, taču, tas interneta veikals vairs nepastāv un tāpēc izdomāju publicēt šo skriptiņu.. nekas liels, bet nu.. gatavs skriptiņš :) <?php header("Content-type: text/xml"); // Settings $website = 'veikals.lv'; // Connection $link = mysql_connect("localhost", "user", "parole"); $select_db = mysql_select_db("opencart"); // Select $sql = "SELECT product_description.name, product.product_id, product.price, product.image, category.parent_id, product_to_category.category_id FROM product LEFT JOIN product_description ON product.product_id=product_description.product_id LEFT JOIN product_to_category ON product.product_id=product_to_category.product_id LEFT JOIN category_description ON product_to_category.category_id=category_description.category_id LEFT JOIN category ON category.category_id=category_description.category_id"; $result = mysql_query($sql) or die (mysql_error()); $xml_output = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; $xml_output .= "<root>\n"; $prev_value = 0; while ($line = mysql_fetch_assoc($result)) { if ($prev_value != $line['product_id']) { $prev_value = $line['product_id']; // Echo $parent_id = $line['parent_id']; $sql2 = "SELECT name FROM category_description WHERE category_id=$parent_id AND language_id=2"; $result2 = mysql_query($sql2) or die (mysql_error()); while($parent_name1 = mysql_fetch_assoc($result2)){ $parent_name = $parent_name1['name']; } if(isset($parent_name)) {$parent_symbol = ">";}else{$parent_symbol = "";} $category_id = $line['category_id']; $sql3 = "SELECT name FROM category_description WHERE category_id=$category_id AND language_id=2"; $result3 = mysql_query($sql3) or die (mysql_error()); while($category_name1 = mysql_fetch_assoc($result3)){ $category_name = $category_name1['name']; } $xml_output .= "<item>\n"; $xml_output .= "<name>".$line['name']."</name>\n"; $xml_output .= "<link>http:///".$website."/index.php?route=product/product&product_id=".$line['product_id']."</link>\n"; $xml_output .= "<price>".$line['price']."</price>\n"; $xml_output .= "<image>http://".$website.".lv/image/".$line['image']."</image>\n"; $xml_output .= "<category>".$category_name."</category>\n"; $xml_output .= "<category_full>".$parent_name." ".$parent_symbol." ".$category_name."</category_full>\n"; $xml_output .= "<category_link>http:///".$website."/index.php?route=product/category&path=".$line['category_id']."</category_link>\n"; $xml_output .= "</item>\n"; } } $xml_output .= "</root>"; echo $xml_output; ?> P.s. Vajadzētu strādāt perfekti uz kurpirkt.lv un salidzini.lv P.p.s. Last modified 15.03.2011 :D Edited December 26, 2011 by So sick! Quote
So sick! Posted December 26, 2011 Author Report Posted December 26, 2011 Strādā, bet nu.. kā jau teici, šausmas.. :D Quote
aldinsh Posted February 28, 2012 Report Posted February 28, 2012 sveiki, varbuut, kaads vareetu paliidzeet paarveidot sho skriptu, lai tas darbots ar oscommerce, un taas datubaazes struktuuru. Quote
aldinsh Posted March 7, 2012 Report Posted March 7, 2012 sveiki, varbuut, kaads vareetu paliidzeet paarveidot sho skriptu, lai tas darbots ar oscommerce, un taas datubaazes struktuuru. enyone? Quote
daGrevis Posted March 7, 2012 Report Posted March 7, 2012 > enyone? http://php.lv/f/forum/42-darbs/ Quote
aldinsh Posted March 7, 2012 Report Posted March 7, 2012 > enyone? http://php.lv/f/forum/42-darbs/ es teicu paliidzeet, nevis izpildiit manaa vietaa! Quote
aldinsh Posted March 7, 2012 Report Posted March 7, 2012 palīdzēt -> izpildīt tev nesaprotamās vietas tavā vietā.. tātad http://php.lv/f/forum/42-darbs/ or cīnies pats.. ;) paskaidrot kas ko kaa arii neviens bez pieciisha rokaas nemaak? Quote
daGrevis Posted March 7, 2012 Report Posted March 7, 2012 Piecīts? :D Nu tad es "jau skrienu"! ;D Quote
v3rb0 Posted March 7, 2012 Report Posted March 7, 2012 Vajadzētu strādāt perfekti uz kurpirkt.lv un salidzini.lv arī ar produktiem, kuriem nosaukumā ir '>' vai '<' ? Quote
jimswers Posted June 21, 2013 Report Posted June 21, 2013 bezmaksas extension: http://www.opencart.com/index.php?route=extension/extension/info&extension_id=12315 Quote
jurchiks Posted June 21, 2013 Report Posted June 21, 2013 bezmaksas extension: http://www.opencart.com/index.php?route=extension/extension/info&extension_id=12315 Kā man besī, ka tas developeris nemāk riktīgi runāt latviski, bet vienalga drukā savu, pat ārzemju saitā. Quote
jimswers Posted June 25, 2013 Report Posted June 25, 2013 LV valoda man nav dzimta valoda tas taisnība. Ja jums grības palidzēt izlabot klūdas es ar prieku izdarīšu to. Ja jums ir komenti par kodu jūs arī varat to izteikt. Quote
jurchiks Posted June 25, 2013 Report Posted June 25, 2013 Galvenā tava problēma ir mīkstinājuma un garumzīmes, tu tās liec tur, kur tās nevajag, un neliec tur, kur vajag. Citādi ir puslīdz ok. Quote
Kavacky Posted June 25, 2013 Report Posted June 25, 2013 Pilnīgi pie dirsas, ja neesi analfabēts, izlasīt var. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.