Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 2 of 2
Wishlist shows online 1 product
 
romadenysyuk
Jr. Member
 
Total Posts:  2
Joined:  2013-10-03
 

Hi.
I was experiencing the same issue. I am working with Magento Enterprise Edition 1.13.0.2.
It seems after whole day debuging and tracing the code I have found the place that causes this issue.

Look at

protected function _assignProducts()
in
app/code/core/Mage/Wishlist/Model/Resource/Item/Collection.php

There you can find

foreach ($storeIds as $id{
      $productCollection
->addStoreFilter($id);
}

Further look at

public function addStoreFilter($store null)
in
app/code/core/Mage/Catalog/Model/Resource/Product/Collection.php
public function addStoreFilter($store null)
    
{
        
if ($store === null{
            $store 
$this->getStoreId();
        
}
        $store 
Mage::app()->getStore($store);

        if (!
$store->isAdmin()) {
            $this
->_productLimitationFilters[\'store_id\'$store->getId();
            
$this->_applyProductLimitations();
        
}

        
return $this;
    
}

Notice, that if we call this function without parameters Magento will determine the current store by itself. I am using that as a solution.
In this function we add store id passed as a parameter to _productLimitationFilters[\’store_id\’] array.
Look deeper in

protected function _applyProductLimitations()
in the same file.

...
$filters $this->_productLimitationFilters;
...
$conditions = array(
            
\'cat_index.product_id=e.entity_id\',
            
$this->getConnection()->quoteInto(\'cat_index.store_id=?\'$filters[\'store_id\'])
);
...
$joinCond join(\' AND \'$conditions);
$fromPart $this->getSelect()->getPart(Zend_Db_Select::FROM);
if (isset(
$fromPart[\'cat_index\'])) {
            $fromPart[\
'cat_index\'][\'joinCondition\'$joinCond;
            
$this->getSelect()->setPart(Zend_Db_Select::FROM$fromPart);
}
...

You can see that we add store id to $conditions and that condition gets to join statement.
Because we are doing foreach in the first file (app/code/core/Mage/Wishlist/Model/Resource/Item/Collection.php) we are each time rewriting the join condition. That doesn\’t make sence. We will receive the join condition with the last store id and it might be not current store (it is not current store in my case).

Further returning to

protected function _assignProducts()
you can find
foreach ($this as $item{
            $product 
$productCollection->getItemById($item->getProductId());
            if (
$product{
                
if ($checkInStock && !$product->isInStock()) {
                    $this
->removeItemByKey($item->getId());
                
else {
                    $product
->setCustomOptions(array());
                    
$item->setProduct($product);
                    
$item->setProductName($product->getName());
                    
$item->setName($product->getName());
                    
$item->setPrice($product->getPrice());
                
}
            } 
else {
                $item
->isDeleted(true);
            
}
        }

We are trying to get $product. We get null because of wrong store id in sql query. Than this product will be marked as isDeleted and will be deleted further.

So my solution was replace

foreach ($storeIds as $id{
      $productCollection
->addStoreFilter($id);
}

with

$productCollection->addStoreFilter();
to add to the filter just current store id.

That\’s it. Maybe someone will look deeper and find more considered solution.

Just saw that ironing_room already showed the source of the issue. I didn’t realise it until I came up to the source of issue for myself. But maybe my explanation will be also usefull for someone.

 
Magento Community Magento Community
Magento Community
Magento Community
 
ceongroup
Jr. Member
 
Total Posts:  1
Joined:  2011-08-08
 

I got the same problem with magento CE 1.7.0.2.

 
Magento Community Magento Community
Magento Community
Magento Community
 
ragf18
Jr. Member
 
Total Posts:  1
Joined:  2014-04-21
 

some body has the solution?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 2 of 2