KataoProductFamily.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /**
  3. * Subclass for representing a row from the 'katao_product_family' table.
  4. *
  5. * @package lib.model
  6. */
  7. class KataoProductFamily extends BaseKataoProductFamily {
  8. public function __toString() {
  9. return $this->getName();
  10. }
  11. public function save($con = null) {
  12. if ('' == $this->getUrlIdentifier()) {
  13. $this->setUrlIdentifier(Catalyz::normalizeUrlIdentifier($this->getName()));
  14. }
  15. parent::save($con);
  16. }
  17. public function getKataoProductCategoryLink($with_link = false) {
  18. $result = '';
  19. if (null != $katao_product_category = $this->getKataoProductCategory()) {
  20. if ($with_link) {
  21. $result = link_to($katao_product_category->getName(), '@katao_product_category_show?id=' . $katao_product_category->getId());
  22. } else {
  23. $result = $katao_product_category->getName();
  24. }
  25. }
  26. return $result;
  27. }
  28. public function isDeletable() {
  29. return (0 == $this->countKataoProducts());
  30. }
  31. }