variation[$name] = $value; } public function getData() { $combination = []; $this->weight = round((float)$this->weight, 2); foreach ($this as $key => $value){ if($key=='ean_code' && empty($value)){ continue; } if($key === 'images' && is_array($value) && !empty($value)){ $combination['Images'] = ['Image' => $value]; } else if($key !== 'images') { $combination[$key] = $value; } } return $combination; } public function getStockData() { $combination = [ 'sku' => $this->sku, 'price' => $this->price, 'special_price' => $this->special_price, 'quantity' => $this->quantity >= 0 ? $this->quantity : 0 ]; return $combination; } public function getOnlyStockData() { $combination = [ 'sku' => $this->sku, 'quantity' => $this->quantity >= 0 ? $this->quantity : 0 ]; return $combination; } }