/** * @param Material $cost * * @return $this */ public function addCost(Material $cost) { if (array_key_exists($cost->getName(), $this->cost)) { $amount = $this->cost[$cost->getName()]->getAmount(); $amount->add($cost->getAmount()); } else { $this->cost[$cost->getName()] = $cost; } return $this; }
/** * Get ebay name suggestion for this product * @param Int $language_id * @return String */ public function getEbayNameSuggestion($language_id) { $ebay_name = array(); $ebay_name[] = $this->brand_name; $ebay_name[] = $this->category_name; foreach ($this->materials as $id => $name) { $ebay_name[] = Material::getName($name, $language_id); } $attributes = ProductAttribute::getOldStylesFunction()->retrieveList(ProductAttribute::GROUP_ID_SYMBOL, "shp.products_id = {$this->id}"); foreach ($attributes as $attr) { $ebay_name[] = $attr['name']; } $ebay_name[] = ucfirst($this->getTargetGroup($language_id)); return implode(' ', $ebay_name); }