Forums / Managing Customers and Orders / Is it possible to disable buying only in one category?

Is it possible to disable buying only in one category?

Views: 5,239

Results 1 to 20 of 52
3 Apr 2013, 5:03 PM
#1
nandor avatar

nandor

Zen Follower

Join Date:
Sep 2012
Posts:
104
Plugin Contributions:
0

Is it possible to disable buying only in one category?

Hi All!

Is it possible to disable , in admin , the order of one category?
For example :

pendants - costumer can buy every product in this category/subcategory
packaging - this is only for showcase, so that costumer can see the packaging types.

thanks in advance

Nandor

3 Apr 2013, 6:15 PM
#2
ajeh avatar

ajeh

Oba-san

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

Re: Is it possible to disable buying only in one category?

Let's say you wanted all Products that have master_categories_id 12 to be Call for Price (or change to what ever you want it to read/link to) ...

Edit the file:
/includes/functions/functions_general.php

and add the code in RED around line 1101:

[B]// bof: show room only for master_categories_id 12
//echo 'Products ID: ' . $product_id . ' Master Cat: ' . zen_get_products_category_id($product_id) . '<br>';
  if (zen_get_products_category_id($product_id) == 12) {
    return '<a href="' . zen_href_link(FILENAME_CONTACT_US) . '">' . TEXT_CALL_FOR_PRICE . '</a>';
  }
// eof: show room only for master_categories_id 12

[/B]    $button_check = $db->Execute("select product_is_call, products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . (int)$product_id . "'");

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!

3 Apr 2013, 6:16 PM
#3
ajeh avatar

ajeh

Oba-san

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

Re: Is it possible to disable buying only in one category?

NOTE: you could also use a Product Type for this to change the behavior from a Product General to a Document Product and turn off the ability to Add to Cart on those ...

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!

4 Apr 2013, 5:10 AM
#4
nandor avatar

nandor

Zen Follower

Join Date:
Sep 2012
Posts:
104
Plugin Contributions:
0

Re: Is it possible to disable buying only in one category?

Ajeh:

NOTE: you could also use a Product Type for this to change the behavior from a Product General to a Document Product and turn off the ability to Add to Cart on those ...

Hello!

The second one seems easier! i changed it to document product, but how/where , in admin, can i turn off the ability to add to cart, just for this category?

thanks in advance

N.

4 Apr 2013, 6:56 AM
#5
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Is it possible to disable buying only in one category?

Nandor:

Hello!

The second one seems easier! i changed it to document product, but how/where , in admin, can i turn off the ability to add to cart, just for this category?

thanks in advance

N.

catalog->Product Types.... edit

Cheers
Rod

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.

4 Apr 2013, 12:44 PM
#6
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: Is it possible to disable buying only in one category?

I may be thinking of something else, but i don't believe it's possible to change the Product Type of an existing product. I think you'll have to recreate the products using the new Product Type.

4 Apr 2013, 4:54 PM
#7
nandor avatar

nandor

Zen Follower

Join Date:
Sep 2012
Posts:
104
Plugin Contributions:
0

Re: Is it possible to disable buying only in one category?

stevesh:

I may be thinking of something else, but i don't believe it's possible to change the Product Type of an existing product. I think you'll have to recreate the products using the new Product Type.

Doesnt work either way. Recreated category. When i create a new category "Restrict to product type" is not given. When i enter this category again (after having created) there is the choice "Restrict to product type" , i set it to Document-general instead of Product-general. till now its ok. But when i reenter edit this category it is automatically set back to Product-general. (before this i changed the product types setting of document -general to No (cant be added to cart)

thanks

Nandor

5 Apr 2013, 12:13 PM
#8
nandor avatar

nandor

Zen Follower

Join Date:
Sep 2012
Posts:
104
Plugin Contributions:
0

Re: Is it possible to disable buying only in one category?

Ajeh:

Let's say you wanted all Products that have master_categories_id 12 to be Call for Price (or change to what ever you want it to read/link to) ...

Edit the file:
/includes/functions/functions_general.php

and add the code in RED around line 1101:

[B]// bof: show room only for master_categories_id 12
//echo 'Products ID: ' . $product_id . ' Master Cat: ' . zen_get_products_category_id($product_id) . '<br>';
if (zen_get_products_category_id($product_id) == 12) {
return '<a href="' . zen_href_link(FILENAME_CONTACT_US) . '">' . TEXT_CALL_FOR_PRICE . '</a>';
}
// eof: show room only for master_categories_id 12

[/B] $button_check = $db->Execute("select product_is_call, products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . (int)$product_id . "'");



i tried this solution. Master cat. id is 58, i rewrote it but the add this to my cart is still there.
So you can buy from this category.

thanks

Nandor
5 Apr 2013, 1:10 PM
#9
ajeh avatar

ajeh

Oba-san

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

Re: Is it possible to disable buying only in one category?

Check and make sure that in the table:
products

58 is the actual master_categories_id of the Product(s) in the table ...

Also, look at the upgrades for v1.3.9e to v1.3.9h ... I cannot recall what version the master_categories_id look up issues were all cleaned up ...
http://www.zen-cart.com/showthread.php?153143-Known-Bugs-%28and-fixes%29-with-v1-3-9

Another check is to look in the functions_lookups.php and make sure the function zen_get_products_category_id reads:

  function zen_get_products_category_id($products_id) {
    global $db;

    $the_products_category_query = "select products_id, master_categories_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'";
    $the_products_category = $db->Execute($the_products_category_query);

    return $the_products_category->fields['master_categories_id'];
  }

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!

5 Apr 2013, 2:30 PM
#10
nandor avatar

nandor

Zen Follower

Join Date:
Sep 2012
Posts:
104
Plugin Contributions:
0

Re: Is it possible to disable buying only in one category?

Ajeh:

Check and make sure that in the table:
products

58 is the actual master_categories_id of the Product(s) in the table ...

Also, look at the upgrades for v1.3.9e to v1.3.9h ... I cannot recall what version the master_categories_id look up issues were all cleaned up ...
http://www.zen-cart.com/showthread.php?153143-Known-Bugs-%28and-fixes%29-with-v1-3-9

Another check is to look in the functions_lookups.php and make sure the function zen_get_products_category_id reads:

function zen_get_products_category_id($products_id) {
global $db;

$the_products_category_query = "select products_id, master_categories_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'";
$the_products_category = $db->Execute($the_products_category_query);

return $the_products_category->fields['master_categories_id'];

}


**Is this the master cat. id:**

Attachment 12306


i found this in functions lookups php :

function zen_get_products_category_id($products_id) {
    global $db;

    $the_products_category_query = "select products_id, master_categories_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'";
    $the_products_category = $db->Execute($the_products_category_query);

    return $the_products_category->fields['master_categories_id'];
  }

thanks

Nandor
5 Apr 2013, 3:11 PM
#11
ajeh avatar

ajeh

Oba-san

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

Re: Is it possible to disable buying only in one category?

Now go into Category 58 (Packaging) and edit the Product ... Does it show:

Product Master Category: ID# 58 Packaging

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!

5 Apr 2013, 3:50 PM
#12
nandor avatar

nandor

Zen Follower

Join Date:
Sep 2012
Posts:
104
Plugin Contributions:
0

Re: Is it possible to disable buying only in one category?

Ajeh:

Now go into Category 58 (Packaging) and edit the Product ... Does it show:

yes it does :

Product Master Category: ID# 58 Packaging

5 Apr 2013, 4:02 PM
#13
ajeh avatar

ajeh

Oba-san

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

Re: Is it possible to disable buying only in one category?

For giggles and grins ... can you change the code to show uncomment the echo:

// bof: show room only for master_categories_id 12
[B]echo 'Products ID: ' . $product_id . ' Master Cat: ' . zen_get_products_category_id($product_id) . '<br>';
[/B]  if (zen_get_products_category_id($product_id) == 12) {
    return '<a href="' . zen_href_link(FILENAME_CONTACT_US) . '">' . TEXT_CALL_FOR_PRICE . '</a>';
  }
// eof: show room only for master_categories_id 12

and go to that Category/Product and what do you see?

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!

5 Apr 2013, 4:27 PM
#14
nandor avatar

nandor

Zen Follower

Join Date:
Sep 2012
Posts:
104
Plugin Contributions:
0

Re: Is it possible to disable buying only in one category?

Ajeh:

For giggles and grins ... can you change the code to show uncomment the echo:

// bof: show room only for master_categories_id 12
[B]echo 'Products ID: ' . $product_id . ' Master Cat: ' . zen_get_products_category_id($product_id) . '<br>';
[/B] if (zen_get_products_category_id($product_id) == 12) {
return '<a href="' . zen_href_link(FILENAME_CONTACT_US) . '">' . TEXT_CALL_FOR_PRICE . '</a>';
}
// eof: show room only for master_categories_id 12

> 
> and go to that Category/Product and what do you see?


**I deleted this before echo : //  (hope you meant this by changing the code to show uncomment the echo)

saw category/product and see the same in admin :
Product Master Category: 	ID# 58 Packaging

and you can see the add this to my cart button.

Nandor**
5 Apr 2013, 6:23 PM
#15
ajeh avatar

ajeh

Oba-san

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

Re: Is it possible to disable buying only in one category?

And the line:

  if (zen_get_products_category_id($product_id) == 12) {

you changed to:

  if (zen_get_products_category_id($product_id) == [B]58[/B]) {

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!

6 Apr 2013, 3:02 AM
#16
ajeh avatar

ajeh

Oba-san

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

Re: Is it possible to disable buying only in one category?

If you switch to the Classic Template ... does this work correctly?

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!

6 Apr 2013, 4:10 AM
#17
nandor avatar

nandor

Zen Follower

Join Date:
Sep 2012
Posts:
104
Plugin Contributions:
0

Re: Is it possible to disable buying only in one category?

Ajeh:

If you switch to the Classic Template ... does this work correctly?

switched to classic template in admin/tools/template selection. It is the same as previously , you can buy from this category.

6 Apr 2013, 12:45 PM
#18
ajeh avatar

ajeh

Oba-san

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

Re: Is it possible to disable buying only in one category?

Could you Zip and post as an attachment your file, from the server, for:
/includes/functions/functions_general.php

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!

6 Apr 2013, 4:36 PM
#19
nandor avatar

nandor

Zen Follower

Join Date:
Sep 2012
Posts:
104
Plugin Contributions:
0

Re: Is it possible to disable buying only in one category?

Ajeh:

Could you Zip and post as an attachment your file, from the server, for:
/includes/functions/functions_general.php

Attachment #12314

thanks

6 Apr 2013, 5:19 PM
#20
ajeh avatar

ajeh

Oba-san

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

Re: Is it possible to disable buying only in one category?

You have the code in the wrong place ... :eek:

Remove the new code that I gave you:

// bof: show room only for master_categories_id 58
echo 'Products ID: ' . $product_id . ' Master Cat: ' . zen_get_products_category_id($product_id) . '<br>';
  if (zen_get_products_category_id($product_id) == 58) {
    return '<a href="' . zen_href_link(FILENAME_CONTACT_US) . '">' . TEXT_CALL_FOR_PRICE . '</a>';
  }
// eof: show room only for master_categories_id 58

and go lower in the code and find the code that starts with:

    }

    $button_check = $db->Execute("select product_is_call, products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . (int)$product_id . "'");
    switch (true) {
// cannot be added to the cart

Put it just below the } and above the line starting with $button_check so it reads:

    }

// bof: show room only for master_categories_id 58
echo 'Products ID: ' . $product_id . ' Master Cat: ' . zen_get_products_category_id($product_id) . '<br>';
  if (zen_get_products_category_id($product_id) == 58) {
    return '<a href="' . zen_href_link(FILENAME_CONTACT_US) . '">' . TEXT_CALL_FOR_PRICE . '</a>';
  }
// eof: show room only for master_categories_id 58


    $button_check = $db->Execute("select product_is_call, products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . (int)$product_id . "'");
    switch (true) {
// cannot be added to the cart

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!