
Originally Posted by
shaztesting
I've looked into ways that others have retrieved attribute information and modified some of the Linkpoint code:
Code:
<?php
function before_process() {
global $order, $db;
$myorder = array();
if (isset($order->products[$i]['attributes'])) {
for ($j=0, $m=sizeof($order->products[$i]['attributes']); $j<$m; $j++) {
$myorder["items"][$i]['options' . $j]['name'] = $order->products[$i]['attributes'][$j]['option'];
$myorder["items"][$i]['options' . $j]['value'] = $order->products[$i]['attributes'][$j]['value'];
}
}
$attrib = $order->products[$i]['attributes'][$j]['value'];
}
?>
Your Attribute value is <?php echo $attrib;
?>
I would suggest that that's the right snippet of code to work from, perhaps like this:
Code:
<?php
function before_process()
{
global $order;
$erpNumber = '';
if (isset($order->products[$i]['attributes']))
{
for ($j = 0, $m = sizeof($order->products[$i]['attributes']); $j < $m; $j ++)
{
if ($order->products[$i]['attributes'][$j]['option_id'] == 28) {
if ($order->products[$i]['attributes'][$j]['value_id'] == 77) {
$erpNumber = $order->products[$i]['attributes'][$j]['value'];
break;
}
}
}
}
}
?>
Your Attribute value is <?php echo $erpNumber; ?>
That check is based on options_id 28 and values_id 77. It's going to be much more complicated to go based on products_attributes_id.
Adjust the 77 according to your data.