Domanda

Non sai come capire questo errore, sono stato googling per una settimana e io non riesco a trovare una soluzione. Tutte le idee?

2013-06-10T04:04:28+00:00 ERR (3): 
exception 'Mage_Core_Exception' with message 'Invalid block type: ' in /home/xxxxxxx/public_html/app/Mage.php:594
Stack trace:
#0 /home/xxxxxxx/public_html/app/code/core/Mage/Core/Model/Layout.php(495): Mage::throwException('Invalid block t...')
#1 /home/xxxxxxx/public_html/app/code/core/Mage/Core/Model/Layout.php(437): Mage_Core_Model_Layout->_getBlockInstance('', Array)
#2 /home/xxxxxxx/public_html/app/code/core/Mage/Core/Model/Layout.php(472): Mage_Core_Model_Layout->createBlock('', 'checkout.cart')
#3 /home/xxxxxxx/public_html/app/code/core/Mage/Core/Model/Layout.php(239): Mage_Core_Model_Layout->addBlock('', 'checkout.cart')
#4 /home/xxxxxxx/public_html/app/code/core/Mage/Core/Model/Layout.php(205): Mage_Core_Model_Layout->_generateBlock(Object(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_Layout_Element))
#5 /home/xxxxxxx/public_html/app/code/core/Mage/Core/Model/Layout.php(210): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
#6 /home/xxxxxxx/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(344): Mage_Core_Model_Layout->generateBlocks()
#7 /home/xxxxxxx/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(269): Mage_Core_Controller_Varien_Action->generateLayoutBlocks()
#8 /home/xxxxxxx/public_html/app/code/core/Mage/Checkout/controllers/CartController.php(159): Mage_Core_Controller_Varien_Action->loadLayout()
#9 /home/xxxxxxx/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Checkout_CartController->indexAction()
#10 /home/xxxxxxx/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')
#11 /home/xxxxxxx/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#12 /home/xxxxxxx/public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#13 /home/xxxxxxx/public_html/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#14 /home/xxxxxxx/public_html/index.php(89): Mage::run('', 'store')
#15 {main}
È stato utile?

Soluzione

In base alla analisi dello stack che hai postato, sembra che questo sta succedendo quando Magento sta caricando i file XML aggiornamento il layout, e li utilizzano per creare i blocchi, che renderanno il codice HTML per la pagina.

Queste linee sembrano essere il problema

#1 /home/xxxxxxx/public_html/app/code/core/Mage/Core/Model/Layout.php(437): Mage_Core_Model_Layout->_getBlockInstance('', Array)
#2 /home/xxxxxxx/public_html/app/code/core/Mage/Core/Model/Layout.php(472): Mage_Core_Model_Layout->createBlock('', 'checkout.cart')
#3 /home/xxxxxxx/public_html/app/code/core/Mage/Core/Model/Layout.php(239): Mage_Core_Model_Layout->addBlock('', 'checkout.cart')

I addBlock, createBlock e metodi _getBlockInstance tutti si aspettano il primo parametro da una stringa di classe alias per il blocco. Qualcosa di simile checkout/cart. Tuttavia, nel vostro sistema, questa stringa manca.

->addBlock('', 'checkout.cart')

A causa Magento è così estensibile, c'è una miriade di ragioni per cui questo potrebbe accadere. Il motivo più comune è in qualche modo il file catalog.xml è stato modificato in modo tale che questo

<block type="checkout/cart" name="checkout.cart">

Manca lo dell'attributo type. Quello sguardo segnalarti questo

<block name="checkout.cart">

O potrebbe essere un errore di battitura

<block typeX="checkout/cart" name="checkout.cart">

La speranza che aiuta. Se il problema finisce per essere qualcosa di diverso da essere sicuri di tornare e inviare la risposta corretta.

Altri suggerimenti

Con l'aiuto dei commenti dal mio post originale, sono stato in grado di rintracciare il codice incriminato!

Ecco il frammento di che stava causando l'eccezione:

<checkout_cart_index>
    <reference name="content">
        <block name="checkout.cart">            
            <!-- Add CMS Static Block -->
            <block type="cms/block" name="snippet.cart.bottom" as="snippet_cart_bottom">
                <action method="setBlockId"><block_id>snippet_cart_bottom</block_id></action>
            </block>

            <!-- Add CMS Static Block -->
            <block type="cms/block" name="snippet.cart.coupon.below" as="snippet_cart_coupon_below">
                <action method="setBlockId"><block_id>snippet_cart_coupon_below</block_id></action>
            </block>

            <!-- Add CMS Static Block -->
            <block type="cms/block" name="snippet.cart.empty.bottom" as="snippet_cart_empty_bottom">
                <action method="setBlockId"><block_id>snippet_cart_empty_bottom</block_id></action>
            </block>

            <!-- Add CMS Static Block -->
            <block type="cms/block" name="snippet.cart.list.below" as="snippet_cart_list_below">
                <action method="setBlockId"><block_id>snippet_cart_list_below</block_id></action>
            </block>
        </block>
    </reference>
</checkout_cart_index>

Codice riveduta no più causando eccezioni:

<checkout_cart_index>
    <reference name="checkout.cart">        
            <!-- Add CMS Static Block -->
            <block type="cms/block" name="snippet.cart.bottom" as="snippet_cart_bottom">
                <action method="setBlockId"><block_id>snippet_cart_bottom</block_id></action>
            </block>

            <!-- Add CMS Static Block -->
            <block type="cms/block" name="snippet.cart.coupon.below" as="snippet_cart_coupon_below">
                <action method="setBlockId"><block_id>snippet_cart_coupon_below</block_id></action>
            </block>

            <!-- Add CMS Static Block -->
            <block type="cms/block" name="snippet.cart.empty.bottom" as="snippet_cart_empty_bottom">
                <action method="setBlockId"><block_id>snippet_cart_empty_bottom</block_id></action>
            </block>

            <!-- Add CMS Static Block -->
            <block type="cms/block" name="snippet.cart.list.below" as="snippet_cart_list_below">
                <action method="setBlockId"><block_id>snippet_cart_list_below</block_id></action>
            </block>            
    </reference>
</checkout_cart_index>

Sono riuscito a risolvere i miei problemi da semplicemente vecchio rimuovendo i blocchi. Ho fatto questo:

L'aggiunta della linea Mage::log($className . ' - ' $blockName, null, 'logfile.log'); alla funzione '_generateBlock' in /app/code/core/Mage/Core/Model/Layout.php

In questo modo:

$block = $this->addBlock($className, $blockName);
if (!$block) {
    Mage::log($className . ' - ' $blockName, null, 'logfile.log');
    return $this;
}

Poi ho rimosso i blocchi aggiungendo la seguente riga al mio file local.xml nel mio tema / Layout

<remove name="fb8cd356f514800e782dfca09d40465d"/>
<remove name="1f0592cf88e12e898c194d5d18250c51"/>
<remove name="downloads.product"/>

Spero che questo aiuti qualcuno. non poteva sopportare tutte le stronzate stato scritto nel mio file exceptions.log.

UPDATE:

ho trovato che l'uso di questo codice appena prima 'return $ questo' nella funzione _generateBlock in /app/code/core/Mage/Core/Model/Layout.php

if ($_SERVER['HTTP_X_FORWARDED_FOR'] == '00.00.00.00') {
    Mage::log(Zend_Debug::dump($parentBlock, null, false), null, 'export_all_xml.log');
}

ovviamente cambia 'HTTP_X_FORWARDED_FOR' a 'REMOTE_ADDR' se avete bisogno di troppo.

UPDATE 2

Ho finito per trovare il torto problema con il mio sito aggiungendo:

if ($_SERVER['HTTP_X_FORWARDED_FOR'] == '00.00.00.00') {
    Mage::setIsDeveloperMode(true);
}

appena sopra 'Mage :: ThrowException (Mage :: helper (' core ') -> __ (' non valido tipo di blocco:% s', $ blocco));' nella funzione '_getBlockInstance' nel file '/app/code/core/Mage/Core/Model/Layout.php'

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a magento.stackexchange
scroll top