Appear div according to condition

Asked

Viewed 52 times

1

Good afternoon

At the end of an order I want to appear a div depending on the payment method, maybe identify by the name of the payment method. The div in question is this

<div>
<h2>
	<a href="javascript:submitPaymentByPopUp('<?php echo $viewData["order_number"];?>','<?php echo $viewData['displayTotalInPaymentCurrency'];?>','','site',500,600);">Fazer pagamento</a></h2>
	</div>

the whole page code is this:

<?php
defined ('_JEXEC') or die();

?>
<div class="post_payment_payment_name" style="width: 100%">
	<span class="post_payment_payment_name_title"><?php echo vmText::_ ('VMPAYMENT_STANDARD_PAYMENT_INFO'); ?> </span>
	<?php echo  $viewData["payment_name"]; ?>
</div>

  <div>
<h2>
	<a href="javascript:submitPaymentByPopUp('<?php echo $viewData["order_number"];?>','<?php echo $viewData['displayTotalInPaymentCurrency'];?>','','site',500,600);">Fazer pagamento</a></h2>
	</div>


<div class="post_payment_order_number" style="width: 100%">
	<span class="post_payment_order_number_title"><?php echo vmText::_ ('COM_VIRTUEMART_ORDER_NUMBER'); ?> </span>
	<?php echo  $viewData["order_number"]; ?>
</div>

<div class="post_payment_order_total" style="width: 100%">
	<span class="post_payment_order_total_title"><?php echo vmText::_ ('COM_VIRTUEMART_ORDER_PRINT_TOTAL'); ?> </span>
	<?php echo  $viewData['displayTotalInPaymentCurrency']; ?>
</div>
<a class="vm-button-correct" href="<?php echo JRoute::_('index.php?option=com_virtuemart&view=orders&layout=details&order_number='.$viewData["order_number"].'&order_pass='.$viewData["order_pass"], false)?>"><?php echo vmText::_('COM_VIRTUEMART_ORDER_VIEW_ORDER'); ?></a>

My question is, how the name of the payment method is to hide the div where it is called the pop up, IE, I just want it to appear for a payment method.

  • Be clearer in the description of the problem, how it is difficult to understand what you are doing and what result you want to achieve.

  • My point is, as the name of the payment method is to hide the div where the pop up is called, I just want it to appear for a payment method.

  • See if the answer I gave solves your problem, @Lfredo.

  • No @Marcelo de Andrade, I put the code but the page shows the error HTTP ERROR 500

1 answer

0

Verify the means of payment using the if:

<?php if ($viewData["payment_name"] == 'PayPal'): ?>
    <a href="javascript:submitPaymentByPopUp('<?=$viewData["order_number"];?>','<?=$viewData['displayTotalInPaymentCurrency'];?>','','site',500,600);">Fazer pagamento</a></h2>
<?php end if; ?>

Tip:

You can use the short tag <?= ?> to display text instead of the full tag <?php echo ... ?>

  • No @Marcelo de Andrade, I put the code but the page shows the error HTTP ERROR 500.

  • Enable error messages from PHP to check what is occurring. Erro 500 is too generic to know what happened.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.