Community Add-Ons
Admin Products Paging
for osCommerce Online Merchant v2.2
This contribution was created because of the need of paging the list of products in admin.
Some categories needed to have hundreds of products, and inserting or just editing them was too slow or simply impossible.
After looking for some contributions doing that, I found one of Giuseppe Urso, wich didn't seem to work right for me, so I made some changes to it.
Legend:
Download
Report
If you search and edit product status in filtered list, list deactivate after
the modification. So I put some little codes into search action, and
implemented one reset button under the search list.
- stop fly away in some important case
- navigation in search list
- status modification
Thanks everybody for this great contibution.
V5.0 has a bug where if try to hide or reactivate an item, it jumps back to 1st page. Also product overvew box on the right hand side disappears.
The error is caused on line 939 catalog/admin/categoreis.php
It has been corrected now.
All credit goes to original creator. Special thanks to dr_lucas.
Compete Package
This is an extensive update to categories.php.
Just extract the file and replace /admin/categories.php with this file or use a file comparison program to integrate the changes manually OR use the included Report.html file to integrate the changes. Remember to backup any previous file.
This version fixes several bugs found in version 4 and added several usability enhancements for the search option. I am sure the code writing can be improved because my PHP skills are quite moderate, so if anyone wants to improve/clean up the code - you are more than welcome. In any case - the file does the job. It is based on categories.php from MS2.2 RC2a.
Pagination works here properly in all tested cases.
This IS a full package.
If you get this error (Fatal error: Call to undefined function: tep_hide_session_id() in...) it's probably because you didn't upgrade to the latest OSC RC1.
This function comes with RC1, please add it to your admin/includes/functions/html_output.php file
Make sure you paste the code right ABOVE the final ?> at the bottom of the file:
// Hide form elements
function tep_hide_session_id() {
$string = '';
if (defined('SID') && tep_not_null(SID)) {
$string = tep_draw_hidden_field(tep_session_name(), tep_session_id());
}
return $string;
}
This is an extensive update to categories.php.
Just extract the file and replace /admin/categories.php with this file or use a file comparison program to integrate the changes manually. Remember to backup any previous file.
Pagination works here properly in all tested cases.
this is NOT a full package. You will also need to run the SQL query from V3.0 if you haven't already.
If you get this error (Fatal error: Call to undefined function: tep_hide_session_id() in...) it's probably because you didn't upgrade to the latest OSC RC1.
This function comes with RC1, please add it to your admin/includes/functions/html_output.php file
Make sure you paste the code right ABOVE the final ?> at the bottom of the file:
// Hide form elements
function tep_hide_session_id() {
$string = '';
if (defined('SID') && tep_not_null(SID)) {
$string = tep_draw_hidden_field(tep_session_name(), tep_session_id());
}
return $string;
}
This contribution had a bug: when clicking on a product in any page, it would redirect to the first page.
It's fixed now, thanks to skleps.
I just updated the instructions, included the modified file for a clean install and gave it a new version number, so any improvements can start from here.
See forum thread here: http://forums.oscommerce.com/index.php?showtopic=230262&st=20&gopid=1037480&#
Credit goes to original authors.
Patty
www.cybernetfx.com
I've extended masterqiqi's instructions so that you don't loose your page when selecting a product to edit, delete, move or copy.
Previously when you had 10 pages of products and you selected a product on, for example, page 8, it would select the product but return you to page 1. Now it will stay on page 8.
The file is the complete instructions for the contribution.
Hi, there is another (nicer) method of splitting product listing
in the Admin Side Area, using standatd osCommerce
splitPageResults class:
Instructions:
1. backup, backup
2. execute following SQL command (for example in phpMyAdmin)
# Important:
# BEFORE DO THE SCRIPT KIDDY , please back-up your data!!!!!
# AND V-E-R-I-F-Y IF THE 'CONFIGURATION_GROUP_ID' FOR MAXIMUM VALUES IS '3'
# iF NOT FIND IT AND CHANGE THE VALUE HERE OR THE CONFIGURATION-LINK WILL APPARE IN OTHER MENU
INSERT INTO `configuration` ( `configuration_id` , `configuration_title` , `configuration_key` , `configuration_value` , `configuration_description` , `configuration_group_id` , `sort_order` , `last_modified` , `date_added` , `use_function` , `set_function` )
VALUES (
'', 'Max products per page admin-side', 'MAX_PROD_ADMIN_SIDE', '30', 'Maximum number of products per page in administration panel', '3', NULL , '2003-11-10 14:54:12', '2003-11-10 14:54:12', NULL , NULL
);
3. open catalog/admin.categories.php
a. find the following lines:
(~807 on clean install)
$products_count = 0;
if (isset($HTTP_GET_VARS['search'])) {
$products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and pd.products_name like '%" . tep_db_input($search) . "%' order by pd.products_name");
} else {
$products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by pd.products_name");
}
and replace with the following code:
$products_count = 0;
if (isset($HTTP_GET_VARS['search'])) {
$prod_sql = "select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and pd.products_name like '%" . tep_db_input($search) . "%' order by pd.products_name";
} else {
$prod_sql = "select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by pd.products_name";
}
//BOF Admin product paging
$prod_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_PROD_ADMIN_SIDE, $prod_sql, $prod_query_numrows);
//EOF Admin product paging
$products_query = tep_db_query($prod_sql);
Notice for users having heavy modified osCommerces:
---------------------------------------------------
idea is to replace the queries denoted $products_query = tep_db_query("modified query") only with SQL query string
so $products_query = tep_db_query("modified query") becomes $prod_sql = "modified query". The query is executed
later $products_query = tep_db_query($prod_sql);
b. find the following code
(~859 on clean install)
$cPath_back = (tep_not_null($cPath_back)) ? 'cPath=' . $cPath_back . '&' : '';
?>
and replace it with the following code:
$cPath_back = (tep_not_null($cPath_back)) ? 'cPath=' . $cPath_back . '&' : '';
?>
<? //BOF Admin product paging ?>
<tr>
<td colspan="3">
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td class="smallText" valign="top"><?php echo $prod_split->display_count($prod_query_numrows, MAX_PROD_ADMIN_SIDE, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
<td class="smallText" align="right"><?php echo $prod_split->display_links($prod_query_numrows, MAX_PROD_ADMIN_SIDE, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page'], tep_get_all_get_params(array('page'))); ?></td>
</tr>
</table>
</td>
</td>
<? //EOF Admin product paging ?>
3. That's it!. Now on admin product/categories pages will be splitted according to the settings
Author:
mastergigi
prychl@o2.pl
Hi all....
I created a support post for this contribution, you can find it at:
http://forums.oscommerce.com/index.php?showtopic=230262
Regards from spain...
Finally i return with that contribution, to solve the problem with pages with few products that don't appear.
The problem was that i was rounding the number of products/limitpages, but it has to be a ceil function...
Now it works ok with other few fixes...
Simply overwrite the categories.php
installed this great contribution but found a heavy bug...
for example: i have 100 products divided on 10 pages (so 10 products per side). when i want to edit a product which is on page 3 for example and i search this product via the search function and in the search results i mark the product, then the browser does NOT go to the marked product on page 3, but the browser goes back to the first page! (instead going to the page 3 where my searched product is listed)
or the same problem: for example: i am paging within my product sites and i mark a product on page 5, then the broswer goes back to the first page. (instead of going to the marked product on page 5)
This is a quick patch for those of you running the REGISTER GLOBALS contribution (register global = off) Without it ADMIN PAGING won't work well.
Esto es un patch para aquellos usando la contribucion de REGISTER GLOBALS. (register global = off) Sin este patch ADMIN PAGING no funciona bien.
Corregido un pequeño bug al Finalizar cuando se borra un producto.
Ahora va perfecto :)
Este es el mismo package anterior, revisado para substutiur y utilizar. El anterior tenia incorporado el More images en el categories.php que generaba muchisimos warnings innecesarios, lo únio que he hechoes quitar esa contribución y dejarla limpia, y corregir unpar d errores...
Tb he incorporado una sencilla iteración para representar la catidad de productos en una nueva columna para que veamos nuestro stock en todo momento por si hay errores....
EL problema de BORRAR, MOVER O COPiAR ha sido solucionado ya definitivamente...
ATENCIÓN: solo substituir sobre un categories.php original, sin modificar, en otro caso... buscad todas las lineas con el string "limite" para insertar en vuestro categories.php, nohe tenido tiempo de hace run readme decente... sorry.
Para más info visitar http://oscommerce.qadram.com (comunidad oscommerce en español, yo soy el usuario Jordi por si necesitais más info...)
http://oscommerce.qadram.com/modules.php?name=Forums
This file 'categories.php', wich should replace the old one, fixes some problems detected when finishing some operations (update, delete...). Before, it was always back to the first listing page, and with an incorrect visualization.
-------------------------------------------------
Este fichero, que debe reemplazar al anterior categories.php soluciona algunos problemas a la hora de finalizar operaciones (edición, borrado...), ya que antes volvía siempre a la página inicial y con una visualización deficiente.
This contribution was created because of the need of paging the list of products in admin.
Some categories needed to have hundreds of products, and inserting or just editing them was too slow or simply impossible.
After looking for some contributions doing that, I found one of Giuseppe Urso, wich didn't seem to work right for me, so I made some changes to it.
