You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.
You wrote:
$cartdata = unserialize($item['cartdata']); $item['shipweight'] = $item['cartdata']; ...{$item['shipweight']}
I wrote:
$cartdata = unserialize($item['cartdata']); $shipweight = $cartdata['shipweight']; ...{$shipweight}
Your error is with '=$item['cartdata']'. Should be '=$cartdata['shipweight']'.
Offline
Hi Nick,
this is how my code looks now but it does not populate the cell in the spreadsheet.
foreach ($items as $num => $item) { $cartdata = unserialize($item['cartdata']); $shipweight = $cartdata['shipweight']; $export_file1 .= "\"{$order['id']}\","; $export_file1 .= "\"{$item['fname']} {$item['lname']}\",\"{$item['company']}\",\"{$item['addone']}\",\"{$item['addtwo']}\",\"\",\"{$item['city']}\","; $export_file1 .= "\"{$item['postalcode']}\",\"{$item['country']}\",\"\",\"{$order['email']}\","; $export_file1 .= "\"SR1\",\"CRL1\",\"\",\"\",\"LL\",\"1\",\"{$shipweight}\",\"{$order['datestamp']}\",\"\"" . $eol; } // End of foreach statement.
Offline
I apologize. I never checked the variable definition that you initially did. Instead of:
$shipweight = $cartdata['shipweight'];
It should be:
$shipweight = 0; if (!(empty($cartdata['sinshipinfo']['shipweight']))) {$shipweight = $cartdata['sinshipinfo']['shipweight'];}
Offline
Hi Nick,
that just puts a "0" in the spreadsheet:
foreach ($items as $num => $item) { $cartdata = unserialize($item['cartdata']); $shipweight = 0; if (!(empty($cartdata['sinshipinfo']['shipweight']))) {$shipweight = $cartdata['sinshipinfo']['shipweight'];} $export_file1 .= "\"{$order['id']}\","; $export_file1 .= "\"{$item['fname']} {$item['lname']}\",\"{$item['company']}\",\"{$item['addone']}\",\"{$item['addtwo']}\",\"\",\"{$item['city']}\","; $export_file1 .= "\"{$item['postalcode']}\",\"{$item['country']}\",\"\",\"{$order['email']}\","; $export_file1 .= "\"SR1\",\"CRL1\",\"\",\"\",\"LL\",\"1\",\"{$shipweight}\",\"{$order['datestamp']}\",\"\"" . $eol; } // End of foreach statement.
Offline
The weight should be in $cartdata['sinshipinfo']['shipweight']. You can always do:
print_r($cartdata);
To see what's in the array. I'm pretty sure that's the right set of keys.
Offline