Forums / General Questions / Can t Turn off product in categorie??

Can t Turn off product in categorie??

Started by nicksab on 22 Feb 2012, 7:20 AM · Views: 2,445

Results 1 to 20 of 21
22 Feb 2012, 7:20 AM
#1
nicksab avatar

nicksab

Totally Zenned

Join Date:
Apr 2011
Posts:
592
Plugin Contributions:
0

Can t Turn off product in categorie??

Hey everyone,

http://www.royal-fleur.com

I am having issues with my products in admin.

When i go to categories, i can switch the categories on or off ( green or red square) wich turns off all the product in the specify category.

However, when i go inside the category, i cannot turn off any of the product individually ( linked product or not )

I click on the green button but nothing is happening.

Please help

Thank you in advance

22 Feb 2012, 12:18 PM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Re: Can t Turn off product in categorie??

That should work, but if it doesn't, you should still be able to edit the product and change "In Stock" to "Out of Stock".
If you can't do that, I don't know what could be wrong.

22 Feb 2012, 3:51 PM
#3
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Can t Turn off product in categorie??

If you do a View Source when looking at the Products, and search on:
icon_green

you should find something similar to:

<a href="http://your_domain.com/your_secret_admin/categories.php?action=setflag&flag=0&pID=12&cPath=3_10&page=1"><img src="images/icon_green_on.gif" border="0" alt="Status - Enabled" title=" Status - Enabled "></a>  <img src="images/icon_yellow_on.gif" border="0" alt="Product is Linked" title=" Product is Linked "><br>                </td>

note: the reference to the icon_yellow is for Linked Products ...

Do you find something similar to that?

In the file:
/your_secret_admin/categories.php

you should find:

      case 'setflag':

      if ( isset($_POST['flag']) && ($_POST['flag'] == '0') || ($_POST['flag'] == '1') ) {
        if (isset($_GET['pID'])) {
          zen_set_product_status($_GET['pID'], $_POST['flag']);
        }
      }

      zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $_GET['cPath'] . '&pID=' . $_GET['pID'] . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . ((isset($_GET['search']) && !empty($_GET['search'])) ? '&search=' . $_GET['search'] : '')));
      break;

Do you have that?

In the file:
/your_secret_admin/includes/functions/general.php

you should find:

////
// Sets the status of a product
  function zen_set_product_status($products_id, $status) {
    global $db;
    if ($status == '1') {
      return $db->Execute("update " . TABLE_PRODUCTS . "
                           set products_status = 1, products_last_modified = now()
                           where products_id = '" . (int)$products_id . "'");

    } elseif ($status == '0') {
      return $db->Execute("update " . TABLE_PRODUCTS . "
                           set products_status = 0, products_last_modified = now()
                           where products_id = '" . (int)$products_id . "'");

    } else {
      return -1;
    }
  }

Do you find that?

Go to a Category of Products and when you click on the Green Icon, does the screen reload?

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

22 Feb 2012, 6:53 PM
#4
nicksab avatar

nicksab

Totally Zenned

Join Date:
Apr 2011
Posts:
592
Plugin Contributions:
0

Re: Can t Turn off product in categorie??

gjh42:

That should work, but if it doesn't, you should still be able to edit the product and change "In Stock" to "Out of Stock".
If you can't do that, I don't know what could be wrong.

I can change from stock to out of stock but it won t fix my problem.

Some of my products are linked into different categories. If i turn the category off ( red icon ), all the products inside that category are inactive and i cannot turn the linked product back on unless i switch the whole category to green again.

22 Feb 2012, 6:57 PM
#5
nicksab avatar

nicksab

Totally Zenned

Join Date:
Apr 2011
Posts:
592
Plugin Contributions:
0

Re: Can t Turn off product in categorie??

Ajeh:

If you do a View Source when looking at the Products, and search on:
icon_green

you should find something similar to:

<a href="http://your_domain.com/your_secret_admin/categories.php?action=setflag&flag=0&pID=12&cPath=3_10&page=1"><img src="images/icon_green_on.gif" border="0" alt="Status - Enabled" title=" Status - Enabled "></a>  <img src="images/icon_yellow_on.gif" border="0" alt="Product is Linked" title=" Product is Linked "><br> </td>

> 
> note: the reference to the icon_yellow is for Linked Products ...
> 
> Do you find something similar to that?
> 
> In the file:
> /your_secret_admin/categories.php
> 
> you should find:
> ```
      case 'setflag':

      if ( isset($_POST['flag']) && ($_POST['flag'] == '0') || ($_POST['flag'] == '1') ) {
        if (isset($_GET['pID'])) {
          zen_set_product_status($_GET['pID'], $_POST['flag']);
        }
      }

      zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $_GET['cPath'] . '&pID=' . $_GET['pID'] . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . ((isset($_GET['search']) && !empty($_GET['search'])) ? '&search=' . $_GET['search'] : '')));
      break;

Do you have that?

In the file:
/your_secret_admin/includes/functions/general.php

you should find:

////
// Sets the status of a product
function zen_set_product_status($products_id, $status) {
global $db;
if ($status == '1') {
return $db->Execute("update " . TABLE_PRODUCTS . "
set products_status = 1, products_last_modified = now()
where products_id = '" . (int)$products_id . "'");

} elseif ($status == '0') {
  return $db->Execute("update " . TABLE_PRODUCTS . "
                       set products_status = 0, products_last_modified = now()
                       where products_id = '" . (int)$products_id . "'");

} else {
  return -1;
}

}

> 
> Do you find that?
> 
> Go to a Category of Products and when you click on the Green Icon, does the screen reload?

I checked what you suggested and i do have all of this. 

When i go inside of a category of product, the screen does reload but the icon are staying greens. 

I can turn the category off which turn all the product inside that category off but I am not able to turn any of the product individually inside each category on or off. 

The screens reload but product stays greens if category on

the screens reload but product stays red if category off

Please help

Thank you
22 Feb 2012, 7:02 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Can t Turn off product in categorie??

I cannot reproduce this issue ...

What version of Zen Cart?

Clean Install or an Upgrade?

Has this ever worked for you?

If so, have you added any add ons since this last worked for you?

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

22 Feb 2012, 7:24 PM
#7
nicksab avatar

nicksab

Totally Zenned

Join Date:
Apr 2011
Posts:
592
Plugin Contributions:
0

Re: Can t Turn off product in categorie??

Ajeh:

I cannot reproduce this issue ...

What version of Zen Cart?

Clean Install or an Upgrade?

Has this ever worked for you?

If so, have you added any add ons since this last worked for you?

I am using zen cart 1.5

It was working before until yesterday and i have not added anything ( add on )

What s strange is that is that i can switch on/off the main categories but not the products inside of it

22 Feb 2012, 7:28 PM
#8
nicksab avatar

nicksab

Totally Zenned

Join Date:
Apr 2011
Posts:
592
Plugin Contributions:
0

Re: Can t Turn off product in categorie??

Ajeh:

I cannot reproduce this issue ...

What version of Zen Cart?

Clean Install or an Upgrade?

Has this ever worked for you?

If so, have you added any add ons since this last worked for you?

I have the same setup in 2 other stores and it works fine

Could it be coming from the mysql database which does not let the the product swtch off or on?

Or is something is messed up in the admin part?

22 Feb 2012, 7:31 PM
#9
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Can t Turn off product in categorie??

On the one not working do you manage everything manually in the Admin or do you import?

Was this a clean install or an upgrade?

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

22 Feb 2012, 7:52 PM
#10
nicksab avatar

nicksab

Totally Zenned

Join Date:
Apr 2011
Posts:
592
Plugin Contributions:
0

Re: Can t Turn off product in categorie??

Ajeh:

On the one not working do you manage everything manually in the Admin or do you import?

Was this a clean install or an upgrade?

it was clean install and i manage everything manually.

as add on, i have sitemap xml, ceon uri , delivery date but i don t thing it has to do with them since it was working before

22 Feb 2012, 7:54 PM
#11
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Can t Turn off product in categorie??

Very odd ...

Are you able to make a Test directory with a Test Database and install the Demo data and test this to see if it is working on that server still?

If so, can you compare the Live Admin to the Test Admin and see if you are seeing any changes in the code with something like Beyond Compare from scootersoftware.com ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

29 Feb 2012, 7:45 AM
#12
nicksab avatar

nicksab

Totally Zenned

Join Date:
Apr 2011
Posts:
592
Plugin Contributions:
0

Re: Can t Turn off product in categorie??

Ajeh:

Very odd ...

Are you able to make a Test directory with a Test Database and install the Demo data and test this to see if it is working on that server still?

If so, can you compare the Live Admin to the Test Admin and see if you are seeing any changes in the code with something like Beyond Compare from scootersoftware.com ...

no i am not and i am having bigger issues now. My product won t show up on the info page. i have everything except the product image / description.... basically the center column is blank

29 Feb 2012, 5:41 PM
#13
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Can t Turn off product in categorie??

This seems to be working now ... what was the solution? :unsure:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

29 Feb 2012, 7:13 PM
#14
nicksab avatar

nicksab

Totally Zenned

Join Date:
Apr 2011
Posts:
592
Plugin Contributions:
0

Re: Can t Turn off product in categorie??

Ajeh:

This seems to be working now ... what was the solution? :unsure:

I thought it was coming from the admin folder but i was wrong. It was a corrupted database so i had to drop everything except product and install a clean database and import the product again. It would have been easier if had a more up to date backup but at least it is working for now.

Thanks for helping though

29 Feb 2012, 7:25 PM
#15
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Can t Turn off product in categorie??

Thanks for the update on what the problem was ... remember backups make the world go 'round ... :cool:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

16 Aug 2012, 7:29 AM
#16
pasi avatar

pasi

Zen Follower

Join Date:
Mar 2004
Location:
Finland
Posts:
435
Plugin Contributions:
1

Re: Can t Turn off product in categorie??

I can confirm this, as a customer of mine just called me and asked why he can't switch products on/off after upgrade to 1.5.0

The green/red tab in the categories list has a link like this:
categories.php?action=setflag&flag=0&pID=6743&cPath=871_946_933&page=1

But the code that handles it reads:

      if ( isset($_POST['flag']) && ($_POST['flag'] == '0') || ($_POST['flag'] == '1') ) {
        if (isset($_GET['pID'])) {
          zen_set_product_status($_GET['pID'], $_POST['flag']);
        }
      }

Switching the $_POST to $_GET solved the problem :)

Working with Zen Cart since 2003 :: www.prr.fi
Author of the original Finnish language pack for Zen Cart since 2004

24 Aug 2012, 11:37 PM
#17
cefyn avatar

cefyn

New Zenner

Join Date:
May 2007
Posts:
87
Plugin Contributions:
1

Re: Can t Turn off product in categorie??

pasi:

I can confirm this, as a customer of mine just called me and asked why he can't switch products on/off after upgrade to 1.5.0

The green/red tab in the categories list has a link like this:
categories.php?action=setflag&flag=0&pID=6743&cPath=871_946_933&page=1

But the code that handles it reads:

  if ( isset($_POST['flag']) && ($_POST['flag'] == '0') || ($_POST['flag'] == '1') ) {
    if (isset($_GET['pID'])) {
      zen_set_product_status($_GET['pID'], $_POST['flag']);
    }
  }
> 
> 
> 
> Switching the $_POST to $_GET solved the problem :)

Thanks for posting this,I had the same problem and you solved it for me,too.
30 Aug 2012, 8:26 PM
#18
3rdcoast avatar

3rdcoast

New Zenner

Join Date:
Feb 2005
Location:
Houghton, MI, USA
Posts:
16
Plugin Contributions:
0

Re: Can t Turn off product in categorie??

pasi:

  if ( isset($_POST['flag']) && ($_POST['flag'] == '0') || ($_POST['flag'] == '1') ) {
    if (isset($_GET['pID'])) {
      zen_set_product_status($_GET['pID'], $_POST['flag']);
    }
  }
> 
> Switching the $_POST to $_GET solved the problem :)

Which file did you find this code in?  Would you post the updated code, please?  Thanks!
31 Aug 2012, 4:38 AM
#19
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Can t Turn off product in categorie??

pasi:

I can confirm this, as a customer of mine just called me and asked why he can't switch products on/off after upgrade to 1.5.0

The green/red tab in the categories list has a link like this:
categories.php?action=setflag&flag=0&pID=6743&cPath=871_946_933&page=1

But the code that handles it reads:

  if ( isset($_POST['flag']) && ($_POST['flag'] == '0') || ($_POST['flag'] == '1') ) {
    if (isset($_GET['pID'])) {
      zen_set_product_status($_GET['pID'], $_POST['flag']);
    }
  }
> 
> Switching the $_POST to $_GET solved the problem :)

Do you mean switching ALL instances of $_POST to $_GET ?

Such as...

```php
      if ( isset($_GET['flag']) && ($_GET['flag'] == '0') || ($_GET['flag'] == '1') ) {
        if (isset($_GET['pID'])) {
          zen_set_product_status($_GET['pID'], $_GET['flag']);
        }
      }

20 years a Zencart User

1 Sep 2012, 7:58 PM
#20
sph avatar

sph

Totally Zenned

Join Date:
Jan 2006
Posts:
1,556
Plugin Contributions:
0

Re: Can t Turn off product in categorie??

I just upgraded my main site to 1.5 yesterday via a fresh install. I knew that Image Handler 4 caused a similar problem and I used it's posted fix to be able to turn on/off products via the green/red button in admin.

Now I just notice that I'm having a similar problem with Specials: cannot turn them on/off via their green/red button in admin. Surely someone has come across this before, as 1.5 has been out for awhile. Will probably have to search more.

Steve
prommart.com