Page 1 of 1

Product disappear from admin product list

Posted: Mon Oct 12, 2020 3:34 pm
by rocketninjin
Hi,
I am having issue with my OC 3.0.3.2. I have a few products completely disappear from the admin page, but these items still appear in the store front.
I saw the item inside the DB and I have to disable the item in the from DB.
What would be the potential reason causing this issue happen?

Thank you.

Re: Product disappear from admin product list

Posted: Mon Oct 12, 2020 5:29 pm
by sw!tch
rocketninjin wrote:
Mon Oct 12, 2020 3:34 pm
Hi,
I am having issue with my OC 3.0.3.2. I have a few products completely disappear from the admin page, but these items still appear in the store front.
I saw the item inside the DB and I have to disable the item in the from DB.
What would be the potential reason causing this issue happen?

Thank you.
Well, looking at the getProducts() query .
https://github.com/opencart/opencart/bl ... t.php#L359

Code: Select all

WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "'";
^ Maybe language id doesn't match or is missing on those products or differs from what's set in your admin.

Compare some products that show with ones that don't in PHPmyAdmin .

Re: Product disappear from admin product list

Posted: Mon Oct 12, 2020 8:01 pm
by rocketninjin
Thank you very much for your reply.
I had a look at the database language id, in the product description, the language id is correct and nothing missing compare to the "normal" one.
Not sure where the error comes from. :-\
sw!tch wrote:
Mon Oct 12, 2020 5:29 pm
rocketninjin wrote:
Mon Oct 12, 2020 3:34 pm
Hi,
I am having issue with my OC 3.0.3.2. I have a few products completely disappear from the admin page, but these items still appear in the store front.
I saw the item inside the DB and I have to disable the item in the from DB.
What would be the potential reason causing this issue happen?

Thank you.
Well, looking at the getProducts() query .
https://github.com/opencart/opencart/bl ... t.php#L359

Code: Select all

WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "'";
^ Maybe language id doesn't match or is missing on those products or differs from what's set in your admin.

Compare some products that show with ones that don't in PHPmyAdmin .

Re: Product disappear from admin product list

Posted: Tue Oct 13, 2020 4:36 am
by sw!tch
Any extensions installed?

Try editing a product that shows and when on the product page change the product_id= URL praam to the ID of a product that doesn't show. See if it comes up, make sure you keep your session token. Just change the product_id= param.

Also check your error logs, etc.

Re: Product disappear from admin product list

Posted: Tue Oct 13, 2020 5:50 am
by straightlight
Not a bug. However, the error logs might unsuccessful to output the results in these particular cases since the action is being redirected back to the original method where the original method kicks back to $this->getForm(). To troubleshooting this issue more closely, in your admin/controller/catalog/product.php file,

in the add() and edit() method, find:

Code: Select all

if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
add below each:

Code: Select all

echo "<pre />\n";
print_r($this->request->post);
echo "</pre>\n";
exit;
Then, save the file. Then, reload your OC admin > catalog > products page. Retry the action you are reporting about and post the array that you see on the screen once the product is, either, created or edited.

Re: Product disappear from admin product list

Posted: Tue Oct 13, 2020 8:31 am
by rocketninjin
I have installed ADV Profit extension to show sales history and order history.
I can access the product with the method you suggest (product_id=).
There is nothing special inside the product, just same as the others that function properly.
sw!tch wrote:
Tue Oct 13, 2020 4:36 am
Any extensions installed?

Try editing a product that shows and when on the product page change the product_id= URL praam to the ID of a product that doesn't show. See if it comes up, make sure you keep your session token. Just change the product_id= param.

Also check your error logs, etc.

Re: Product disappear from admin product list

Posted: Tue Oct 13, 2020 8:34 am
by rocketninjin
Thanks for the reply.
I have add the code to the add() and edit() function.
There is nothing special when I try to retrieve the list again, the filter box can find the product name and the model code. I tried to filter there and nothing show up in the product list. There is nothing print from the script that you given to me too.

Is there any other file I need to modify to show the error?
straightlight wrote:
Tue Oct 13, 2020 5:50 am
Not a bug. However, the error logs might unsuccessful to output the results in these particular cases since the action is being redirected back to the original method where the original method kicks back to $this->getForm(). To troubleshooting this issue more closely, in your admin/controller/catalog/product.php file,

in the add() and edit() method, find:

Code: Select all

if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
add below each:

Code: Select all

echo "<pre />\n";
print_r($this->request->post);
echo "</pre>\n";
exit;
Then, save the file. Then, reload your OC admin > catalog > products page. Retry the action you are reporting about and post the array that you see on the screen once the product is, either, created or edited.

Re: Product disappear from admin product list

Posted: Tue Oct 13, 2020 8:40 am
by sw!tch
sw!tch wrote:
Tue Oct 13, 2020 4:36 am
Try editing a product that shows and when on the product page change the product_id= URL praam to the ID of a product that doesn't show. See if it comes up, make sure you keep your session token. Just change the product_id= param.
rocketninjin wrote:
Tue Oct 13, 2020 8:31 am
I can access the product with the method you suggest (product_id=).
There is nothing special inside the product, just same as the others that function properly.
So it shows up when you manually enter the product id?

Try saving the product once you do this. See if it then shows up.

Re: Product disappear from admin product list

Posted: Tue Oct 13, 2020 10:05 am
by letxobnav
if disappearing from the list, check the query by adding:

Code: Select all

$this->log->write($sql);
before:

Code: Select all

		$query = $this->db->query($sql);
in admin/model/catalog/product.php

and see what the query is in your oc error log.
probably sort order or a filter.

Re: Product disappear from admin product list

Posted: Wed Oct 14, 2020 9:47 pm
by rocketninjin
Tried to edit the information within the product and save again. Nothing change, still disappear in the list.
sw!tch wrote:
Tue Oct 13, 2020 8:40 am
sw!tch wrote:
Tue Oct 13, 2020 4:36 am
Try editing a product that shows and when on the product page change the product_id= URL praam to the ID of a product that doesn't show. See if it comes up, make sure you keep your session token. Just change the product_id= param.
rocketninjin wrote:
Tue Oct 13, 2020 8:31 am
I can access the product with the method you suggest (product_id=).
There is nothing special inside the product, just same as the others that function properly.
So it shows up when you manually enter the product id?

Try saving the product once you do this. See if it then shows up.

Re: Product disappear from admin product list

Posted: Wed Oct 14, 2020 10:06 pm
by straightlight
rocketninjin wrote:
Wed Oct 14, 2020 9:47 pm
Tried to edit the information within the product and save again. Nothing change, still disappear in the list.
sw!tch wrote:
Tue Oct 13, 2020 8:40 am
sw!tch wrote:
Tue Oct 13, 2020 4:36 am
Try editing a product that shows and when on the product page change the product_id= URL praam to the ID of a product that doesn't show. See if it comes up, make sure you keep your session token. Just change the product_id= param.
rocketninjin wrote:
Tue Oct 13, 2020 8:31 am
I can access the product with the method you suggest (product_id=).
There is nothing special inside the product, just same as the others that function properly.
So it shows up when you manually enter the product id?

Try saving the product once you do this. See if it then shows up.
Then my suggestion above may help you to track the source of the issue. It's somewhere within the array or while the data gets inserted on the database. Both needs to be troubleshoot one at a time.

Re: Product disappear from admin product list

Posted: Wed Oct 14, 2020 10:25 pm
by rocketninjin
I have added the code to the PHP file.
I tried to filter to look for the product, the autocomplete shows the product code but when I apply the filter, there is nothing in the list.
Checked the error log, there is no error either.
letxobnav wrote:
Tue Oct 13, 2020 10:05 am
if disappearing from the list, check the query by adding:

Code: Select all

$this->log->write($sql);
before:

Code: Select all

		$query = $this->db->query($sql);
in admin/model/catalog/product.php

and see what the query is in your oc error log.
probably sort order or a filter.

Re: Product disappear from admin product list

Posted: Wed Oct 14, 2020 10:35 pm
by straightlight
Then, try my solution I already posted: viewtopic.php?f=201&t=220412#p801957 . The results are still unposted on that.