This has to do with coming up with php for the google trusted store badge - specifically setting the estimated delivery date.
I have this code on my success page that prints the data:
<?php
$order_items = $order->getAllItems();
foreach($order_items as $item) {
$product = Mage::getModel('catalog/product')->load($item->getProductId());
echo $product->getAttributeText('estdelivery'); //changed getAttributeText to getData
echo '|';
}
?>
if there is more than one item in the order it will print the attribute data - in this case 6 and 7
as one item has 6 days set in the attribute the other item has 7 days set in the attribute
I need a way in php to only print the higher number i.e. 7
the code i am currently using in the badge is
<span id="gts-o-est-delivery-date"><?php echo $deliveryDate=Date('Y-m-d', strtotime("+7 days")); ?></span>
But I need it to find all the delivery date attributes of all the items and enter the larger number into that code for delivery date
updated so I am using this and it successfully returns the higher of the variables
<?php
$order_items = $order->getAllItems();
foreach($order_items as $item) {
$product = Mage::getModel('catalog/product')->load($item->getProductId());
}
$a=array($product->getAttributeText('estdelivery'));
$c=0;
foreach($a as $b)
{
if($b>$c)
$c=$b;
}
echo $c;
?>
So how do i got from that to the code I am using for estimated delivery date?? will this work below?
<span id="gts-o-est-delivery-date"><?php echo $deliveryDate=Date('Y-m-d', strtotime("$order_items = $order->getAllItems();
foreach($order_items as $item) {
$product = Mage::getModel('catalog/product')->load($item->getProductId());
}
$a=array($product->getAttributeText('estdelivery'));
$c=0;
foreach($a as $b)
{
if($b>$c)
$c=$b;
}
echo $c;
days")); ?></span>