簡體   English   中英

Magento-新添加的產品未顯示

[英]Magento - Newly added products not showing

我已經從Magento后端創建了一個新產品,但是它沒有顯示在相關類別下或它自己的產品頁面中。 即,如果我輸入產品網址密鑰,它將進入404頁。

這只是一個簡單的產品,我檢查了以下內容,

Product enabled : Yes

Visibility : Catalog, search

Product Images : All good

Quantity Available : 9999999

Stock Availability : In Stock

Assign to a category : Yes (I even went to Manage Category to see product is under Category products and its there)

Product in web sites : Assigned

Cache : Cleared 10 X times

Indexing : Done

我做了另一件事,我查看了app/code/core/Mage/Catalog/Model/Category.php並在return $collection之前在getProductCollection()函數中添加了以下行

var_dump($collection->getAllIds());

然后我轉到類別頁面,我可以看到var_dump輸出分配給該類別的所有產品ID,但是仍然沒有新產品:(

這真讓我整日沮喪,沒有運氣,有什么想法嗎?

更新:

剛剛發現我可以通過http://my.host/catalog/product/view/id/881手動導航到產品頁面

但是在頁面上說“ ...此項目當前不可用”只是深入到代碼中,然后查看為什么顯示此消息並發現$_product->isSaleable()返回false。

但是我不確定與產品有關的天氣在類別中不可見,並且無法通過URL鍵導航

最后設法解決問題。 我將解釋為解決此問題所做的工作,因為它也可能對其他人有所幫助。

就像我在問題中說的那樣,我做了清單。 但是$_product->isSaleable()返回false

因此,我不得不深入研究代碼,發現$_product->isSaleable()是在Mage_CatalogInventory_Model_Stock_Status::assignProduct()

public function assignProduct(Mage_Catalog_Model_Product $product, $stockId = 1, $stockStatus = null)
    {
        if (is_null($stockStatus)) {
            $websiteId = $product->getStore()->getWebsiteId();
            $status = $this->getProductStatus($product->getId(), $websiteId, $stockId);
            $stockStatus = isset($status[$product->getId()]) ? $status[$product->getId()] : null;
        }

        $product->setIsSalable($stockStatus);

        return $this;
    }

然后我發現$this->getProductStatus(); 返回一個空數組,其原因是我的新產品的cataloginventory_stock_status表中沒有條目。

僅在重建庫存狀態索引 (在Magento管理員中均為綠色“就緒” )時才更新此表,但實際上不是“就緒” :(。

於是我就shell/indexer.php --reindexall手動重新建立我的所有索引,這也更新cataloginventory_stock_status表。

終於我可以看到我的產品了。 Yey!

@Kingshuk Deb-你是對的,它正在建立索引,但是Magento管理員說這一切都很好,這從一開始就誤導了我。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM