I'm writing a PHP report which is designed to be exported purely as a CSV file, using commma delimiters.
There are three columns relating to product_id, these three columns are as follows:
SKU Parent / Child Parent SKU
12345 parent 12345
12345_1 child 12345
12345_2 child 12345
12345_3 child 12345
12345_4 child 12345
18099 parent 18099
18099_1 child 18099
At the moment the code looks like this:
<?php
$con_size = array (35,355,36,37,375,38,385,39,395,40,405,41,415,42,425,43,435,44,445,45,455,46,465,47,475,48,485);
$arrlength=count($con_size);
for($x=0;$x<$arrlength;$x++) {
// check if size is available
if($line['quantity_c_size_'.$con_size[$x].'_chain'] > 0 ) {
?>
<? echo 'Shoes'; ?>,
<?=$line['product_id']?>,
,
,
So at the moment this is simply echoing out the product_ID into the SKU column. How would I create an array which tests whether the 'product_id' is unique and if not suffixes the ID with _1, _2, etc.
Thanks,