Adding related products problem

Adding related products problem © by gerard79/sxc.hu

Today I had a problem when I want to add related product to Magento Professional 1.9.0.0., it did not work. After some tracing thrown errors and comparing files with other Magento versions I found missing part. Magento Professional has missing lines of code in Related.php. So, if someone stuck on the same problem, here is the solution!

To correct this issue, do it in Magento way. So create your new module and rewrite that block. Here is the file where you can find these lines of code:
\app\code\core\Mage\Adminhtml\Block\Catalog\Product\Edit\Tab\Related.php

$this->addColumn('position', array(
            'header'            => Mage::helper('catalog')->__('Position'),
            'name'              => 'position',
            'type'              => 'number',
            'validate_class'    => 'validate-number',
            'index'             => 'position',
            'width'             => 60
        ));

to

$this->addColumn('position', array(
            'header'            => Mage::helper('catalog')->__('Position'),
            'name'              => 'position',
            'type'              => 'number',
            'validate_class'    => 'validate-number',
            'index'             => 'position',
            'width'             => 60,
            'editable'          => !$this->isReadonly(),
            'edit_only'         => !$this->_getProduct()->getId()
        ));

Enjoy debugging! 🙂

You made it all the way down here so you must have enjoyed this post! You may also like:

How to add custom product relations in Magento Marko Martinovic
Marko Martinovic, | 81

How to add custom product relations in Magento

Choosing a right event to observe Zvonimir Buric
Zvonimir Buric, | 16

Choosing a right event to observe

Extension license for local project. Yes, no? Ivan Galambos
Ivan Galambos, | 5

Extension license for local project. Yes, no?

3 comments

  1. @Andrew
    This is not wrong. As I wrote “To correct this issue, do it in Magento way. So create your new module and rewrite that block.”

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <blockquote cite=""> <code> <del datetime=""> <em> <s> <strike> <strong>. You may use following syntax for source code: <pre><code>$current = "Inchoo";</code></pre>.

Tell us about your project

Drop us a line. We'd love to know more about your project.