Jump to content
Latest News: (loading..)

gadlol

Members
  • Content count

    231
  • Joined

  • Last visited

  • Days Won

    13

Everything posted by gadlol

  1. I did not and don't like the recursive function tep_get_categories() and the how the categories get drawn into the categories box. So I created a function that draws the categories tree (expanded or not). It uses only one query for the categories. So its faster than the default. It uses <ul> list tags. It produces full tree code even if $drawExpanded=false, that way you can use css3 or jquery menu so to popup on hover-click the hidden subcategories, any length of subcategories. Things to be done replace that recursive function tep_count_products_in_category when displaying the number of products under each category. Hope you like it. Check images: Tree fully expanded Tree expanded only if page in categories Produced Code Code : http://pastebin.com/puCzrASC or: //tep_draw_categories_tree function tep_draw_categories_tree($drawExpanded=false,$root_id = 0,$mainUlClass='',$submenuUlClass='submenu'){ global $languages_id,$cPath_array; //GET ALL CATEGORIES $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name"); $items = array(); while ($categories = tep_db_fetch_array($categories_query)) { $items[$categories['categories_id']] = array('name' => $categories['categories_name'], 'parent_id' => $categories['parent_id'], 'id' => $categories['categories_id']); } $citems=count($items); if($citems<=0) return ''; elseif($citems==1) $children[] = $items; //in case we have one category item without subcategories, rare but possible else foreach( $items as $item ) $children[$item['parent_id']][] = $item; // loop will be false if the root has no children (i.e., an empty categories!) $loop = !empty( $children[$root_id] ); $parent = $root_id; $parent_stack = array(); $html=array();//store html code $stack=array();//helper array so to know the current level $pic=''; //products_in_category string $html[]='<ul class="'.$mainUlClass.'">'; while ( $loop && ( ( $option = each( $children[$parent] ) ) || ( $parent > $root_id ) ) ){ if ( $option === false ){ $parent = array_pop( $parent_stack ); $html[] = str_repeat( "\t", ( count( $parent_stack ) + 1 ) * 2 ) . '</ul>'; $html[] = str_repeat( "\t", ( count( $parent_stack ) + 1 ) * 2 - 1 ) . '</li>'; array_pop( $stack ); }elseif ( !empty( $children[$option['value']['id']] ) ){ $tab = str_repeat( "\t", ( count( $parent_stack ) + 1 ) * 2 - 1 ); $stack[]=$option['value']['id']; $rt=$root_id>0 ? $root_id.'_' : ''; $cpath_new=count($stack)<=0 ? 'cPath='.$rt.$option['value']['id'] : 'cPath='.$rt.implode('_',$stack); $html[]=$tab.'<li><a href="'.tep_href_link(FILENAME_DEFAULT, $cpath_new).'">'; if (SHOW_COUNTS == 'true') { //THIS SHOULD BE CHANGED SO NOT TO USE tep_count_products_in_category WHICH IS RECURSIVE $products_in_category = tep_count_products_in_category($option['value']['id']); if ($products_in_category > 0) { $pic=' (' . $products_in_category . ')'; } } $sm=0; if((isset($cPath_array) && in_array($option['value']['id'], $cPath_array))){ $sm=1; $html[]='<strong>'.stripslashes($option['value']['name']).'->'.$pic.'</strong>'; }else{ $html[]=stripslashes($option['value']['name']).'->'.$pic; } $html[]='</a>'; $html[] = $tab . "\t" . '<ul class="'.$submenuUlClass.'" style="'.($sm!==1 && !$drawExpanded ?'display:none;':'').'">'; $parent_stack[]=$option['value']['parent_id']; $parent = $option['value']['id']; }else{ $rt=$root_id>0 ? $root_id.'_' : ''; $cpath_new= count($stack)<=0 ? 'cPath='.$rt.$option['value']['id'] : 'cPath='.$rt.implode('_',$stack).'_'.$option['value']['id']; $html[]=str_repeat( "\t", ( count( $parent_stack ) + 1 ) * 2 - 1 ).'<li><a href="'.tep_href_link(FILENAME_DEFAULT, $cpath_new).'" >'; if (SHOW_COUNTS == 'true') { //THIS SHOULD BE CHANGED SO NOT TO USE tep_count_products_in_category WHICH IS RECURSIVE $products_in_category = tep_count_products_in_category($option['value']['id']); if ($products_in_category > 0) { $pic=' (' . $products_in_category . ')'; } } if (isset($cPath_array) && in_array($option['value']['id'], $cPath_array)) { $html[]='<strong>'.stripslashes($option['value']['name']).$pic.'</strong>'; }else{ $html[]=stripslashes($option['value']['name']).$pic; } $html[]='</a></li>'; } } $html[]='</ul>'; echo implode( "\r\n", $html ); } //tep_draw_categories_tree
  2. Hello fellow osCommercians. This is the support topic for the addon SEO Friendly Urls. SEO Friendly Urls is a new addon for the osCommerce CMS that will change the default urls into what a modern website's urls should be! (at least that's what I think) I will shortly add the zip file into addons page. (I just wan tto grab this topic link in order to add it into the addons page) Example: of SEO Friendly Urls: www.mystore.com/product_info.php?products_id=17 will be www.mystore.com/scarves/oval-crystal-scarf Urls possible structure examples : * www.mydomain.com/category-alias www.mydomain.com/category-alias/sub-category-alias www.mydomain.com/category-alias/sub-category-alias/sub-category-alias www.mydomain.com/category-alias/sub-category-alias/sub-sub-category-alias/sub-sub-sub-category-alias e.t.c. www.mydomain.com/product-alias www.mydomain.com/category-alias/product-alias www.mydomain.com/category-alias/sub-category-alias/product-alias www.mydomain.com/category-alias/sub-category-alias/sub-category-alias/product-alias www.mydomain.com/category-alias/sub-category-alias/sub-sub-category-alias/sub-sub-sub-category-alias/product-alias e.t.c. * Can also add any desired extension. Can also add language alias. Example with language alias: www.mydomain.com/en/category-alias/product-alias Extras: You can also create alias for core pages such as specials.php, reviews.php For example you could change specials.php to specials (www.mystore.com/specials) ------------------- EDITED: Here is the addons link: http://addons.oscommerce.com/info/9371 P.S. I did not added this topic url to the addons page. Damn, I forgot. P.S. I hope I don't break any rule this time.
  3. Problem fixed. Its a bug when the store has ONLY ONE category. osCommercians who have only one category and using Seo Friendly Urls must go and comment the line 308 //elseif($citems==1) $children[] = $items[$clang]; //in case we have one category item without subcategories, rare but possible In the next upcoming update this will be fixed... @wHiTeHaT I asked from @Stephan Gebbers to send me info in PM because I knew that I had to investigate the problem on his live website.... After the bug fix I would ( as I did ) post the solution... About $ - who fixes it, it's another story but it would be nice to see if there would be anyone here that could fix it... :-)
  4. Hi @Stephan Gebbers By default the main language is set not to appear in the url but you can change that by altering the option "Display default language alias?" About the categories not being aliased there something must be happening I must check it by myself. Is it possible to send me via PM live link and more info so to check? About clearing the cache: you must clear the cache only when you manually change the alias or products are made - deleted or modified their names.
  5. So I guess osCommerce is dead... Am I right? What will be the next stage that @JcMagpie is saying?
  6. Hello. I have developed a module - addon called Product Next Previous Products ADDON for osc 2.34 bootstrap (The name perhpas needs improvement) which displays a next and/or previous products box using bootstrap thumbnail or bootstrap panel in the product_info page. Description: when a customer is in a category viewing the listed products and clicks on a product then bellow that product it displays the next and previous product. NOTE: When customer is listing products in a category and has changed the sort then if clicks on a product then the previous and next product may not be the same as he was seeing in the listing. In order to solve this you must add the sort get param into the product links in the category listing. (Optional) Installation guide is included in the zip file plus the extra code needed to be changed if wanted (read NOTE paragraph above) Screenshot 1 (module displayed as bootstrap thumbnail) Screenshot 2 (module displayed as bootstrap panel) You can find the module here. I post it here in order for you to test it. Thank you. P.S. Message to this forums administrators: Please I need more upload space in the forum, it is full and does not allow me to upload anything.
  7. @RAC I actually don't know. If you put in content it needs changes to the class. So it is better to place it in the boxes for now. If I find some free time I will coded it the right way..
  8. Hi @RAC Right now the one I have uploaded in the first post of this thread uses bm_product_next_previous. I don't know how the newer version has changed in terms on modulating (is this the right word?) I think that the module should be in content and not in box: includes/modules/content/product_info/cm_pi_next_previous.php includes/modules/content/product_info/templates/next_previous.php
  9. You are welcome @janeyred
  10. Did you changed in the index.php the require('includes/application_top.php'); to require_once('includes/application_top.php'); ???
  11. Hi... blank home page can mean lots o fthings. Maybe you did something wrong during installation. Maybe this is probably the htaccess file. Does your server produce any error logs (apache error logs)? Are all the pages blank or the homepage only? Can you give me the url so to check it?
  12. Would you be interested in creating an API for osCommerce?

    1. Show previous comments  1 more
    2. gadlol

      gadlol

      Hmmm.

      Imagine having all the sql queries somewhere centralized and having a system to fetch us the data. For example: in the specials.php I would need no more to have a tep_db_query just

      $listing = $osc_api->specials(); 

      And now $listing has the data in array so to be used in the specials.php.

      Another useful thing about osc API is that you can make your website data available outside of your osc installation and so it would be easy to create mobile applications e.t.c. For example:

      $osc_api->specials()->toJSON();

      will produce a json specials in json format..

       

    3. beerbee

      beerbee

      Yes! We'd need it for a life interface to our ERP system.

    4. burt

      burt

      Maybe make a more detailed post regarding your ideas?

      In principle:  excellent idea

  13. Hi... the XML sitemap generator (http://addons.oscommerce.com/info/6583) does not use the oscommerce tep_href_link instead it uses a class method hrefLink. Thats why that addon does not work with the Seo Friendly Urls. I dont know if there is any sitemap addon that uses the osc default functions for generating the urls....
  14. Hmmmm, i dont know about that.... Maybe there are conflictions between addons....
  15. Hi @@aurelou .... You may edit the seo_friendly_urls.php class and try to change all the $HTTP_GET_VARS to $_GET and find all the FILENAME_ defines and replace them with the file. In example: FILENAME_DEFAULT => 'index.php'
  16. Hi @@29gk Glad it works..... Hope you like my addon... P.S. Γεια σου πατριώτη...
  17. In order for the SEO FRIENDLY URLS to be uninstalled you must use the uninstall option then go to the front store so that option - action run. Then If you refresh the page the SEO FRIENDLY URLS will auto install again. But I dont know what will happen if some of the configurations is corrupted. In general I would suggest to go to the configuration table and remove all the keys that start with SEO_FRIENDLY_URLS_ and then go to the front store and seo frendly urls will auto install....
  18. Hi Richard. 404 not found is not an easy task, at least in oscommerce. So in order not to have that white page, create an 404.php page but without oscommerce code and then go to admin and edit the option Handle not found urls as 404 include page? (404 status code) set to 404.php and then you will get the 404.php displayed. Unfortunately there is not an easy way to make an oscommerce page as a 404 not found. In the next version I ll try to implement that. But for now the solution is to create a custom 404 page...
  19. Hi Kenny, Unfortunately in current version there is no ability to get what you want. Instead you can do: http://yoursite.com/review?products_id=19 I did not foresee that need and thats why I did not code it. But if you want I can code it for you.
  20. Hello Marcelo, it actually does support conversions like that. In current version those conversions are hard coded and applied only when you set auto create alias to true (default) and "Transliterate characters to ASCII" to true (default) For example: here are the transliterations for Turkish and Ukrainian languages: // Turkish 'Ş' => 'S', 'İ' => 'I', 'Ç' => 'C', 'Ü' => 'U', 'Ö' => 'O', 'Ğ' => 'G', 'ş' => 's', 'ı' => 'i', 'ç' => 'c', 'ü' => 'u', 'ö' => 'o', 'ğ' => 'g', // Ukrainian 'Є' => 'Ye', 'І' => 'I', 'Ї' => 'Yi', 'Ґ' => 'G', 'є' => 'ye', 'і' => 'i', 'ї' => 'yi', 'ґ' => 'g', Those can be found in the function create_alias line 762 In the next version there will be an option to load transliterations from txt file or db so you can easily alter those...
  21. I dont know if its ok to use along with the Header Tags SEO plugin because I have not test it with that. You can do so and tell me. In general I dont think that it will be a problem. "i read that the older plugins are just too messed up to work on Bootstrap edge oscommerce?" Thats why I created that addon. My addon is very simple to install, only one file in the classes folder (seo_friendly_urls.php), and a few minor changes into 2 other files. For main features e.t.c. check this page. Make sure you check the options table at the bottom.
  22. Hi Agustin, thank you for your kind words. In the current Version of AAS there is no way to select categories and thats because there is not a need to check categories since there are not actually things to mass change in a category. If osc had categories status then it could be useful. But in the next version I will add support for categories selection just in case someone has installed categories status addon or categories seo description e.t.c. About exporting: I ' ll have to double check that... (Although I am currently developing an AAS module that will do a better thing than the AAS core export mechanism) About settings: The sixth option is only available for admin with id = 1. I coded like that because I want one admin to be the Master =, and so only him to have the ability to control what other admins can see - do with AAS. So in order to temporary fix that you can edit the administrations table and change the id to 1. (Note its a bit safe although its a primary key and thats because it is not connected with any other table.) In next version - update I will make the option visible only to the first admin found in the table administrators P.S. In a few days I will introduce a new page in the AAS website that will have the so far translated AAS files ( Spanish and Greek )
  23. Alternative Administration System: Categories/Products. is an alternative way to navigate through categories to easily find and EDIT products. It has its own ui totally different from the default admin one. You simply navigate to a php page and voila!!! Some features: Add extra custom fields easily All fields custom or not, can be editable or not, visible by default or not , sortable or not e.t.c. You can also add fields from other mysql tables other than products Deletion of multiple products Multiple prices edit Right side panel (sortable fields, choose what fields to display and sort - reorder them) Bottom panel (contains: categories list, languages, display in stock or not) Top Search panel (hidden by default, opens when you click on search icon) Server side pagination (includes max products per page) Advanced search (search on specific field, developers can add their own custom fields) Order products by different fields - custom fields Print categories and/or products (only the categories - products table, everything else is not displayed ) Multiple product status change Export products into csv, json, text or excel file I will post the addon at the addons page shortly Have a look at the screenshots: Youtube demo:
  24. Hi vampire, you can find a demo here. If you need more information just send me P.M. P.S. I know for sure that several osCommerce admins use my addon. If you need their opinion I can get you in contact with some of them (those who want to)...
×