Magento Forum

   
How to get all the attributes of my products
 
stephtheboss
Jr. Member
 
Total Posts:  27
Joined:  2009-07-03
 

Hello,

I’m starting in Magento.
I have to generate a xml file with all the attributes of my products.
1 product is made of 1 or more sub-products, and 1 sub-product is made of 1 or more activities.
So i have to get all my products, with all their sub-products, with all their activities.

1- Do I have to make a script outside of magento or inside ?
If it’s inside magento, how will i call this script ?
I started with an outside script like that :

Mage::app();
$collectionProduct Mage::getModel('catalog/product')->getCollection();
$collectionProduct ->addAttributeToFilter('sku''123');
foreach(
$collectionProduct as $a){
    $thematique 
$a->getData();
}
So I get all the attributes from my product. Is it ok or not ?

2- How do I do the link between my product and my sub-product ?
In sql, it will be :

SELECT *
FROM mage_catalog_product_entity e
INNER JOIN mage_catalog_product_bundle_selection s ON s
.parent_product_id e.entity_id
WHERE e
.entity_id MY_PRODUCT_ID
I tried to translate it to magento like that :
$collectionSubProductMage::getModel('catalog/product')->getCollection();
$select $collectionSubProduct->getSelect()
                          ->
from(array('mcpbs' => 'mage_catalog_product_bundle_selection'))
                          ->
where('e.entity_id = 12 AND mcpbs.parent_product_id = e.entity_id');
If it is the good writing, how do i execute the query to get the result ?

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top