Warning: Missing argument 2 ::addSuccess(), called in ../MassOperations.php on line 178 and defined in Log.php on line 85

magento.stackexchange https://magento.stackexchange.com/questions/164949

質問

I get this error while updating a product after it has been added to Google Shopping. The product won't update or save the new settings.

Exception: Warning: Missing argument 2 for BlueVisionTec_GoogleShoppingApi_Model_Log::addSuccess(), called in /home/xxxxxx/public_html/app/code/community/BlueVisionTec/GoogleShoppingApi/Model/MassOperations.php on line 178 and defined  in /home/xxxxxx/public_html/app/code/community/BlueVisionTec/GoogleShoppingApi/Model/Log.php on line 85 in /home/xxxxxx/public_html/app/code/local/Mage/Core/functions.php:170
Stack trace:
#0 /home/xxxxxx/public_html/app/code/community/BlueVisionTec/GoogleShoppingApi/Model/Log.php(85): mageCoreErrorHandler(2, 'Missing argumen...', '/home/angelsfor...', 85, Array)
#1 /home/xxxxxx/public_html/app/code/community/BlueVisionTec/GoogleShoppingApi/Model/MassOperations.php(178): BlueVisionTec_GoogleShoppingApi_Model_Log->addSuccess('Product synchro...')
#2 /home/xxxxxx/public_html/app/code/community/BlueVisionTec/GoogleShoppingApi/Model/Observer.php(63): BlueVisionTec_GoogleShoppingApi_Model_MassOperations->synchronizeItems(Object(BlueVisionTec_GoogleShoppingApi_Model_Resource_Item_Collection))
#3 /home/xxxxxx/public_html/app/code/core/Mage/Core/Model/App.php(958): BlueVisionTec_GoogleShoppingApi_Model_Observer->saveProductItem(Object(Varien_Event_Observer))
#4 /home/xxxxxx/public_html/app/code/core/Mage/Core/Model/App.php(945): Mage_Core_Model_App->_callObserverMethod(Object(BlueVisionTec_GoogleShoppingApi_Model_Observer), 'saveProductItem', Object(Varien_Event_Observer))
#5 /home/xxxxxx/public_html/app/Mage.php(259): Mage_Core_Model_App->dispatchEvent('catalog_product...', Array)
#6 /home/xxxxxx/public_html/app/code/core/Mage/Core/Model/Abstract.php(289): Mage::dispatchEvent('catalog_product...', Array)
#7 /home/xxxxxx/public_html/app/code/core/Mage/Catalog/Model/Product.php(355): Mage_Core_Model_Abstract->_afterSave()
#8 /home/xxxxxx/public_html/app/code/core/Mage/Core/Model/Abstract.php(181): Mage_Catalog_Model_Product->_afterSave()
#9 /home/xxxxxx/public_html/app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php(594): Mage_Core_Model_Abstract->save()
#10 /home/xxxxxx/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(278): Mage_Adminhtml_Catalog_ProductController->saveAction()
#11 /home/xxxxxx/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(200): Mage_Core_Controller_Varien_Action->dispatch('save')
#12 /home/xxxxxx/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(116): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#13 /home/xxxxxx/public_html/app/code/core/Mage/Core/Model/App.php(189): Mage_Core_Controller_Varien_Front->dispatch()
#14 /home/xxxxxx/public_html/app/Mage.php(414): Mage_Core_Model_App->run(Array)
#15 /home/xxxxxx/public_html/index.php(126): Mage::run('', 'store')
#16 {main}

Here are the files the error references.

MassOperations.php:

        public function synchronizeItems($items)
    {
        $totalUpdated = 0;
        $totalDeleted = 0;
        $totalFailed = 0;
        $errors = array();

        $itemsCollection = $this->_getItemsCollection($items);

        if ($itemsCollection) {
            if (count($itemsCollection) < 1) {
                return $this;
            }
            foreach ($itemsCollection as $item) {
                if ($this->_flag && $this->_flag->isExpired()) {
                    break;
                }
                $this->_getLogger()->setStoreId($item->getStoreId());
                $removeInactive = $this->_getConfig()->getConfigData('autoremove_disabled',$item->getStoreId());
                $renewNotListed = $this->_getConfig()->getConfigData('autorenew_notlisted',$item->getStoreId());
                try {
                    if($removeInactive && ($item->getProduct()->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_DISABLED || !$item->getProduct()->getStockItem()->getIsInStock() )) {
                        $item->deleteItem();
                        $item->delete();
                        $totalDeleted++;
                        Mage::log("remove inactive: ".$item->getProduct()->getSku()." - ".$item->getProduct()->getName());
                    } else {
                        $item->updateItem();
                        $item->save();
                        // The item was updated successfully
                        $totalUpdated++;
                    }
                } catch (Mage_Core_Exception $e) {
                    $errors[] = Mage::helper('googleshoppingapi')->__('The item "%s" cannot be updated at Google Content. %s', $item->getProduct()->getName(), $e->getMessage());
                    $totalFailed++;
                } catch (Exception $e) {
                    Mage::logException($e);
                    $errors[] = Mage::helper('googleshoppingapi')->__('The item "%s" hasn\'t been updated.', $item->getProduct()->getName());
                    $errors[] = $e->getMessage();
                    $totalFailed++;
                }
            }
        } else {
            return $this;
        }
        if($totalDeleted > 0 || $totalUpdated > 0) {
            $this->_getLogger()->addSuccess(
                Mage::helper('googleshoppingapi')->__('Product synchronization with Google Shopping completed') . "\n"
-- LINE 178 HERE --> . Mage::helper('googleshoppingapi')->__('Total of %d items(s) have been deleted; total of %d items(s) have been updated.', $totalDeleted, $totalUpdated)
            );
        }
        if ($totalFailed > 0 || count($errors)) {
            array_unshift($errors, Mage::helper('googleshoppingapi')->__("Cannot update %s items.", $totalFailed));
            $this->_getLogger()->addMajor(
                Mage::helper('googleshoppingapi')->__('Errors happened during synchronization with Google Shopping'),
                $errors
            );
        }

        return $this;
    }

Log.php:

 --LINE 85 Here -->   public function addSuccess($title,$message) {

    $msg = $this->_formatMessage($title,$message);
    $this->_getSession()->addSuccess($msg);
    return $this->log($msg,BlueVisionTec_GoogleShoppingApi_Model_Log::SUCCESS);

}
役に立ちましたか?

解決

That's right you have tow parameters in log function title and message But at line 178 in MassOperations.php you are passing only one parameter which is title. So just do this:

at line 178 remove (.) Dot with (,) comma to make next one as second paramete. So it would be calling like:

$this->_getLogger()->addSuccess( Mage::helper('googleshoppingapi')->__('Product synchronization with Google Shopping completed') , Mage::helper('googleshoppingapi')->__('Total of %d items(s) have been deleted; total of %d items(s) have been updated.', $totalDeleted, $totalUpdated) );
ライセンス: CC-BY-SA帰属
所属していません magento.stackexchange
scroll top