magento - Get custom Attribute -
i'm wonder how can custom attribute, custom attribute call "tim_color" try $_product->getattributetext('tim_color');
after execute fatal error call member function getattributetext() on non-object when i'm used
$data['color'] = $product->gettim_color();
in result i'm id, need name of atrribute, how can resolve problem
my code of script:
$mage_csv = new varien_file_csv(); //mage csv $products_model = mage::getmodel('catalog/product')->getcollection();; //get products model $products_model ->addattributetoselect('*'); $products_row = array(); foreach ($products_model $prod) { #print_r($prod); $product = mage::getmodel('catalog/product')->load($prod->getid()); $data = array(); $data['id_product'] = $product->getid(); $data['color'] = $product->gettim_color(); $data['sku'] = $product->getsku(); $data['name'] = strip_tags($product->getname()); $data['description'] = trim(preg_replace('/\s+/', ' ', strip_tags($product->getdescription()))); $data['price'] = $product->getprice(); $products_row[] = $data; }
thx help
try,
$_product->getdata(’tim_color’);
i hope can attribute value getattributetext()
also. check out,
$_product = mage::getmodel('catalog/product')->load($item->getid()); //getting product $_product->getattributetext('tim_color'); //getting custom attribute value
Comments
Post a Comment