Source of file BrandProductBulkLoadingDecorator.php
Size: 0,522 Bytes - Last Modified: 2021-12-23T10:40:33+00:00
/var/www/docs.ssmods.com/process/src/code/BrandProductBulkLoadingDecorator.php
1234567891011121314151617181920 | <?php class BrandProductBulkLoadingDecorator extends Extension { public function importBrand($obj, $val, $record) { //note: can't pass by refrence in extension $val = strtolower(trim($val)); if ($brand = DataObject::get_one('ProductBrand', "\"Name\" = LOWER('$val')")) { $obj->BrandID = $brand->ID; } } public function updateColumnMap(&$columnmap) { $columnmap['Brand'] = '->importBrand'; $columnmap['Manufacturer'] = '->importBrand'; } } |