mysql - Pull SKU, Manufacturer and custom attribute from Magento database -


i'm trying pull full list of products database sku, manufacturer , custom attribute called 'gtin'.

i'm struggling custom attribute part.

this statement works pull manufacturer , sku

select cpe.sku, m1.manufacturer,  catalog_product_entity cpe inner join exportview_manufacturer m1 on cpe.entity_id = m1.entity_id 

my mysql poor , can't seem custom attribute. i've found following statement online know has details need make work far i've been getting head in mess trying implement it

select e.entity_id product_id, var.value product_name catalog_product_entity e, eav_attribute eav, catalog_product_entity_varchar var e.entity_type_id = eav.entity_type_id , eav.attribute_code = 'gtin' , eav.attribute_id = var.attribute_id , var.entity_id = e.entity_id 

i need first statement include 'gtin' column, joining i'm falling short. can please assist?

you need create 1 php script product , it's attribute. first create all_product.php file on magento root , add below code.

error_reporting(e_all); ini_set("display_errors", 1);      require_once '../app/mage.php'; mage::app();    $collection = mage::getmodel('catalog/product')->getcollection() ->addattributetoselect('*') // select attributes ->setpagesize(5000) // limit number of results returned ->setcurpage(1); // set offset (useful pagination)  foreach ($collection $product) {  echo $product->getname(); //get name /*you can attribue want name above. can custom attribule product need use print_r($collection->getdata()) above foreach*/ } 

hope work.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -