Jump to content

Remove buy button from 1 Category?? and rest normal!


Guest XBoNeSX

Recommended Posts

Guest XBoNeSX

I wanting to remove buy button from 1 Category and allow rest to have it buy button .. is this possible ?

only way I can do it at moment is stock : 0 but has OUT OF STOCK under it which I don't want in that cat ...

help please ! ASAP please please !

Link to comment
Share on other sites

It seems you struggle a little with the English, but you're doing fine. Your question is not clear, though.

"from 1 category"

Does this means that you want none of products in a given category to have a buy button"

Or does it mean 1 product, rather than one category.

Categories do not have OUT OF STOCK messages, products have OUT OF STOCK message.

Are you saying that you want buy button removed from out of stock items, but you do not want to see the out of stock text?

For me, your question raises other new questions, because I am not clear about what you ask. :)

Link to comment
Share on other sites

Guest XBoNeSX

Does this means that you want none of products in a given category to have a buy button" <=== yes ! exactly wot I want ... lol sorry my aussie english is hard to understand ...

Link to comment
Share on other sites

OPEN includes/content/viewCat.inc.php

FIND the following line of code (three times!):

			$view_cat->parse("view_cat.productTable.products.buy_btn");




REPLACE with this code (all three places):




			if($_GET['catId']!=4){

			$view_cat->parse("view_cat.productTable.products.buy_btn");

			}

Note, the code above will shut off buy button for category id 4

Change the !=4 for the correct category number of the category you choose to shut off buy button

Link to comment
Share on other sites

  • 2 months later...

OK, viewProd.inc.php, again in three places:

		$view_prod->parse("view_prod.prod_true.buy_btn");




REPLACE with:




		if($prodArray[0]['cat_id']!=4){

		$view_prod->parse("view_prod.prod_true.buy_btn");

		}

What would the code be if you wanted to remove the "buy" button and "add to basket" button from two categories (19 and 20 in my case)?

Thank you.

www.airedaleterriers.org/swat/

Link to comment
Share on other sites

  • 1 month later...
Guest taylor

What would the code be if you wanted to remove the "buy" button and "add to basket" button from two categories (19 and 20 in my case)?

Thank you.

www.airedaleterriers.org/swat/

Hi,

I ran into the same thing. Just needs another if statement above the other with the appropriate cat id. For example....the following code would take the buy off of categories 19 and 20:

if($prodArray[0]['cat_id']!=19)

if($prodArray[0]['cat_id']!=20){

Link to comment
Share on other sites

Try this instead:

if($prodArray[0]['cat_id'](!=19 && !=20)) {

Or maybe better this:

if($prodArray[0]['cat_id']!=(19 | 20 | 21 | 22)) {

I tried both of these, as well Taylor's suggestion, and nothing seems to have changed.

Just to make sure I've done this right ... these are the codes I have tried (in three places) in viewProd.inc.php

First tried this,

if($prodArray[0]['cat_id']!=19)

if($prodArray[0]['cat_id']!=20) {

$view_prod->parse("view_prod.prod_true.buy_btn");

}

Then tried this

if($prodArray[0]['cat_id']!=19 && !=20)) {

$view_prod->parse("view_prod.prod_true.buy_btn");

}

Then tried this

if($prodArray[0]['cat_id']!=19 | 20 | 21 | 22)) {

$view_prod->parse("view_prod.prod_true.buy_btn");

}

However, when I click on the "buy" button for other sections (where I want people to be able to buy), I get the following message:

Parse error: syntax error, unexpected $end in /home/airedale/public_html/airewear/includes/content/viewProd.inc.php on line 209

My website:

www.airedaleterriers.org/airewear

Thank you for the suggestions.

Sidney

Link to comment
Share on other sites

You are missing paretheses in the code I showed you, that's why I put them in red, to prevent missing one

Also, the category numbers need to be changed to represent the categories you are dealing with. I used 19, 20, 21, 22 as examples only.

Should be:

Then tried this

if($prodArray[0]['cat_id'](!=19 && !=20)) {

$view_prod->parse("view_prod.prod_true.buy_btn");

}

Then tried this

if($prodArray[0]['cat_id']!=(19 | 20 | 21 | 22)) {

$view_prod->parse("view_prod.prod_true.buy_btn");

}

Link to comment
Share on other sites

You are missing paretheses in the code I showed you, that's why I put them in red, to prevent missing one

Also, the category numbers need to be changed to represent the categories you are dealing with. I used 19, 20, 21, 22 as examples only.

**

Sorry ... I copied and pasted your code and double-checked to make sure I had all parentheses and the correct category numbers and it still generated an error message. I appreciate your trying to help.

Sidney

Link to comment
Share on other sites

Sorry Sidney, I finally had some time to test this, and here is what you need to use:

			if(($_GET['catId']!=2) && ($_GET['catId']!=4)) {

			$view_cat->parse("view_cat.productTable.products.buy_btn");

			}

edited to correct the code

This has been tested on my sample store, cubecart 3.0.15 and works.

My foolish post above has been corrected :D

Link to comment
Share on other sites

Sorry Sidney, I finally had some time to test this, and here is what you need to use:

if($_GET['catId']!=(4 or 2)){

$view_cat->parse("view_cat.productTable.products.buy_btn");

}

This has been tested on my sample store, cubecart 3.0.15 and works. Just enclose the category id numbers in parentheses and separate them with or

I'll bet you are tired of seeing my name. I inserted the following code:

if($_GET['catId']!=(19 or 20)){

$view_cat->parse("view_cat.productTable.products.buy_btn");

}

and it worked without any error message. There was no "buy" button in categories 19 and 20, but it also turned of the buy button in all the other categories as well.

Sidney

Link to comment
Share on other sites

B) Just a sec . . .

<MarksCarts walks outside and makes a very loud and long primal scream>

OK, sorry, I tested it but did not look all through the test store, just at the categories I was trying to affect :D

Well, I'm not giving up, but no time now to test something else, will have to wait a few days for that - but I think it will be best if I ask my partner and php expert, convict, what I am doing wrong there. Anyway, I'll post something here in the next few days.

Link to comment
Share on other sites

Guest wendyk

Well, I kept trying until I made it work properly with this code:

			if(($_GET['catId']!=2) && ($_GET['catId']!=4)) {

			$view_cat->parse("view_cat.productTable.products.buy_btn");

			}

My last two code postings have been corrected to reflect this code.

It works perfect for me...thanks Marks!

It took me a few tries to get it to work, but the reason is, I was pasting the code:

if(($_GET['catId']!=1) && ($_GET['catId']!=6)) {

$view_cat->parse("view_cat.productTable.products.buy_btn");

}

into the viewprod.inc.php file.

So I replaced the view_cat with view_prod in each instance of the code of this file.

Just thought I would post this in case anyone else does stupid little mistakes like I do sometimes.

Wendy

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
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...