Fidlimidly Posted October 23, 2012 Share Posted October 23, 2012 Už delší dobu řeším jak to udělat a nepodělat ...pomůže někdo? Link to comment Share on other sites More sharing options...
Peter Liska Posted October 24, 2012 Share Posted October 24, 2012 (edited) <?php$id_category = 111; // Write your category id.$db_user = "user"; // Write your DB user.$db_password = "password"; // Write your DB password.$db_name = "name"; // Write your DB name.$db_host = "localhost"; // Write your DB host.$connection = mysql_connect($db_host, $db_user, $db_password);$on_sale = 1;$position = 0;while ($on_sale >= 0) { $sub_query = "SELECT id_product FROM product WHERE on_sale = ".$on_sale; $query_products = "SELECT id_product FROM category_product WHERE id_category = ".$id_category." AND id_product IN ( ".$sub_query." )"; $result_products = mysql_db_query($db_name, $query_products, $connection); while ( $row = mysql_fetch_array($result_products) ) { $query = "UPDATE category_product SET position = ".$position; $query .= " WHERE id_product = ".$row['id_product']." AND id_category = ".$id_category; mysql_db_query($db_name, $query, $connection); $position = $position + 1; } $on_sale = $on_sale - 1;}mysql_close($connection);?> Edited October 24, 2012 by Peter Liska (see edit history) Link to comment Share on other sites More sharing options...
Fidlimidly Posted October 24, 2012 Author Share Posted October 24, 2012 Takže přepsat soubor "theme/product-sort.tpl " ? / add the code to theme/product-sort.tpl what is above? Link to comment Share on other sites More sharing options...
Peter Liska Posted October 24, 2012 Share Posted October 24, 2012 (edited) To je nezávislý PHP program, který pracuje jen s tvou DB. Seřadí zboží (tabulka - category_product) ve vybrané kategorii dle hodnoty on_sale v tabulce product. Produkty s on_sale = 1 budou první. Edited October 24, 2012 by Peter Liska (see edit history) Link to comment Share on other sites More sharing options...
Fidlimidly Posted October 25, 2012 Author Share Posted October 25, 2012 Takže vytvořím v BO tabulku nebo vytvořím php soubor category_product.php v www/admin/tabs ? promiň ale takové úpravy jsem ještě nedělal...můžeš napsat v zkratce postup ? Link to comment Share on other sites More sharing options...
Peter Liska Posted October 25, 2012 Share Posted October 25, 2012 Takže vytvořím v BO tabulku nebo vytvořím php soubor category_product.php v www/admin/tabs ? promiň ale takové úpravy jsem ještě nedělal...můžeš napsat v zkratce postup ? Psal jsem o tabulkách PrestaShop v tvé DB, kde máš uloženy všechny údaje. Pokud neovládáš ani základy PHP a MySQL, tak na to asi raději zapomeň. Nebo si najmi někoho kdo ti udělá krabicové řešení. Link to comment Share on other sites More sharing options...
Fidlimidly Posted October 25, 2012 Author Share Posted October 25, 2012 Tak jo a kolik by si si vzal za tuhle úpravu ? Nebo můžeš někoho doporučit? Link to comment Share on other sites More sharing options...
Peter Liska Posted October 26, 2012 Share Posted October 26, 2012 Napíšu ti tedy PM a možná se nějak dohodneme. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now