1

Hi i am using below code for wishlist but i not getting below result.

$customer = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('*');
$wishList = Mage::getModel('wishlist/wishlist')->loadByCustomer($customer);

Mage_Wishlist_Model_Wishlist Object
(
    [_eventPrefix:protected] => wishlist
    [_itemCollection:protected] => 
    [_store:protected] => 
    [_storeIds:protected] => 
    [_cacheTag:protected] => wishlist
    [_eventObject:protected] => object
    [_resourceName:protected] => wishlist/wishlist
    [_resource:protected] => 
    [_resourceCollectionName:protected] => wishlist/wishlist_collection
    [_dataSaveAllowed:protected] => 1
    [_isObjectNew:protected] => 
    [_data:protected] => Array
        (
        )

    [_hasDataChanges:protected] => 
    [_origData:protected] => 
    [_idFieldName:protected] => wishlist_id
    [_isDeleted:protected] => 
    [_oldFieldsMap:protected] => Array
        (
        )

    [_syncFieldsMap:protected] => Array
        (
        )

)
0

Because in this case you get as a result customer collection and not customer model.

$customer = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('*');

loadByCustomer function takes the argument which type is Mage_Customer_Model_Customer or customer's id.

You can use:

$customer = Mage::getModel('customer/customer')->load($id)

Or get first element of collection. Or use foreach loop to iterate through collection.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.