Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

after importing products into magento they dont show up catalog

After i import the products into magento which appears to go smoothly no errors; the products aren't visible in the store. however if i go to any product and save(even without changing anything) it it is instantly available. Why are these products not visible right away...

Running the latest stable build.

Thanks

like image 326
user398314 Avatar asked Aug 23 '10 00:08

user398314


2 Answers

The best way to solve this problem programmatically is to

  1. Import the product

  2. Examine all the product's attributes via some custom code

  3. Save the product

  4. Examine all the product's attributes via some custom code

  5. Compare the results of #2 and #4

  6. Ensure your import process explicitly sets whatever attributes were missing in #2 but present in #4

Here's the snipping I'd use to examine the product attributes. Run this or something like it in a phtml template, custom controller, etc.

var_dump( 
Mage::getModel('catalog/product')
->getCollection()
->addAttributeToSelect('*')
->addAttributeToFilter('sku','SKUGOESHERE')
    ->getFirstItem()
->getData()
);
like image 142
Alan Storm Avatar answered Oct 06 '22 01:10

Alan Storm


For anyone else who is having this problem: I solved it by making sure you set the websiteid for the product. If you are using a custom script, remember to add the following:

$product->setWebsiteIds(array(Mage::app()->getStore(true)->getWebsite()->getId()));
like image 45
dtcuk Avatar answered Oct 06 '22 01:10

dtcuk