Solved

magento 1.8 custom local.xml causing 404

Posted on 2014-02-02
3
1,062 Views
Last Modified: 2016-03-02
Hello experts

I'm settings up a magento 1.8 installation.
I created a custom local.xml to produce 2 extra blocks.

These work fine on the homepage and on the cataloge pages except on the product page they return errors.

This is my local.xml file

<?xml version="1.0" encoding="UTF-8"?>
<layout>
    <default>
        <reference name="right">
								 <block type="catalog/product_list" name="right.permanent.callout">
								 <action method="setData"><name>category_id</name><value>16</value></action>
								 <action method="setTemplate"><template>catalog/product/listhp.phtml</template></action>
								 </block>
				</reference>
				<reference name="left">
								 <block type="catalog/product_list" name="left.permanent.callout">
								 <action method="setTemplate"><template>catalog/product/levering.phtml</template></action>
								 </block>
				</reference>
    </default>
</layout>

Open in new window


when only using the <template>catalog/product/levering.phtml</template> part i get a 404 on the product page. The product and content is loaded, the 404 shows up at the bottom of the product view.

when using <template>catalog/product/listhp.phtml</template> i get following error

a:5:{i:0;s:203:"SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1";i:1;s:5356:"#0 /home/sitedir/domains/sitename/public_html/devel/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /home/sitedir/domains/sitename/public_html/devel/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /home/sitedir/domains/sitename/public_html/devel/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#3 /home/sitedir/domains/sitename/public_html/devel/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT `catalog...', Array)
#4 /home/sitedir/domains/sitename/public_html/devel/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('SELECT `catalog...', Array)
#5 /home/sitedir/domains/sitename/public_html/devel/lib/Zend/Db/Adapter/Abstract.php(753): Varien_Db_Adapter_Pdo_Mysql->query(Object(Varien_Db_Select), Array)
#6 /home/sitedir/domains/sitename/public_html/devel/app/code/core/Mage/Eav/Model/Entity/Abstract.php(943): Zend_Db_Adapter_Abstract->fetchRow(Object(Varien_Db_Select))
#7 /home/sitedir/domains/sitename/public_html/devel/app/code/core/Mage/Catalog/Model/Resource/Abstract.php(698): Mage_Eav_Model_Entity_Abstract->load(Object(Mage_Catalog_Model_Category), Object(Mage_Catalog_Model_Category), NULL)
#8 /home/sitedir/domains/sitename/public_html/devel/app/code/core/Mage/Core/Model/Abstract.php(225): Mage_Catalog_Model_Resource_Abstract->load(Object(Mage_Catalog_Model_Category), Object(Mage_Catalog_Model_Category), NULL)
#9 /home/sitedir/domains/sitename/public_html/devel/app/code/core/Mage/Catalog/Block/Product/List.php(80): Mage_Core_Model_Abstract->load(Object(Mage_Catalog_Model_Category))
#10 /home/sitedir/domains/sitename/public_html/devel/app/code/core/Mage/Catalog/Block/Product/List.php(142): Mage_Catalog_Block_Product_List->_getProductCollection()
#11 /home/sitedir/domains/sitename/public_html/devel/app/code/core/Mage/Core/Block/Abstract.php(885): Mage_Catalog_Block_Product_List->_beforeToHtml()
#12 /home/sitedir/domains/sitename/public_html/devel/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()
#13 /home/sitedir/domains/sitename/public_html/devel/app/code/core/Mage/Core/Block/Abstract.php(886): Mage_Core_Block_Text_List->_toHtml()
#14 /home/sitedir/domains/sitename/public_html/devel/app/code/core/Mage/Core/Block/Abstract.php(605): Mage_Core_Block_Abstract->toHtml()
#15 /home/sitedir/domains/sitename/public_html/devel/app/code/core/Mage/Core/Block/Abstract.php(549): Mage_Core_Block_Abstract->_getChildHtml('right', true)
#16 /home/sitedir/domains/sitename/public_html/devel/app/design/frontend/sitedirding/sitedirding/template/page/2columns-right.phtml(50): Mage_Core_Block_Abstract->getChildHtml('right')
#17 /home/sitedir/domains/sitename/public_html/devel/app/code/core/Mage/Core/Block/Template.php(241): include('/home/sitedir...')
#18 /home/sitedir/domains/sitename/public_html/devel/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/dieren...')
#19 /home/sitedir/domains/sitename/public_html/devel/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#20 /home/sitedir/domains/sitename/public_html/devel/app/code/core/Mage/Core/Block/Abstract.php(886): Mage_Core_Block_Template->_toHtml()
#21 /home/sitedir/domains/sitename/public_html/devel/app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract->toHtml()
#22 /home/sitedir/domains/sitename/public_html/devel/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput()
#23 /home/sitedir/domains/sitename/public_html/devel/app/code/core/Mage/Cms/Helper/Page.php(137): Mage_Core_Controller_Varien_Action->renderLayout()
#24 /home/sitedir/domains/sitename/public_html/devel/app/code/core/Mage/Cms/Helper/Page.php(52): Mage_Cms_Helper_Page->_renderPage(Object(Mage_Cms_IndexController), 'no-route')
#25 /home/sitedir/domains/sitename/public_html/devel/app/code/core/Mage/Cms/controllers/IndexController.php(75): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_IndexController), 'no-route')
#26 /home/sitedir/domains/sitename/public_html/devel/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Cms_IndexController->noRouteAction()
#27 /home/sitedir/domains/sitename/public_html/devel/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('noRoute')
#28 /home/sitedir/domains/sitename/public_html/devel/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#29 /home/sitedir/domains/sitename/public_html/devel/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#30 /home/sitedir/domains/sitename/public_html/devel/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#31 /home/sitedir/domains/sitename/public_html/devel/index.php(87): Mage::run('', 'store')
#32 {main}";s:3:"url";s:49:"/devel/katten/kattenvoeding/lux-dog-1-500grr.html";s:11:"script_name";s:16:"/devel/index.php";s:4:"skin";s:7:"default";}

Open in new window


This is the content of listhp.phtml

<?php
    $_productCollection=$this->getLoadedProductCollection();
    $_helper = $this->helper('catalog/output');
?>
<?php if(!$_productCollection->count()): ?>
<?php else: ?>
<div class="category-products">
    <?php $_iterator = 0; ?>
    <?php $_collectionSize = $_productCollection->count() ?>
    <?php $_columnCount = 1; ?>
    <?php $i=0; foreach ($_productCollection as $_product): ?>
        <?php if ($i++%$_columnCount==0): ?>
        <ul style="list-style:none">
        <?php endif ?>
            <li style="text-align:center">
                <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(170); ?>" width="170" height="170" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
                <h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></a></h2>
                <?php echo $this->getPriceHtml($_product, true) ?>
                <div class="actions">
                    <?php if($_product->isSaleable()): ?>
                        <button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
                    <?php else: ?>
                        <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
                    <?php endif; ?>
                </div><p></p>
            </li>
        <?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
        </ul>
        <?php endif ?>
        <?php endforeach ?>
        <script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
</div>
<?php endif; ?>

Open in new window



Any tips ?
0
Comment
Question by:Th0R
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
3 Comments
 

Author Comment

by:Th0R
ID: 39828245
Ok after some more testing listhp.phtml does not produce the error.
Its only when using levering.phtml

commenting the phtml file does not remove the error.
commenting the entire <block> code does remove the error

levering.phtml is a simple jpg picture
the code in levering.phtml is not the problem, because even with an empty file, it still produces the problem
0
 

Author Comment

by:Th0R
ID: 39828270
fyi, all caching is disabled
0
 

Accepted Solution

by:
Th0R earned 0 total points
ID: 39830707
well i changed my approach, made a static block trough the backend with ID xx.
and replaced the following
<!--<block type="catalog/product_list" name="left.permanent.callout">
								 <action method="setTemplate"><template>catalog/product/levering.phtml</template></action>
								 </block>-->
								 <block type="cms/block" name="test">
								 <action method="setBlockId"><block_id>xx</block_id></action>
								 </block>

Open in new window


It now works with any view
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Obsolete font tag need to convert to CSS 3 34
Syntax error creating JSON recordset 4 27
curl parse data from site 20 39
How to use 2 ON statements in inner join 3 23
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to count occurrences of each item in an array.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question