Skip to content

Instantly share code, notes, and snippets.

@allendav
Created January 18, 2018 19:49
Show Gist options
  • Save allendav/1b19ce2625b07d5c7490e20176785876 to your computer and use it in GitHub Desktop.
Save allendav/1b19ce2625b07d5c7490e20176785876 to your computer and use it in GitHub Desktop.
Quick PHP to generate product add-on import string (6 groups of 75)
<?php
$bar = array();
for ( $group = 0; $group < 6; $group++ ) {
$options = array();
for ( $option = 0; $option < 75; $option++ ) {
$options[] = array(
'label' => "GROUP $group OPTION $option",
'price' => '1',
'min' => '',
'max' => ''
);
}
$bar[] = array(
'name' => "GROUP $group",
'description' => "DESCRIPTION $group",
'type' => 'radiobutton',
'position' => 0,
'options' => $options,
'required' => 0
);
}
$foo = serialize( $bar );
echo "$foo\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment