Jump to content

Recommended Posts

$itemGroup = new ItemGroup($imhRegDetails);

$item = isset($_POST['imhreg']) ? $itemGroup->item((int) $_POST['imhreg']) : null;

$item2 = isset($_POST['recep']) ? $itemGroup->item((int) $_POST['recep']) : null;

 

$totalCost = $item->getCost() + $item2->getCost();

 

=======================================================

<?=$item->getCost() > 0 ? $item->getName() : ''?>

<?=$item->getCost() > 0 ? '$' . $item->getCost() : ''?>

<?=$item2->getCost() > 0 ? $item2->getName() : ''?

<?=$item2->getCost() > 0 ? '$' . $item2->getCost() :''?>

==========================================================

 

I know that isset is supposed to go somewhere in the second set of code but I dont know where or how do to it. Can someone help me?

Link to comment
https://forums.phpfreaks.com/topic/74631-help/
Share on other sites

you could try changing the null's to 0

 

~OR~

 

<?=!is_null($item->getCost()) ? $item->getName() : ''?>                     
<?=!is_null($item->getCost()) ? '$' . $item->getCost() : ''?>
<?=!is_null($item2->getCost()) ? $item2->getName() : ''?
<?=!is_null($item2->getCost()) ? '$' . $item2->getCost() :''?>

 

Link to comment
https://forums.phpfreaks.com/topic/74631-help/#findComment-377239
Share on other sites

This is currently what my code looks like..

 

<?=($item->getCost() > 0) ? $item->getName() : ''?>
<?=($item->getCost() > 0) ? '$' . $item->getCost() : ''?>
<?=($item2->getCost() > 0) ? $item2->getName() : ''?>
<?=($item2->getCost() > 0) ? '$' . $item2->getCost() :''?>

 

When I use it I get this error...

 

Fatal error: Call to a member function on a non-object in /home/content/T/A/I/TAIMH/html/confirm2-2.php on line 8

 

my code for line 8 and others is....

 

$itemGroup = new ItemGroup($imhRegDetails);
$item = isset($_POST['imhreg']) ? $itemGroup->item((int) $_POST['imhreg']) : null;
$item2 = isset($_POST['recep']) ? $itemGroup->item((int) $_POST['recep']) : null;

$totalCost = $item->getCost() + $item2->getCost();       <======Line 8=======>

$order = new PaypalOrder(array($item, $item2));

 

Does this help anyone anymore to help me figure this out?

Link to comment
https://forums.phpfreaks.com/topic/74631-help/#findComment-377251
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.