-
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
-
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:
Code:
// 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
$button_check = $db->Execute("select product_is_call, products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . (int)$product_id . "'");
-
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 ...
-
Re: Is it possible to disable buying only in one category?
Quote:
Originally Posted by
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.
-
Re: Is it possible to disable buying only in one category?
Quote:
Originally Posted by
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
-
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.
-
Re: Is it possible to disable buying only in one category?
Quote:
Originally Posted by
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
-
Re: Is it possible to disable buying only in one category?
Quote:
Originally Posted by
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:
Code:
// 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
$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
-
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.p...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:
Code:
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'];
}
-
1 Attachment(s)
Re: Is it possible to disable buying only in one category?
Quote:
Originally Posted by
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.p...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:
Code:
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
-
Re: Is it possible to disable buying only in one category?
Now go into Category 58 (Packaging) and edit the Product ... Does it show:
Quote:
Product Master Category: ID# 58 Packaging
-
Re: Is it possible to disable buying only in one category?
Quote:
Originally Posted by
Ajeh
Now go into Category 58 (Packaging) and edit the Product ... Does it show:
yes it does :
Product Master Category: ID# 58 Packaging
-
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:
Code:
// 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
and go to that Category/Product and what do you see?
-
Re: Is it possible to disable buying only in one category?
Quote:
Originally Posted by
Ajeh
For giggles and grins ... can you change the code to show uncomment the echo:
Code:
// 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
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
-
Re: Is it possible to disable buying only in one category?
And the line:
Code:
if (zen_get_products_category_id($product_id) == 12) {
you changed to:
Code:
if (zen_get_products_category_id($product_id) == 58) {
-
Re: Is it possible to disable buying only in one category?
If you switch to the Classic Template ... does this work correctly?
-
Re: Is it possible to disable buying only in one category?
Quote:
Originally Posted by
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.
-
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
-
1 Attachment(s)
Re: Is it possible to disable buying only in one category?
Quote:
Originally Posted by
Ajeh
Could you Zip and post as an attachment your file, from the server, for:
/includes/functions/functions_general.php
Attachment 12314
thanks
-
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:
Code:
// 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:
Code:
}
$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:
Code:
}
// 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
-
1 Attachment(s)
Re: Is it possible to disable buying only in one category?
Quote:
Originally Posted by
Ajeh
You have the code in the wrong place ... :eek:
Remove the new code that I gave you:
Code:
// 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:
Code:
}
$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:
Code:
}
// 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
It works!!!!
Thanks!!!
I'd have two more questions regarding this issue :
Attachment 12315
Why does it show this :Products ID: 133 Master Cat: 58 - How can i make this dissapear or prevent showing this info. in cas of other items later?
In case i'd like to have two or three other categories like this, for showroom only, do i only have to write the other category id's next to this one? Or doe it work differently?
Thanks in advance
Nandor
-
Re: Is it possible to disable buying only in one category?
Quote:
Originally Posted by
Nandor
It works!!!!
Thanks!!!
I'd have two more questions regarding this issue :
Attachment 12315
Why does it show this :
Products ID: 133 Master Cat: 58 - How can i make this dissapear or prevent showing this info. in cas of other items later?
In case i'd like to have two or three other categories like this, for showroom only, do i only have to write the other category id's next to this one? Or doe it work differently?
Thanks in advance
Nandor
I realized in the meantime that after this modification at all products the Products ID...Master Cat:... are shown,
no prices can be seen at the other products (the ones that should be add this to my cart) and under add to cart the word : details isnt translated when switching to german or hungarian. Unless i am mistaken the "detail" word wasnt even there before.
I dont know what all these three things have to do with this one modification....
thanks
Nandor
-
Re: Is it possible to disable buying only in one category?
Did you try going back and comment out the test for the echo to show the products_id and master cat that was just there for testing?
-
Re: Is it possible to disable buying only in one category?
Quote:
Originally Posted by
Ajeh
Did you try going back and comment out the test for the echo to show the products_id and master cat that was just there for testing?
you mean this line (new coding that i pasted):
echo 'Products ID: ' . $product_id . ' Master Cat: ' . zen_get_products_category_id($product_id) . '<br>';
without : // or with?
thanks
Nandor
-
Re: Is it possible to disable buying only in one category?
Quote:
Originally Posted by
Nandor
you mean this line (new coding that i pasted):
echo 'Products ID: ' . $product_id . ' Master Cat: ' . zen_get_products_category_id($product_id) . '<br>';
without : // or with?
thanks
Nandor
I did it with //echo...
Products ID...Master Cat:... - dissapeared
Details word still shown in english, in case of all three languages
And the biggest problem is that the prices cant be seen in HUf. Its ok in Euro.
thanks
Nandor
-
Re: Is it possible to disable buying only in one category?
Quote:
Originally Posted by
Nandor
I did it with //echo...
Products ID...Master Cat:... - dissapeared
Details word still shown in english, in case of all three languages
And the biggest problem is that the prices cant be seen in HUf. Its ok in Euro.
thanks
Nandor
Hello Ajeh!
Me again. I put back the original functions_general.php and the HUF prices still dont show.
Then i put back the modified functions_general.php again and of course the HUF prices still cant be seen. (or prices in Hungarian language)
HAve no idea what could have happened.
thanks
Nandor
-
Re: Is it possible to disable buying only in one category?
You should just need to comment out:
Code:
// echo 'Products ID: ' . $product_id . ' Master Cat: ' . zen_get_products_category_id($product_id) . '<br>';
-
Re: Is it possible to disable buying only in one category?
Quote:
Originally Posted by
Ajeh
You should just need to comment out:
Code:
// echo 'Products ID: ' . $product_id . ' Master Cat: ' . zen_get_products_category_id($product_id) . '<br>';
If it looks like this :
}
// 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>';
}
no prices in HUF and this is displayed at categories and products :Products ID: 127 Master Cat: 53
Products ID: 128 Master Cat: 53 Products ID: 133 Master Cat: 58...etc
if it looks like this :
}
// 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>';
}
no prices displayed in HUF either, these dissapear : :Products ID: 127 Master Cat: 53
Products ID: 128 Master Cat: 53 Products ID: 133 Master Cat: 58...etc
I suppose the HUF prices problem occured at the same time when i did the functions_general.php rewrite, because didnt do anything else at that time.
Dou you have any suggestion what this could be?
thanks
Nandor
-
Re: Is it possible to disable buying only in one category?
What are your currency settings for it?
-
1 Attachment(s)
Re: Is it possible to disable buying only in one category?
Quote:
Originally Posted by
Ajeh
What are your currency settings for it?
Did you mean this? :
Attachment 12327
thanks
Nandor
-
Re: Is it possible to disable buying only in one category?
Could you test by adding a new currency:
Quote:
Title: Euro
Code: EUR
Symbol Left: €
Symbol Right:
Decimal Point: .
Thousands Point: ,
Decimal Places: 2
Last Updated: 01/11/2013
Value: 0.77300000
and after you Insert it, post what you see in the right hand column for it ...
-
Re: Is it possible to disable buying only in one category?
Quote:
Originally Posted by
Ajeh
Could you test by adding a new currency:
and after you Insert it, post what you see in the right hand column for it ...
I already have euro. Is it good if i use the same settings(you wrote) with usd?
-
Re: Is it possible to disable buying only in one category?
For USD use:
Quote:
Title: US Dollar
Code: USD
Symbol Left: $
Symbol Right:
Decimal Point: .
Thousands Point: ,
Decimal Places: 2
Value: 1.36919999
-
3 Attachment(s)
Re: Is it possible to disable buying only in one category?
Quote:
Originally Posted by
Nandor
I already have euro. Is it good if i use the same settings(you wrote) with usd?
I inserted usd. It works. I mean i see the currency. So i see euro, usd but not the forint.
Attachment 12328
Attachment 12329
Attachment 12330
thanks
Nandor
-
Re: Is it possible to disable buying only in one category?
Can you insert another currency called:
Fred
with the same settings that you are using on your broken currency?
-
1 Attachment(s)
Re: Is it possible to disable buying only in one category?
Quote:
Originally Posted by
Ajeh
Can you insert another currency called:
Fred
with the same settings that you are using on your broken currency?
Inserted Fred with HUF currency settings (broken one) doesnt display either
Attachment 12331
-
Re: Is it possible to disable buying only in one category?
Can you edit the broken currency and enter in the Decimal Places: 0 if you want no decimal places ...
See if it suddenly starts working ...
-
Re: Is it possible to disable buying only in one category?
Quote:
Originally Posted by
Ajeh
Can you edit the broken currency and enter in the Decimal Places: 0 if you want no decimal places ...
See if it suddenly starts working ...
It suddenly started working!!!!! Thanks!!!!!!
Dont know why this happened.....surely i did something, because it wouldnt happen because of rewriting the php file, would it?
Nandor
-
Re: Is it possible to disable buying only in one category?
Quote:
Originally Posted by
Nandor
It suddenly started working!!!!! Thanks!!!!!!
Dont know why this happened.....surely i did something, because it wouldnt happen because of rewriting the php file, would it?
Nandor
Dont you happen to know where to modify this "detail" word? I thought i already translated everything....
thanks
Nandor
-
Re: Is it possible to disable buying only in one category?
Quote:
Originally Posted by
Nandor
Dont you happen to know where to modify this "detail" word? I thought i already translated everything....
thanks
Nandor
One last question regarding this problem : if i want another one or two master categories only for showcase how do i rewrite the particular line in the php file?
thanks nandor
-
Re: Is it possible to disable buying only in one category?
Without a numeric value to the decimal places the currency breaks ... putting the 0 there fixes this ...
On adding more master_categories_id you could use:
Code:
if (zen_get_products_category_id($product_id) == 58 || zen_get_products_category_id($product_id) == 32 || zen_get_products_category_id($product_id) == 49) {
-
Re: Is it possible to disable buying only in one category?
Quote:
Originally Posted by
Ajeh
Without a numeric value to the decimal places the currency breaks ... putting the 0 there fixes this ...
On adding more master_categories_id you could use:
Code:
if (zen_get_products_category_id($product_id) == 58 || zen_get_products_category_id($product_id) == 32 || zen_get_products_category_id($product_id) == 49) {
i added one more mastercategory , is this good this way?
// 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 || zen_get_products_category_id($product_id) == 4) {
return '<a href="' . zen_href_link(FILENAME_CONTACT_US) . '">' . TEXT_CALL_FOR_PRICE . '</a>';
}
// eof: show room only for master_categories_id 58
// eof: show room only for master_categories_id 4
No syntax error was displayed, but didnt know whether to add : // eof: show room only for master_categories_id 4
as above
Thanks
Nandor
-
Re: Is it possible to disable buying only in one category?
That is fine ...
The line:
Code:
// eof: show room only for master_categories_id 4
is just a comment in the code, lines that start with //, are just to remind you what you have changed in the code ...
-
Re: Is it possible to disable buying only in one category?
NOTE: That master_categories_id of 4 is not ... or should not ... be a Product's master_categories_id ... 4 is a Top Level Category you might want to check that you are using the right categories_id for the master_categories_id ...
-
Re: Is it possible to disable buying only in one category?
Quote:
Originally Posted by
Ajeh
NOTE: That master_categories_id of 4 is not ... or should not ... be a Product's master_categories_id ... 4 is a Top Level Category you might want to check that you are using the right categories_id for the master_categories_id ...
And how can i change/check these ids?
thanks
Nandor
-
Re: Is it possible to disable buying only in one category?
Go to your Zen Cart Admin and edit the Product ...
What do you see for:
Product Master Category:
-
Re: Is it possible to disable buying only in one category?
Quote:
Originally Posted by
Ajeh
Go to your Zen Cart Admin and edit the Product ...
What do you see for:
Product Master Category:
At ID 4 (category ID ) at product i see : Product Master Category: ID# 59 Mugs
I suppose its not good. Now i have to check all of the products/cat. and rewrite the master category?
thanks
Nandor
-
Re: Is it possible to disable buying only in one category?
ID 4 cannot be a master_categories_id ...
On your site, I see that:
/index.php?main_page=index&cPath=4
holds a Category ...
Categories hold Categories or Products but not both ...
If I go down further, I see:
/index.php?main_page=product_info&cPath=4_59&products_id=134
which tells me there is 1 Product in categories_id 4 which is products_id 134 ... so Product Porcelain Cup with plate is the only Product right now in categories_id 59 and that should have a master_categories_id 59, not 4 ...
-
Re: Is it possible to disable buying only in one category?
Quote:
Originally Posted by
Ajeh
ID 4 cannot be a master_categories_id ...
On your site, I see that:
/index.php?main_page=index&cPath=4
holds a Category ...
Categories hold Categories or Products but not both ...
If I go down further, I see:
/index.php?main_page=product_info&cPath=4_59&products_id=134
which tells me there is 1 Product in categories_id 4 which is products_id 134 ... so Product Porcelain Cup with plate is the only Product right now in categories_id 59 and that should have a master_categories_id 59, not 4 ...
How/Where can i change master categories?
-
Re: Is it possible to disable buying only in one category?
Quote:
At ID 4 (category ID ) at product i see : Product Master Category: ID# 59 Mugs
I suppose its not good. Now i have to check all of the products/cat. and rewrite the master category?
If you already see that its master_categories_id is 59, you do not need to change anything but the code:
Code:
if (zen_get_products_category_id($product_id) == 58 || zen_get_products_category_id($product_id) == 59) {
as 59 is the master_categories_id for the Product, not 4 ...
-
Re: Is it possible to disable buying only in one category?
Quote:
Originally Posted by
Ajeh
If you already see that its master_categories_id is 59, you do not need to change anything but the code:
Code:
if (zen_get_products_category_id($product_id) == 58 || zen_get_products_category_id($product_id) == 59) {
as
59 is the master_categories_id for the Product, not
4 ...
It works perfectly!!!!
thanks Ajeh!!!!!
-
Re: Is it possible to disable buying only in one category?
You are most welcome ... glad that this is working ... :smile: