Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[CONTRIBUTION] Admin products paging


jordi

Recommended Posts

OK, one little problem left. :blush:

 

When using search box to find a product, by clicking the product link on the search result won't redirect to the product itself but to the whole category where the product is, so in order to find it you'll need to look page by page.

 

Any clues on how to fix this?

Patty

Link to comment
Share on other sites

  • Replies 58
  • Created
  • Last Reply

Top Posters In This Topic

And yet another problem: now I can't delete a product. It click on a product, click on DELETE button, click to confirm and... nothing happens. Product is still there. :blink:

Patty

Link to comment
Share on other sites

  • 2 weeks later...

When I click to update a product --> update info --> click update

 

It goes back to page 1 and then I have to click on one of the info buttons to get it to show the page properly.

 

I also noticed that if I have a category with no products just different categories this error is at the top:

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-50, 50' at line 2

 

select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_cost, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.products_model from products p, products_description pd, products_to_categories p2c where p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = '0' order by p.products_model limit -50, 50

 

and there are no buttons at the bottom of the page or the following:

 

Displaying 1 to 50 (of 200 products) Page 1 of 4

 

Categories: 0

Products: 6

 

I am thinking this is what is causing the error but I am new to php.

 

any help is appreciated

 

 

Mike

Link to comment
Share on other sites

im having issue where i try to copy items to another category, and if its on a different page, as soon as i click the copy button, it reloads to page one, but gives me options to copy, and when i click copy, its not really copying the file.

 

and worse of all, i goto uninstall this thing, and i re-write the code that i was told to replace back into the file, and its giving me a error when i view the categories.php page, so now im fuxored.

 

any ideas how to fix the problems inside this thing?

Link to comment
Share on other sites

  • 4 weeks later...

Well, I think the problem is that the page number passed in the tep_href_link is not the good one. Although it is correctely set for the navigation through the search result pages, it is not what it needs fot the onclick redirection to the categories/products splitted pages.

 

C - Find the following line:

 

(~831 on clean install)

 

echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products['products_id']) . '\'">' . "\n";

 

 

and replace with the following code:

 

 

echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products['products_id']) . '&page='.$HTTP_GET_VARS['page'].'\'">' . "\n";

 

So, we must calculate for each product in search results the appropriate page. This means that we count the total products in categorie given by cPath then find there in witch page our product beongs.

This must be done somewhere here:

B - Find the following line:

 

(~807 on clean install)

.....

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);

 

while ($products = tep_db_fetch_array($products_query)) {

$products_count++;

$rows++;

 

// Get categories_id for product if search

if (isset($HTTP_GET_VARS['search'])) $cPath = $products['categories_id'];

 

// to be done : find here the total pages in cPath category and then calculate the page in which our product belongs, lets say pageNum

// then pass this pageNum to the code above, step C

if ( (!isset($HTTP_GET_VARS['pID']) && !isset($HTTP_GET_VARS['cID']) || (isset($HTTP_GET_VARS['pID']) && ($HTTP_GET_VARS['pID'] == $products['products_id']))) && !isset($pInfo) && !isset($cInfo) && (substr($action, 0, 3) != 'new')) {

// find out the rating average from customer reviews

 

Any help to complete this task is welcome

Link to comment
Share on other sites

  • 2 weeks later...

here is an easy solution for the search-problem.

instead of some complicated function to get the correct page just change the sort order to move the product on top.

 

change the order of the second $prod_sql query (not the search query)

from:

order by pd.products_name

to:

order by field(p.products_id,'".$_GET['pID']."') desc, pd.products_name

 

and that's it.

 

there is also another error not connected to this contribution that the first pre-selected search result will point to a wrong category-path when multiple results are found.

here's another very easy fix:

 

find:

while ($products = tep_db_fetch_array($products_query)) {

add before

$selPath = 0;

 

find

$pInfo = new objectInfo($pInfo_array);

add below:

$selPath = $cPath;

 

find

$cPath_back = '';

add before

if ($selPath > 0)		$cPath = $selPath;

 

now everything works correctly for me ;)

Edited by sirphoenix
Link to comment
Share on other sites

  • 2 weeks later...

I got a quick question.

 

Which of these changes have been included in the 3.0 version, and which ones would I need to fix manually?

 

Also, is this contribution still being updated?

 

It's so sad to see that there isn't a proper bug-free contribution for this kind of functionality. Most needed imo.

Link to comment
Share on other sites

  • 2 months later...

Hi, Has anyone found out how to fix this issue yet? i'm still having problems with the page's going back to page 1 and the move / delete / edit etc not working.

 

This is the only contrib i can find that adds this functionality to osc its a shame that its got a few bugs.

 

Please could someone help me.

Link to comment
Share on other sites

  • 3 months later...

Hello,

I have installed the latest version posted to the contribution page http://www.oscommerce.com/community/contributions,1965 The one posted by Patty. I still have the problem of being redirected to the first page of the category rather than the page with the item selected from the search. For example if I search for heavy and I get a search results page with 13 items. If I select the 11th item and it should be on the 10th page of the "H" category I am sent to the 1st page of the "H" category instead. I know that this bug was posted here before. It seems that there were other bugs that were addressed and this one was lost in the mix.

thanks

Christian

On your last day only you will have to approve or disaprove of how your life has been.

Link to comment
Share on other sites

  • 3 weeks later...

Hello All,

I am still having problems with this contribution I am wondering if there is anyone still helping with it? The current issue is this error

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'limit 0, 30' at line 1

limit 0, 30

[TEP STOP]

on this page http://www.oursite.com/Shop/admin/categories.php? PHP Version 5.2.4 Any help would be appreciated.

Thanks

On your last day only you will have to approve or disaprove of how your life has been.

Link to comment
Share on other sites

Installed this contribution in my heavily modefied shop this morning in about 10 minutes...

 

So far no problems... Paging works like a charm

Editing a product has no problems so far

Moving products from one category to another works easily a well.

 

Thanks for somethingthat has just made my life easier!

Link to comment
Share on other sites

  • 4 weeks later...

I am using the file that came with 3.0. However, when I click on ANY info to bring up the edit/delete/etc buttons, it does not appear. Any help?

 

EDIT: This does not happen on page 1, but all the other pages...

When I click on any product on any other page than one, it brings the product permanently to the first page it seems. What gives?

Edited by JangoF
Link to comment
Share on other sites

  • 3 weeks later...

Getting a weird glitch with this.

When I try to copy a product using the link method, for some reason it appears to think it is already associated

to some of the sub categories within the main category i am in.

 

Checking in products_to_categories via the database confirm there are no associations to sub categories,

just the product ID to the top level category.

 

I can not see how it can create a false association if it is not reading it from the database ?

 

Any ideas how or why it might be doing this ?

 

Thank you for any help in advance. ;)

Link to comment
Share on other sites

New version 4.0 - everything should be working flawlessly now. Check it out ;)

Link to comment
Share on other sites

Tested and working great as far as I can tell. Excellent work dr_lucas ;)

 

Thank you, Jango ;)

Link to comment
Share on other sites

Hello All,

I am still having problems with this contribution I am wondering if there is anyone still helping with it? The current issue is this error

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'limit 0, 30' at line 1

limit 0, 30

[TEP STOP]

on this page http://www.oursite.com/Shop/admin/categories.php? PHP Version 5.2.4 Any help would be appreciated.

Thanks

 

 

 

Hi I am getting the same SQL error. How can I solve this?

Link to comment
Share on other sites

Hi I am getting the same SQL error. How can I solve this?

 

Hi, I am also getting the exact same error using v3.0, I have even added the /includes/classes/split_page_results.php bugfix in both admin and catalog side.

 

 

 

$this->sql_query .= " limit " . $offset . ", " . $this->number_of_rows_per_page;

(line about 66)

insert before it

if($offset <0 ) $offset = 0;

 

 

and this hasnt worked either! This seems to be a MYSQL 5 error? Could it be in the sql

 

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 
);

 

Notice the date?:

 

'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

 

Would changing the date fix this? or does this need mysql5 parentheses?

 

Thanks

Any help appreciated!

Chris

Link to comment
Share on other sites

Hi, I am also getting the exact same error using v3.0, I have even added the /includes/classes/split_page_results.php bugfix in both admin and catalog side.

 

 

 

$this->sql_query .= " limit " . $offset . ", " . $this->number_of_rows_per_page;

(line about 66)

insert before it

if($offset <0 ) $offset = 0;

 

 

and this hasnt worked either! This seems to be a MYSQL 5 error? Could it be in the sql

 

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 
);

 

Notice the date?:

 

'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

 

Would changing the date fix this? or does this need mysql5 parentheses?

 

Thanks

Any help appreciated!

Chris

 

You can solve it by using the latest version (v4.0) that I contributed.

Link to comment
Share on other sites

You can solve it by using the latest version (v4.0) that I contributed.

 

Ahh great, I'm glad thats fixed! but unfortunately, I'm using a store with over 50 mods intregrated so it will be hard to compare and merge.

 

I might try to compare to a non modified version and write manual install instructions for people like me with modded store.

 

Thanks

Link to comment
Share on other sites

Ahh great, I'm glad thats fixed! but unfortunately, I'm using a store with over 50 mods intregrated so it will be hard to compare and merge.

 

I might try to compare to a non modified version and write manual install instructions for people like me with modded store.

 

Thanks

 

Yep, good idea... ;)

Link to comment
Share on other sites

  • 2 months later...
New version 4.0 - everything should be working flawlessly now. Check it out ;)

 

Yes, I have to agree with JangoF, it is excelent work.

 

But I have one little problem. Page couter doesn't work correctly for first record on any next page.

I try to explain on example:

I have products splited up to two pages. I look for product (via search box) which is usually on first row at second page. I have got a result and I click to the row. And now I'm redirected to the first page instead of the second page.

 

I'm thinking that $count (on line number 865) have to start from 1

 

P.S. excuse me my english

Link to comment
Share on other sites

  • 2 weeks later...

I see the following problems:

 

1) I have Zdenek's problem also.

 

2) COPYING or DELETING a product from any page other than the first page does not work. It also does not work if one copies the product from a search.

 

Does anyone have any idea as to how to address these problems? I have about 400 products in a category, and need to copy a lot to a different category. What to do?

 

(It seems to be somehow flawed, when it goes into the 'confirm' cases (e.g. delete_product_confrim etc.))

 

Finally, I LOVE the contribution, and it seems to work elegantly for most everything, and I very much want to be able to use it. Anyone else seeing these issues?

 

--A

Edited by acb
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...