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?
  • 1
    what purpose does this serve, if I may ask? Would it not be sufficient to deactivate the product? – CCK1979 Sep 2 '16 at 6:28
  • :) Yes christian, me thought the same but client wants this :( But yes this solution should be implemented :) Thanks again. – KA9 Sep 2 '16 at 7:08
  • Any other solution please? Anyone there? – KA9 Sep 2 '16 at 12:23
1

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.

  • 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. – KA9 Sep 2 '16 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. – Janak Bhimani Sep 2 '16 at 7:25
  • You mean I should give value 1 to my custom const? – KA9 Sep 2 '16 at 7:31
  • Can you please specify, where can be that VISIBILITY_NOT_VISIBLE logic? – KA9 Sep 2 '16 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. – Janak Bhimani Sep 2 '16 at 7:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.