Jump to content

HELP!!


lauramarie

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.