示例#1
0
 public function toArray(Webshop_Product $item, $type = '*')
 {
     $data = array('subcategory_id' => $item->getSubcategoryId(), 'category_id' => $item->getCategoryId(), 'position' => $item->getPosition());
     $tsl = array('product_id' => $item->getId(), 'lng' => $item->getLng(), 'name' => $item->getName(), 'permalink' => $item->getPermalink(), 'info' => $item->getInfo(), 'image' => $item->getImage(), 'active' => $item->getActive());
     if ($type == 'item') {
         return $data;
     } elseif ($type == 'tsl') {
         return $tsl;
     }
     return array_merge($data, $tsl);
 }
示例#2
0
 public function validate(Webshop_Product $object)
 {
     $this->validateTextRequired($object->getName(), 'name', 'content');
     $this->validateTextRequired($object->getImage(), 'image', 'general');
     $this->validateTextareaRequired($object->getInfo(), 'info', 'content');
     $msgr = Sanmax_MessageStack::getInstance($this->_namespace);
     if (!$msgr->getNamespaceMessages()) {
         return true;
     }
     return false;
 }