views:

247

answers:

4

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

+2  A: 

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()
);
Alan Storm
http://pastebin.com/fMgjDQRU thats the output of what you mentioned before top is a visible product the bottom is on that doesnt show up on the frontend... still cant seem to find a reason
I'd forgotten a method call in there (->getFirstItem()). Give the edited code a try, that should give you all the attributes.
Alan Storm
A: 

Make sure that you have gone into the admin interface and under System>Index Management select all and choose "Reindex" from the drop-down on top right. Execute.

Also, refresh the caching under System>Cache Management and for good measure, delete all the files in var/cache.

If that doesn't fix it, report back for more suggestions.

HTH, JD

Jonathan Day
Ive already reindexed and deleted all the cache... still no luck.
This is a sample of what my import looks like store website attribute_set type category_ids sku has_options name image small_image thumbnail price cost status tax_class_id is_recurring visibility description short_description product_type_id product_name qty min_qty is_in_stock manage_stock weight
heres a link that make it a little easier to read i didn't know it would look so gaffed out http://pastebin.com/VUkeihNG
I figured you would have, but have to ask :) Hmm. I had a similar problem (http://stackoverflow.com/questions/3350146/how-to-refresh-magento-tier-price-cache-after-sql-insert) that I never solved... I can't actually read what you've pasted as a sample, perhaps try editing your question and formatting the paste as code. Check that the Inventory data is correct, maybe try turning on `Display out of stock products` under System>Config>Inventory to verify if it's related to Inventory.
Jonathan Day
The other option is to open up phpmyadmin and have a look in the `catalog_product_flat` table and ensure that the values look right. While the live data is read from the EAV model, the flat table might give you some clues as to what's wrong.
Jonathan Day
took a look at that table all that shows up there are the products that are enabled
A: 

Inspired from Alan Storm answer, but lower level.

  1. Start from an empty database. Dump it to an SQL file labelled original.sql
  2. Create manually one of your products.
  3. Check it is visible.
  4. Dump your database to a file labeled manual.sql
  5. Overwrite your database by importing original.sql
  6. Create a csv file to import the product you have chosen and import it.
  7. Dump your database to a file labeled automatic.sql
  8. Compare manual.sql and automatic.sql with each other. You should see where the problem relies.
greg0ire
A: 

For any one else who is having the is problem i sorted 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()));
dtcuk