简体   繁体   中英

Magento - Programatically added bundle product isn't available for the basket/frontend

I followed this answer which works fine: Magento - Programatically added bundle product isn't showing up in frontend

I'm able to generate a bundle product on the fly. Everything works fine.

Only one problem: My bundle product is correctly saved and I can see it through the admin area. But, after this generation on the fly, I have to add directly this product into the basket. The system returns "product not found". Basically, I have to go into the admin area, just save it and then I'm able to add it to the basket.

I really suspect a problem with the indexer but I can't really figure out what's going on.

I tried many solutions like:

Mage::getSingleton('index/indexer')->processEntityAction(
     $product, 
     Mage_Catalog_Model_Product::ENTITY, 
     Mage_Index_Model_Event::TYPE_SAVE
);

But it still doesn't work. Any Idea about which code I should trigger after the save method to index only this new added bundle product.

Thank you in advance.

Sounds like you are not creating a stock-item with your product. Therefore there is no stock and you can't add it to your basket?

Have a look into

/app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php:672
/app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php:571

where a product is generated and the stock data are cleand up / set with default data

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM