开发者

how can i get category detail on shipping.php page in magento

Hi I have to make a custom function in shipping.php. I got all the product details but I also want to find the category details.

public function getCartDetail(){
    $i=0;
    foreach($this->getItems() as $item) {
        $product[$i]['poroductId'] = $item->getProduct()->getId();
        $product[$i]['price']      开发者_运维百科= $item->getProduct()->getPrice();
        $product[$i]['Name']       = $item->getProduct()->getName();
        $product[$i]['qty']        = $item->getQty();
        $product[$i]['cat_id']     = $item->getProduct()->getCategoryIds();
        $i=$i+1;
    }
    return $product;
}

This is working on my local system but on server it gives cat_id blank.

Is there any other method by which I can find category detail?

Thanks


If getCategoryIds() is returning nothing sometimes but not for all servers then try re-indexing the catalog data.


Since a product can be assigned to multiple categories, I suspect getCategoryIds() will be returning an array, rather than a single value.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜