2

I want to have custom visibility option in visibility attribute in products in magento. Can anyone please tell how can I do this?

I want to add "Pending" visibility to products - Those products will not be visible in site, regardless of simple type or configurable or bundle or whatever.

I referred these posts but they do not suggest/not related with what I actually want :-

  1. Custom visibility on products
  2. Options values of attribute "visibility"
  3. How to get Product url and show in detail page even it is non visibility mode?
3
  • 1
    what purpose does this serve, if I may ask? Would it not be sufficient to deactivate the product? Commented Sep 2, 2016 at 6:28
  • :) Yes christian, me thought the same but client wants this :( But yes this solution should be implemented :) Thanks again. Commented Sep 2, 2016 at 7:08
  • Any other solution please? Anyone there? Commented Sep 2, 2016 at 12:23

1 Answer 1

2

These were a constants, which is held in the class Mage_Catalog_Model_Product_Visibility you need to override that class and add your custom visibility option.

const VISIBILITY_NOT_VISIBLE = 1; const VISIBILITY_IN_CATALOG = 2; const VISIBILITY_IN_SEARCH = 3; const VISIBILITY_BOTH = 4; 

Here you can add your custom option and get it value.

6
  • Hi Janak, Thank you for giving solution :) now I have already gone through this file & thought the same that I should add here one more option using const keyword but I think this only will not work because all const are having their individual values like 1,2,3,4 there must be a logic to hide the product. Suppose I add here const VISIBILITY_PENDING it will be added but where would I write the logic to hide the product? :) That's the thing. Commented Sep 2, 2016 at 7:18
  • If you want to hide the product if the option is VISIBILITY_PENDING, you can follow the same logic of VISIBILITY_NOT_VISIBLE , you can hide the product like that way. Commented Sep 2, 2016 at 7:25
  • You mean I should give value 1 to my custom const? Commented Sep 2, 2016 at 7:31
  • Can you please specify, where can be that VISIBILITY_NOT_VISIBLE logic? Commented Sep 2, 2016 at 7:33
  • No, the const have not same value for two different const, you need to give value 5 and write the logic like value 1. You need to customization for achieve this functionality. Commented Sep 2, 2016 at 7:34

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.