$orders = Mage::getResourceModel('sales/order_collection')
        ->addFieldToSelect('*')
        ->addFieldToFilter('customer_id', Mage::getSingleton('customer/session')->getCustomer()->getId())
        ->addFieldToFilter('state', array('in' => Mage::getSingleton('sales/order_config')->getVisibleOnFrontStates()))
        ->setOrder('created_at', 'desc');   //获得当前用户所有的订单
$items = $order->getAllItems();  //获得订单所有的子item
$items = $order->getAllVisibleItems(); //获得订单所有可见的子item
public function getWishlistProductId()  //获得用户所有喜欢、收藏的产品 wishlist
{
    $customer = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('*');

    $wishList = Mage::getModel('wishlist/wishlist')->loadByCustomer($customer);
    $wishListItemCollection = $wishList->getItemCollection();

    if (count($wishListItemCollection)) {
        $arrProductIds = array();

        foreach ($wishListItemCollection as $item) {
            $arrProductIds[] = $item->getProductId();
        }
    }
    // Now here you can take that array and do what you want with it.        
    return $arrProductIds;
}
Logo

Agent 垂直技术社区,欢迎活跃、内容共建。

更多推荐