Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

export custom options as simple products
 
rrroulio
Sr. Member
 
Avatar
Total Posts:  88
Joined:  2008-03-26
france moselle
 

If you want to export products (csv) and you have a lot of options, you can with this script export all options as simple products.
option sku become real sku and the name of product is real name + title option.
simple products with no options are exported normaly.
it can be useful for ebay or another market place.
copy file on root. CSV will be save on root too as test.csv (move script after test!)
Thanks to chiefair for code! (see a list of products with options)
http://www.magentocommerce.com/boards/viewthread/216551/

File Attachments
export-options.php  (File Size: 8KB - Downloads: 273)
 
Magento Community Magento Community
Magento Community
Magento Community
 
rrroulio
Sr. Member
 
Avatar
Total Posts:  88
Joined:  2008-03-26
france moselle
 

define(’SAVE_FEED_LOCATION’,’test.csv‘);
it saves a csv file at the same level as your script
what appened when you launch the php file?

 
Magento Community Magento Community
Magento Community
Magento Community
 
nitin09
Jr. Member
 
Total Posts:  10
Joined:  2011-09-18
 

Fatal error: Call to a member function getName() on a non-object in export-options.php on line 153

Please help..

 
Magento Community Magento Community
Magento Community
Magento Community
 
rrroulio
Sr. Member
 
Avatar
Total Posts:  88
Joined:  2008-03-26
france moselle
 

it seems something is not correct in your code. getname ? for what, product? option? is the same sybtaxe that others parameters?

try to comment this with /* and */

/*
$product_data[’CATEGORY’]=’’;
foreach($product->getCategoryIds() as $_categoryId){
$category = Mage::getModel(’catalog/category’)->load($_categoryId);}
$product_data[’CATEGORY’].=$category->getName().’, ‘;
$product_data[’CATEGORY’]=rtrim($product_data[’CATEGORY’],’, ‘);
*/

line 150 to 154

pb is for category. Are you sure your products have categories?

 
Magento Community Magento Community
Magento Community
Magento Community
 
BrianMillz
Jr. Member
 
Total Posts:  9
Joined:  2009-08-12
 

Thanks! It works for me.

Although, I am not getting any SKU for the products with custom options. Also, would you should me how I could replace the space between the product name and custom option value with a character such as a dash “-” rather than a space?

 
Magento Community Magento Community
Magento Community
Magento Community
 
prickindel
Jr. Member
 
Total Posts:  4
Joined:  2011-09-20
 

Hello, the script is working for me, Thank You, the only problem i have is that the script also export inactive categories,
// to exclude some categories
/*if($mcategory->getId()==194 || $mcategory->getId()==169 )
continue;*/

i put this like:

if($mcategory->getId()==194 || $mcategory->getId()==169 )
continue;

still, this two categories apear in the file.

what can i do ?

Thank You

 
Magento Community Magento Community
Magento Community
Magento Community
 
rrroulio
Sr. Member
 
Avatar
Total Posts:  88
Joined:  2008-03-26
france moselle
 

try this?!
if (!$mcategory->getIsActive()) continue;

 
Magento Community Magento Community
Magento Community
Magento Community
 
prickindel
Jr. Member
 
Total Posts:  4
Joined:  2011-09-20
 
rrroulio - 08 March 2013 10:40 AM

try this?!
if (!$mcategory->getIsActive()) continue;

Thank you, but it doesn’t work, inactive categories are still there.
I will keep trying

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