Save configurator options as text

This commit is contained in:
Michael RICOIS 2017-08-07 12:44:59 +02:00
parent 4385237d29
commit 1ad4fcca68

View File

@ -100,7 +100,29 @@ class OrderDetail extends OrderDetailCore
$this->id_configurator = (int)$product['id_configurator'];
// Configurator Description
$this->configurator_desc = '';
if ($this->id_configurator != 0) {
$options = ConfiguratorStorage::getOptProductFlatten($this->id_configurator);
if (count($options) > 0) {
foreach ($options as $group) {
// Liste option to text
$this->configurator_desc.= $group['name'].': ';
$optCount = count($group['value']);
$i = 0;
foreach($group['value'] as $opt) {
// Si option est "file" alors copier image
if ($group['type'] == 'file') {
copy(_PS_UPLOAD_DIR_.'simu/'.$this->product_id.'/'.$group['reference'].'/'.$opt,
_PS_UPLOAD_DIR_.'orders/'.$this->id_order.'/'.$this->product_id.'/'.$group['reference'].'/'.$opt);
}
$i++;
$this->configurator_desc.= $opt;
if ($i < $optCount) { $this->configurator_desc.= ','; }
}
$this->configurator_desc.= "\n";
}
}
}
// Add new entry to the table
$this->save();