Openbiz's Blog

Web Solutions

Archive for the ‘Magento’ Category

Running Magento 1.3 on PHP 5.3

leave a comment »

Magento 1.3 is not compatible with PHP 5.3 without any additional modifications. So if you decide to run Magento with PHP 5.3, here is a two-step description how to do it:

1) Open index.php and locate the line containing :

error_reporting(E_ALL | E_STRICT);

It is the 35th line in Magento 1.3.3.0. Replace it with :

error_reporting((E_ALL | E_STRICT) & !E_DEPRECATED);

In PHP 5.3 functions like split() and ereg() are deprecated. Magento 1.3 widely uses these two functions so you have to disable error reporting for the newly introduced error level E_DEPRECATED.

2) Open lib/Varien/Object.php and look for the method :

public function __toString(array $arrAttributes = array(), $valueSeparator=’,’)
{
    $arrData = $this->toArray($arrAttributes);
    return implode($valueSeparator, $arrData);
}

It is line 484 in Magento 1.3.3.0. Replace it with

public function __toString()
{
    if(func_num_args() > 0) {
        $arrAttributes = func_get_arg(0);
    } else {
        $arrAttributes = array();
    }
    if(func_num_args() > 1) {
        $valueSeparator = func_get_arg(1);
    } else {
        $valueSeparator = ‘,’;
    }
    $arrData = $this->toArray($arrAttributes);
    return implode($valueSeparator, $arrData);
}

With PHP 5.3 the magic method __toString() no more accepts any parameters. That’s why the old method declaration will cause the following error:

Fatal error: Method Varien_Object::__tostring() cannot take arguments in /magento/lib/Varien/Object.php

Note: The steps listed above are tested with Magento 1.3.3.0.

Advertisements

Written by openbizblog

December 10, 2011 at 1:36 pm

Posted in Magento

Magento Random Related Products

leave a comment »

Before you put that module there is no limit of the displayed items in the related products sidebar. But thanks to this module you can now choose how many items to be displayed in the related products side menu. Each time the shown products are randomly chosen from all related products. The option for selecting the number of shown products is in the administrative panel (System -> Configuration -> Catalog -> Random Related Products).

Supported versions : 1.3, 1.4

You can download the module from here

Written by openbizblog

November 9, 2011 at 2:07 am

Posted in Magento