<?php
require_once dirname(dirname(__FILE__))."/page.php";
require_once dirname(dirname(dirname(dirname(__FILE__))))."/dal/productDAL.php";
class contact extends page{
	/*
	 * 取得聯絡我們網址
	 * @param $id 商品ID
	 */
	public function linkContact($id = 0) {
		if ($this->htVisible[6] === 1) {
			if (!empty($id) && $id != 0) {
				$dal = new productDAL();
				$dal->ProductID = $id;
				$dal->loadRecord();
				if (($dal->Visible != 1 && $dal->Disable != 0) || ($dal->CategoryVisible != 1 && $dal->CategoryDisable != 0) || ((int)$dal->ParentID > 0 && $dal->ParentVisible != 1 && $dal->ParentDisable != 0) || ((int)$dal->ParentID > 0 && (int)$dal->GrandID > 0 && $dal->GrandVisible != 1 && $dal->GrandDisable != 0)) $id = 0;
			}
		
			$link = "/{$this->htLink[6]}";
			if ($this->registry->webLinkType === "2") {
				$link .= ($id != 0) ? "/{$dal->TwPathName}/" : "/";
			} else {
				$link .= ($id != 0) ? "-{$id}.html" : ".html";
			}
		} else {
			$link = "/";
		}
		return $link;
	}
	
	/* 結構化資料 */
	public function seoGoogleSearch() {
		$txt = "";
		$image = $this->getLogo();
		$phone = $this->registry->webPhone ?? $this->registry->webMobile;
	
		if ($this->registry->contactIsShowJason === 1) $txt .= $this->localBusinessHtml($image, $this->registry->webTitle, $phone, $this->registry->contactRatingValue, $this->registry->contactBestRating);
		if ($this->registry->contactIsShowStars === 1) $txt .= $this->isShowStars($this->registry->contactRatingValue, $this->registry->contactReviewCount);
		return $txt;
	}
}
?>