function StoreAllAttribute($item_id, $allAttrib, $sku, $client) { // get attributeid list FROM POST $attIdList = array(); foreach ($allAttrib as $attributes) { if (!empty($attributes['attri_id'])) { $attIdList[] = $attributes['attri_id']; } } // DEL EXTRA ATTRIBUTES if (!class_exists('productHelper')) { // require while called from backend JLoader::register('productHelper', JPATH_SITE . DS . 'components' . DS . 'com_quick2cart' . DS . 'helpers' . DS . 'product.php'); JLoader::load('productHelper'); } //THIS DELETE db attributes which is not present now or removed $productHelper = new productHelper(); $productHelper->deleteExtaAttribute($item_id, $attIdList); if (!class_exists('quick2cartModelAttributes')) { // require while called from backend JLoader::register('quick2cartModelAttributes', JPATH_SITE . DS . 'components' . DS . 'com_quick2cart' . DS . 'models' . DS . 'attributes.php'); JLoader::load('quick2cartModelAttributes'); } $quick2cartModelAttributes = new quick2cartModelAttributes(); foreach ($allAttrib as $key => $attr) { $attr['sku'] = $sku; $attr['client'] = $client; $attr['item_id'] = $item_id; // Dont consider empty attributes if (!empty($attr['attri_name'])) { $quick2cartModelAttributes->store($attr); } } }