0

Simple problem description

I imported products they are displayed on the homepage. When the user wants to enter the product page the "there has been an error" error message pops up.

Long problem description

I have imported products through a database dump in phpmyadmin. They are properly displayed in the grid. Please see below. enter image description here

When I click on a product the page shows some product information, but not all. I've checked if the values I try to collect exists in the table catalog_product_entity_text, and they do exists. Whats next is that the "there has been an error processing your request" error pops up. Please see below.

enter image description here

This problem occurs on every product. I've checked the report file in "var/report". It showed this:

a:5:{i:0;s:356:"SELECT 1 AS `status`, `e`.`entity_id`, `e`.`type_id`, `e`.`attribute_set_id`, `e`.`required_options`, `links`.`link_id` FROM `catalog_product_flat_2` AS `e`
 INNER JOIN `catalog_product_link` AS `links` ON links.linked_product_id = e.entity_id AND links.link_type_id = 6 WHERE (links.product_id = 2244) AND (e.entity_id != '2244') ORDER BY `position` ASC

";i:1;s:5406:"#0 /home/laborato/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /home/laborato/public_html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /home/laborato/public_html/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#3 /home/laborato/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT 1 AS `st...', Array)
#4 /home/laborato/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('SELECT 1 AS `st...', Array)
#5 /home/laborato/public_html/lib/Zend/Db/Adapter/Abstract.php(737): Varien_Db_Adapter_Pdo_Mysql->query('SELECT 1 AS `st...', Array)
#6 /home/laborato/public_html/lib/Varien/Data/Collection/Db.php(734): Zend_Db_Adapter_Abstract->fetchAll('SELECT 1 AS `st...', Array)
#7 /home/laborato/public_html/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php(1047): Varien_Data_Collection_Db->_fetchAll('SELECT 1 AS `st...')
#8 /home/laborato/public_html/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php(871): Mage_Eav_Model_Entity_Collection_Abstract->_loadEntities(false, false)
#9 /home/laborato/public_html/lib/Varien/Data/Collection.php(752): Mage_Eav_Model_Entity_Collection_Abstract->load()
#10 [internal function]: Varien_Data_Collection->count()
#11 /home/laborato/public_html/app/design/frontend/base/default/template/guapa/customaddtocart.phtml(83): count(Object(Mage_Catalog_Model_Resource_Product_Link_Product_Collection))
#12 /home/laborato/public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/laborato/...')
#13 /home/laborato/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/base/d...')
#14 /home/laborato/public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#15 /home/laborato/public_html/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Template->_toHtml()
#16 /home/laborato/public_html/app/code/core/Mage/Core/Block/Abstract.php(637): Mage_Core_Block_Abstract->toHtml()
#17 /home/laborato/public_html/app/code/core/Mage/Core/Block/Abstract.php(581): Mage_Core_Block_Abstract->_getChildHtml('addtocart', true)
#18 /home/laborato/public_html/app/design/frontend/default/dijkstra/template/catalog/product/view.phtml(84): Mage_Core_Block_Abstract->getChildHtml('addtocart')
#19 /home/laborato/public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/laborato/...')
#20 /home/laborato/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/defaul...')
#21 /home/laborato/public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#22 /home/laborato/public_html/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Template->_toHtml()
#23 /home/laborato/public_html/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()
#24 /home/laborato/public_html/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Text_List->_toHtml()
#25 /home/laborato/public_html/app/code/core/Mage/Core/Block/Abstract.php(637): Mage_Core_Block_Abstract->toHtml()
#26 /home/laborato/public_html/app/code/core/Mage/Core/Block/Abstract.php(581): Mage_Core_Block_Abstract->_getChildHtml('content', true)
#27 /home/laborato/public_html/app/design/frontend/default/dijkstra/template/page/3columns.phtml(49): Mage_Core_Block_Abstract->getChildHtml('content')
#28 /home/laborato/public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/laborato/...')
#29 /home/laborato/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/defaul...')
#30 /home/laborato/public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#31 /home/laborato/public_html/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Template->_toHtml()
#32 /home/laborato/public_html/app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract->toHtml()
#33 /home/laborato/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput()
#34 /home/laborato/public_html/app/code/core/Mage/Catalog/Helper/Product/View.php(147): Mage_Core_Controller_Varien_Action->renderLayout()
#35 /home/laborato/public_html/app/code/core/Mage/Catalog/controllers/ProductController.php(132): Mage_Catalog_Helper_Product_View->prepareAndRender(2244, Object(Mage_Catalog_ProductController), Object(Varien_Object))
#36 /home/laborato/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Catalog_ProductController->viewAction()
#37 /home/laborato/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('view')
#38 /home/laborato/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#39 /home/laborato/public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#40 /home/laborato/public_html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#41 /home/laborato/public_html/index.php(109): Mage::run('labo', 'website')
#42 {main}";s:3:"url";s:53:"/kern-tee-150-1-elektronische-zakweegschaal-150g-0-1g";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:4:"labo";}

EDIT - 1

This is my customaddtocart.phtml file that is for reference.

<?php $_product = $this->getProduct(); ?>
<?php $buttonTitle = $this->__('Add to Cart'); ?>
<?php $qtyInc = $_product->getStockItem()->getQtyIncrements() ?>

<?php
$customProducts = $_product->getCustomProductCollection()
    ->addAttributeToSelect('required_options')
    ->setPositionOrder()
    ->addStoreFilter();
?>

<script type="text/javascript">
    //<![CDATA[
    numberRegex = /^[+-]?\d+(\.\d+)?([eE][+-]?\d+)?$/;

    <?php if(is_numeric($qtyInc)): ?>
    increment = <?php echo $qtyInc ?>;
    <?php else: ?>
    increment = 1;
    <?php endif; ?>

    jQuery(document).ready(function(){
        jQuery('#qty').change(function(){
            var currentVal = jQuery(this).val();
            if(numberRegex.test(currentVal) && currentVal > 0) {
                currentVal = parseFloat(currentVal).toFixed(0);
                var zenewNumber = (Math.round(currentVal / increment).toFixed(0));
                if(zenewNumber < 1){
                    zenewNumber = increment;
                } else {
                    zenewNumber = zenewNumber * increment;
                }
                jQuery(this).val(zenewNumber);
            } else {
                jQuery(this).val(increment);
            }
        });
    });

    function changeItemQuantity(upordown) {
        var id = false;
        if(id){
            var qty_id = "#qty_" + id;
        } else {
            var qty_id = "#qty";
        }
        var currentVal = parseInt( jQuery(qty_id).val() );
        if ( numberRegex.test(currentVal) )
        {
            if(upordown == 'up'){
                var newVal = currentVal + increment;
                jQuery(qty_id).val(newVal);
            } else if(upordown == 'down') {
                if(currentVal > increment){
                    var newVal = currentVal - increment;
                    jQuery(qty_id).val(newVal);
                }
            }
        }
    }

    function setQuote(yesno){
        jQuery('#isquote').val(yesno);
    }

    //]]>
</script>

<?php $productType = $_product->getTypeId();?>
<div class="add-to-cart">
    <?php if(($_product->isSaleable() && $_product->getPrice() != 0 || $productType == 'grouped' || $productType == 'bundle')): ?>
        <div class="add-to-cart">
            <?php if(!$_product->isGrouped()): ?>
                <!--<label for="qty"><?php echo $this->__('Qty:') ?></label>-->
                <div class="quantity left">
                    <input type="text" name="qty" id="qty" maxlength="12" value="<?php $prodDefaultQty = $this->getProductDefaultQty() * 1; if($prodDefaultQty === 0) { echo 1; } else { echo $prodDefaultQty; } ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
                    <ul class="buttons">
                        <li><a class="up" href="" onclick="changeItemQuantity('up'); return false;"></a></li>
                        <li><a class="down" href="" onclick="changeItemQuantity('down'); return false;"></a></li>
                    </ul>
                </div>
            <?php endif; ?>
            <button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart<?php if(count($customProducts)){ echo ' fancybox'; } ?>" href="#suggestionz" <?php if(!count($customProducts)): ?>onclick="productAddToCartForm.submit(this)"<?php endif; ?>><span><span><?php echo $buttonTitle ?></span></span></button>
        </div>
    <?php endif; ?>
</div>

<?php echo $this->getChildHtml('', true, true) ?>

The line 83 is where <button type="button" title="<?php echo $buttonTitle ?> is at

I don't know how to interpret the above. To me it's just a query. Is this problem database related? It seems a bit odd to me. Where can I look to solve this error? Can someone give me insight?

5
  • did you try to reindex data and refresh cache? May 7, 2015 at 15:45
  • 1
    post the starting line of the error report.
    – MTM
    May 7, 2015 at 15:45
  • post the whole report
    – Keyur Shah
    May 7, 2015 at 16:23
  • @Sergey Korzhov I have refreshed the cache more then 100 times though
    – Julian
    May 8, 2015 at 6:31
  • @Keyur Shah I have now the full report
    – Julian
    May 8, 2015 at 6:31

2 Answers 2

1

Most probably you can find core problem for this exception in the file

app/design/frontend/base/default/template/guapa/customaddtocart.phtml at line 83.

I think you are trying to get the collection count of products in that line and that is what makes problem here. Obviously the product collection holds some severe mistakes in it.

This is what we can tell about this error as of now. If you need further assistance, you need to include the customaddtocart.phtml file over here.

EDIT -1

Line 83 look like this.

<button type="button" title="<?php echo $buttonTitle ?>" 
    class="button btn-cart<?php if(count($customProducts)){ echo ' fancybox'; } ?>" 
    href="#suggestionz" <?php if(!count($customProducts)): ?>
    onclick="productAddToCartForm.submit(this)"<?php endif; ?>>
   <span><span><?php echo $buttonTitle ?></span></span>
</button>

Here you can see a call count($customProducts). If you look for $customProducts, you can find it very above this file. It looks like this.

<?php
$customProducts = $_product->getCustomProductCollection()
    ->addAttributeToSelect('required_options')
    ->setPositionOrder()
    ->addStoreFilter();
?>

By looking at this code, I can say that, the most possible reason is a member function call error on non-object. Because, $_product->getCustomProductCollection() returns null and thus addAttributeSelect() call is on then a non-object.

$_product->getCustomProductCollection() is wrong here. Because it gives a hint that you are trying to get a custom product collections FROM A PRODUCT INSTANCE and it doesn't make any sense at all (is this a magic method ? Really I dont know.).

Re-factor this definition. Then you are good to go.

0

I solved this problem by making a database dump from the old server and imported the dump on the new server by using PuTTy instead phpMyAdmin.

Commands I used:

On the oldserver:

mysqldump -uUSERNAME -pPASSWORD DATABASE_NAME > dump.sql
tar zcf dump.tar.gz dump.sql

Then I loaded the dump file to the new server.

tar zxf dump.tar.gz
mysqldump -uUSERNAME -pPASSWORD DATABASE_NAME < dump.sql

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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