• Payment Plugins Poll

    We need your feedback on the need for updated payment plugins. Please go here and give us your feedback.

  • Joomla 5.1

    For running J!5.1 you must install Fabrik 4.1
    See also Announcements

  • Subscription and download (Fabrik 4.1 for J!4.2+ and J!5.1) are working now

    See Announcement
    Please post subscription questions and issues here

    We have resolved the issue with the J! updater and this will be fixed in the next release.

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
 
Back
Top