magento - How can I get the 'friendly' text for product status and visibility attributes? -


how can friendly text products status , visibility options. example, 'enabled' or 'disabled' rather 1 or 2, , visibility 'not visible individually', 'catalog, search' etc rather 1,2,3 or 4?

i'm guessing there function somewhere can take $product->getstatus , return text value? , similar 1 visibility?

i'm playing getting used magento trying build simple list:

$products = mage::getmodel('catalog/product')     ->getcollection();  foreach ( $products $product ) {    echo $product->getsku();   echo $product->getstatus();   echo $product->getvisibility(); } 

but status , visibility appear in admin pages rather numeric values.

edit: of mufaddal's answer, final solution was;

$products = mage::getmodel('catalog/product')     ->getcollection()     ->addattributetoselect('sku')     ->addattributetoselect('status')     ->addattributetoselect('visibility')     ->addattributetosort('sku', 'asc');  foreach( $products $product ){     echo 'sku: ' .$product->getsku() . '<br/>';     echo 'visibility: ' . $product->getresource()->getattribute('visibility')->getfrontend()->getvalue($product); . '<br/>';     echo 'status: ' . $product->getresource()->getattribute('status')->getfrontend()->getvalue($product); . '<br/>'; } 

i needed either ->addattributetoselect('*') or specify each attribute in select before getresource calls work e.g. $product->getresource()->getattribute('status')->getfrontend()->getvalue($product);.

you can try

$products ->getresource()->getattribute('status')->getfrontend()->getvalue($products ); 

this status attribute.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -