• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

How to avoid error notice for my own php code in file default.php for list template?

Hi,
I have Joomla 2.5 and fabrik 3.0.9.

I have made my custom calculation on my list1 using custom template for list. In file default.php i have code:
PHP:
<td colspan="5"><table class="rysio1"> 
                     <?php  $j=0;
echo '<tr class="fabrik_calculations">';
                                        echo "<td>"; 
$db =& JFactory::getDBO();
$order1 =FabrikHelperElement::filterValue(11152); //with 81
echo "<br/>";
if (isset($order1)) {
$query = "SELECT  `ip2_zamowienie_symbol1` FROM  `ccjom_cc_kk_ip2_zamowienie`  WHERE  `id`= ".$order1."  ";
$db->setQuery($query);
$result = $db->loadResult();
$zam1 = $result;
}
if (!(isset($order1))) {
$zam1 = "Razem wszystkie zam?wienia";
}
echo " ---- <strong><font color='blue'> Zam?wienie nr: $zam1 </font></strong> ---- <br/><br/>";
                                        echo "</td>";

Problem is for case:
if (!(isset($order1))) {
$zam1 = "Razem wszystkie zam?wienia";


I get an notice error:
Notice: Undefined offset: 0 in /var/www/cc.joomla/components/com_fabrik/helpers/element.php on line 91
---- Zam?wienie nr: Razem wszystkie zam?wienia ----

I have no idea how to clean/remove this error notice.

I try also:
PHP:
$db =& JFactory::getDBO();
$order1 =FabrikHelperElement::filterValue(11152); //with 81
if ($order1==0){
$zam1 = 'Razem wszystkie zam?wienia';
}
else {
$query = "SELECT  `ip2_zamowienie_symbol1` FROM  `ccjom_cc_kk_ip2_zamowienie`  WHERE  `id`= ".$order1."  ";
$db->setQuery($query);
$result = $db->loadResult();
$zam1 = $result;
}
echo " -- Zam?wienie nr: $zam1 -- <br/><br/>";

but also for case:
if ($order1==0){
$zam1 = 'Razem wszystkie zam?wienia';
}

i get the same error notice.

line 91 is in fabrik file:
/var/www/cc.joomla/components/com_fabrik/helpers/element.php
is
line 91 ---- $value = $filters['value'][$index];
sample of this code with line 91 is:
PHP:
public static function filterValue($elementId)
    {
        $app = JFactory::getApplication();
        $pluginManager = FabrikWorker::getPluginManager();
        $model = $pluginManager->getElementPlugin($elementId);
        $listModel = $model->getListModel();
        $listid = $listModel->getId();
        $key = 'com_fabrik.list' . $listid . '_com_fabrik_' . $listid . '.filter';
        $filters = JArrayHelper::fromObject($app->getUserState($key));
        $elementIds = (array) JArrayHelper::getValue($filters, 'elementid', array());
        $index = array_search($elementId, $elementIds);
        $value = $filters['value'][$index];

        return $value;
    }

This error notice appear when in Joomla configurations is set : error reporting = maximum
for error reporting = System Default this error notice doesn't appear.

I need use for my Joomla error reporting = maximum and need remove this error-notice.

Can i get any help?
 
Oh very thanks!
I have modified my code to this:
PHP:
$db =& JFactory::getDBO();
$order1 =FabrikHelperElement::filterValue(11152); //with 81
echo "<br/>";
if (isset($order1)) {
$query = "SELECT  `ip2_zamowienie_symbol1` FROM  `ccjom_cc_kk_ip2_zamowienie`  WHERE  `id`= ".$order1."  ";
$db->setQuery($query);
$result = $db->loadResult();
$zam1 = $result;
}
if ($order1==0) {
$zam1 = "Razem wszystkie zam?wienia";
}
echo " ---- <strong><font color='blue'> Zam?wienie nr: $zam1 </font></strong> ---- <br/><br/>";
                                        echo "</td>";


And earlier write manually changes (in my actuall working fabrik) made by you on your link on git hub on file components/com_fabrik/helpers/element.php.
I will actualize from GitHub when new version will arrive.

Now is OK, also for case:
if ($order1==0) {
$zam1 = "Razem wszystkie zam?wienia";
}

Thanks!
 
Rather than isset($order1) you should probably do "if ($order1 !== false)".

The filterValue() function now returns a value (if the filter is set) or 'false' if it isn't. And testing isset() on a false value will return true- it's set, to false, and only null / uninitialized counts as not isset().

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top