I’ve built and order object which outputs the current variables as shown below.
I would like the alert to be…the two divs highlighted green. I’m assuming i’ll need to incorporate some jquery.. here’s what i have:
<div class='address_info left'>
<h3>Billing Info</h3>
<ul>
<li><label>Account No: </label><?php echo $order->patient_id;?></li>
<li><label>Name: </label><?php echo trim($order->billing_address['name']); ?></li>
<li><label>Address 1: </label><?php echo trim($order->billing_address['addr1']);?></li>
<li><label>Address 2: </label><?php echo trim($order->billing_address['addr2']);?></li>
<li><label>City, State, Zip:</label><?php echo trim($order->billing_address['city'] . ' ' . $order->billing_address['state'] . ' ' . $order->billing_address['zip']);?></li>
<li><label>Email: </label><a href='mailto:<?php echo $order->customer_email;?>'>Send Customer Email</a></li>
<li><label>Phone: </label><?php echo $order->customer_phone;?></li>
</ul>
</div>
<div class='address_info right'>
<h3>Shipping Info</h3>
<ul>
<li><label>Name: </label><?php echo $order->shipping_address['name']; ?></li>
<li><label>Address 1: </label><?php echo $order->shipping_address['addr1'];?></li>
<li><label>Address 2: </label><?php echo $order->shipping_address['addr2'];?></li>
<li><label>City, State, Zip:</label><?php echo $order->shipping_address['city'] . ' ' . $order->shipping_address['state'] . ' ' . $order->shipping_address['zip']?></li>
<li><label></label></li>
<li><label></label></li>
<li><label></label></li>
</ul>
</div>
I’m currently using some css on hover for colors.
div.address_info.left:hover {
background: red;
color: #fff; }
div.address_info.right:hover {
background: #5C991F;
color: #fff; }
div.order_info:hover {
background: #3366FF;
color: #fff; }
So here’s my update:
if (count(array_diff($this->billing_address, $this->shipping_address)) > 0)
return false;
else
return true;
I guess my real question is how to run a jquery event on my data. Sorry for being so vague again at the start.. i guess we didn’t get off on the right foot. Would love some help with the jQuery though. Thanks in advance.
Thanks for all the help.. i figured it out!
if($order->check_addresses())
$class='same';
else
$class='different';
<div class='address_info left <?php echo $class; ?>'>
<div class='address_info right <?php echo $class; ?>'>
and than the css
div.same {background-color: green;}
div.different {background-color: red;}
Using a hidden input you could do this very easily. Here is an example using your code.