Jump to content

[admin] Goto category in backoffice

Recommended Posts

As I had enough of needing 3 or 4 clicks to navigate in my increasingly complex category tree I created a little tool with which you can go directly from one category to every other category. It consists of a little select box where you select the right category and then click on "Go". See the attached image for how it looks.


The modification consist of a a change of the function display() file AdminCatalog.php in the directory Tabs. The new version looks as follows (it was based on PS


public function display()
 global $currentIndex, $cookie;
[... here is the regular content  mostly omitted...]
   echo '<div class="cat_bar"><span style="color: #3C8534;">'.$this->l('Current category').' :</span>   '.getPath($catBarIndex, $id_category);

/* Begin addition */
$query=" select * from ". _DB_PREFIX_."category_lang WHERE id_lang='".(int)($cookie->id_lang)."' ORDER BY name";
$res = mysql_query($query);
	echo '<script type="text/javascript">function GotoCat() {
 var val = document.catform.catsel.options[document.catform.catsel.selectedIndex].value;
 document.location = "index.php?tab=AdminCatalog&id_category="+val+"&viewcategory&token='.$this->token.'";
 return false;
	echo "     <form name='catform' style='display:inline' onsubmit='return GotoCat();'><select name=catsel>";
	while($row = mysql_fetch_array($res))
	   echo "<option  value='".$row['id_category']."'>".$row['name']."</option>";
       echo '</select><input type=submit value="Go"></form>';
/* end addition */

  echo '</div>';
  echo '<h2>'.$this->l('Categories').'</h2>';
  echo '<div style="margin:10px"> </div>';
  echo '<h2>'.$this->l('Products in this category').'</h2>';


At the top $cookie has been added as global variable. Near the bottom the selectform has been added together with a little javascript function.


It is very well possible that this could be implemented as a module but I don't know enough about modules yet and leave that to someone else.



Share this post

Link to post
Share on other sites

Thanks very much for this modification. I downloaded the file and copied it to the /admin/tap directory. It works directly after a new login.


I also have 4 to 5 levels of categories and getting to the products was just to slow. Now it is just selecting category - click go and there I am.


Thanks again, Michael Mais, Beijing

Share this post

Link to post
Share on other sites

I made an update that allows you to edit a category too. It also allows you to enter a product number and directly edit it (or see its name or go to its main category).


AdminCatalog.php should go to your admin\tabs directory as a replacement of your adminCatalog.php.


ajaxdata.php goes in the main admin directory. As the name indicates it retrieves some data for the product processing.




Edited by musicmaster (see edit history)

Share this post

Link to post
Share on other sites

I might do so when I switch for our own shop to 1.5. After a previous attempt I quit and stayed at 1.4 because of instability but recently I am having a new look. So maybe in a few weeks...

Share this post

Link to post
Share on other sites

Here is the PS 1.5 version. It was made for 1.5.5. The bar shows only in the main Products menu. 


included are three files:

 - admin/themes/default/template/toolbar.tpl: here three lines have been replaced so that the tool menu comes just before the buttons

 - Controllers/admin/AdminProducts.Controller.php: here the additional code is produced and stored into a variable in the function initToolbar() for display in toolbar.tpl.

 - ajaxdata.php: an additional file that you should store in your admin directory.


Modified code is flagged with the text "wmr" in comments.




Share this post

Link to post
Share on other sites
This topic is now closed to further replies.

  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More