<?php
/**
* This is commercial software, only users who have purchased a valid license
* and accept to the terms of the License Agreement can install and use this
* program.
*
* Do not edit or add to this file if you wish to upgrade Enamoo S5 to newer
* versions in the future.
*
* @copyright Copyright (c) 2015 GodoSoft.
* @link http://www.godo.co.kr
*/
namespace Widget\Front\Board;
use Component\PlusShop\PlusReview\PlusReviewArticleFront;
class PlusReviewPhotoWidget extends \Bundle\Widget\Front\Board\PlusReviewPhotoWidget
{
public function index()
{
parent::index();
$req = [
'cols'=> $this->getData('cols'),
'rows'=> $this->getData('rows'),
'thumSizeType'=> $this->getData('thumSizeType'),
'thumWidth'=> $this->getData('thumWidth'),
];
$plusReviewArticle = new PlusReviewArticleFront();
$pageNum = $req['cols'] * $req['rows'];
$data= $plusReviewArticle->getList(['pageNum'=>$pageNum,'reviewType'=>'photo'],false,false);
//추가 사항
foreach($data['list'] as $k=>$v){
$d = $this->_get_other_data($v['goodsNo'],$plusReviewArticle->db);
$data['list'][$k]['plusgoodsPt'] = $d['goodsPt'];
$data['list'][$k]['goodsImageSrc'] = '/data/goods/'.$v['imagePath'].$d['goodsImage'];
}
$this->setData('data',$data['list']);
$this->setData('req',$req);
//print_r($data['list']);
}
//추가 메쏘드
private function _get_other_data($goodsNo,$db){
//평가 가져오기
$q = "select sum(goodsPt) as goodsPt,count(*) as cnt from es_plusReviewArticle where goodsNo='$goodsNo' and applyFl='y'";
$data = $db->query_fetch($q, null);
//$return['goodsPt'] = floatval($data[0]['goodsPt']/$data[0]['cnt']);
$contgoodsPt=number_format($data[0]['goodsPt']/$data[0]['cnt'],1);// 평가 평균계산하기
$return['goodsPt'] = floatval($contgoodsPt);// 평가 평균수치 처리
//상품 이미지 가져오기
$q = "select * from es_goodsImage where goodsNo='$goodsNo' and imageKind='main'";
$data = $db->query_fetch($q, null);
$return['goodsImage'] = $data[0]['imageName'];
return $return;
}
}
분류 전체보기
- 고도몰 메인 위젯 데이터 출력 2019.12.16
- 고도몰5 파일 포스터에러 출력 방식 2019.12.16
- 고도몰5 빌더 추가시 업데이트 노출 코드 2019.12.16
- PHP 시간 출력 함수 2019.12.16
- 구글맵 좌표 파싱 문제 해결 2019.12.16
고도몰 메인 위젯 데이터 출력
2019. 12. 16. 13:18
고도몰5 파일 포스터에러 출력 방식
2019. 12. 16. 13:14
// error_log(print_r($strUpdateSQL,true),3,'/www/baiwan09151_godomall_com/tmp/res.txt');
error_log(print_r($this->goodsNo,true),3,'/www/baiwan09151_godomall_com/tmp/res.txt');
고도몰5 빌더 추가시 업데이트 노출 코드
2019. 12. 16. 13:13
빌더추가 빌더내용출력
컨트롤러경로 : /module/Controller/Front/Goods/GoodsViewController.php
/**
* This is commercial software, only users who have purchased a valid license
* and accept to the terms of the License Agreement can install and use this
* program.
*
* Do not edit or add to this file if you wish to upgrade Godomall5 to newer
* versions in the future.
*
* @copyright ⓒ 2016, NHN godo: Corp.
* @link http://www.godo.co.kr
*/
namespace Controller\Front\Goods;
use Component\Board\Board;
use Component\Board\BoardBuildQuery;
use Component\Board\BoardList;
use Component\Board\BoardWrite;
use Component\Naver\NaverPay;
use Component\Page\Page;
use Component\Promotion\SocialShare;
use Component\Mall\Mall;
use Framework\Debug\Exception\AlertRedirectException;
use Framework\Debug\Exception\Except;
use Framework\Debug\Exception\AlertBackException;
use Component\Validator\Validator;
use Message;
use Globals;
use Request;
use Logger;
use Session;
use Exception;
use Endroid\QrCode\QrCode as EndroidQrCode;
use SocialLinks\Page as SocialLink;
use FileHandler;
use App;
class GoodsViewController extends \Bundle\Controller\Front\Goods\GoodsViewController
{
public $db;
/**
* {@inheritdoc}
*/
public function index()
{
$this->db = \App::load('DB');
$goodsNo = Request::get()->get('goodsNo');
$strSQL = "SELECT externalVimeoFl, externalVimeoUrl FROM es_goods WHERE goodsNo = '$goodsNo' ";
$result = $this->db->query($strSQL);
$data = $this->db->fetch($result);
$this->setData('viemourl', $data['externalVimeoUrl']);
// echo "<pre>";
// print_r($data);exit;
parent::index();
// //DB 호출
// $goods = \App::load('\\Component\\Goods\\Goods');
// $goodsNo = Request::get()->get('goodsNo');
// $data = $goods->getGoodsInfo($goodsNo);
// print_r($data); exit;
// $viemourl = $data['externalVimeoUrl'];
// $this->setData('viemourl', $viemourl);
}
}
파일경로 : /module/Component/Goods/GoodsAdmin.php
<?php
/**
* 상품 class
*
* 상품 관련 관리자 Class
* @author artherot
* @version 1.0
* @since 1.0
* @copyright Copyright (c), Godosoft
*/
namespace Component\Goods;
use Component\Member\Group\Util as GroupUtil;
use Component\Member\Manager;
use Component\Page\Page;
use Component\Storage\Storage;
use Component\Database\DBTableField;
use Component\Validator\Validator;
use Framework\Debug\Exception\HttpException;
use Framework\Debug\Exception\AlertBackException;
use Framework\File\FileHandler;
use Framework\Utility\ImageUtils;
use Framework\Utility\StringUtils;
use Framework\Utility\ArrayUtils;
use Encryptor;
use Globals;
use LogHandler;
use UserFilePath;
use Request;
use Exception;
use Session;
use App;
class GoodsAdmin extends \Bundle\Component\Goods\GoodsAdmin
{
const ECT_INVALID_ARG = 'GoodsAdmin.ECT_INVALID_ARG';
const TEXT_REQUIRE_VALUE = '%s은(는) 필수 항목 입니다.';
const TEXT_USELESS_VALUE = '%s은(는) 사용할 수 없습니다.';
const TEXT_NOT_EXIST_VALUE = '%s 필수 항목이 존재하지 않습니다.';
const TEXT_NOT_EXIST_OPTION = '옵션 항목이 존재하지 않습니다.';
const TEXT_ERROR_VALUE = '조건에 대해 처리중 오류가 발생했습니다.';
const TEXT_ERROR_BATCH = '일괄 처리할 데이터오류로 인해 처리가 되지 않습니다.';
const DEFAULT_PC_CUSTOM_SOLDOUT_OVERLAY_PATH = '/data/icon/goods_icon/custom/soldout_overlay';
const DEFAULT_MOBILE_CUSTOM_SOLDOUT_OVERLAY_PATH = '/data/icon/goods_icon/custom/soldout_overlay_mobile';
public $goodsNo;
public $imagePath;
public $etcIcon;
public $naverConfig;
public $daumConfig;
public $paycoConfig;
protected $goodsGridConfigList; // 상품그리드 디폴트 설정 항목
// 우에 변수설정은 그냥 새파일 추가할때 원래 소스에걸 그대로 가져오면 됨
/**
* 생성자 [이부분은 새(클래스)파일 추가할때 반드시 따라다녀야 됨]
*/
public function __construct()
{
parent::__construct();
}
/**
* 상품 정보 저장 [저장하는 함수 재정의함 원래 코드는 parent::saveInfoGoods($arrData) 이런식으로 호출하면 됨]
*
* @param array $arrData 저장할 정보의 배열
*/
public function saveInfoGoods($arrData)
{
// error_log(print_r($arrData,true),3,'/www/baiwan09151_godomall_com/tmp/res.txt');
//이부분은 원래 saveInfoGoods 실행하는 부분
$res = parent::saveInfoGoods($arrData);
//추가코드 (먼저 추가코드 실행하고 후에 원래코드 실행하거나 반대로 해도 됨.)
$strUpdateSQL = "UPDATE " . DB_GOODS . " SET externalVimeoUrl = '" . $arrData['externalVimeoUrl'] . "' , externalVimeoFl = '" . $arrData['externalVimeoFl'] . "' WHERE goodsNo = '";
$strUpdateSQL .= $this->goodsNo . "' ";
$this->db->query($strUpdateSQL);
// error_log(print_r($strUpdateSQL,true),3,'/www/baiwan09151_godomall_com/tmp/res.txt');
// error_log(print_r($this->goodsNo,true),3,'/www/baiwan09151_godomall_com/tmp/res.txt');
return $res;
}
}
포스터갑 db입력
public function saveInfoGoods($arrData)
{
//추가코드 (먼저 추가코드 실행하고 후에 원래코드 실행하거나 반대로 해도 됨.)
$strUpdateSQL = "UPDATE " . DB_GOODS . " SET externalVimeoUrl = '" . $arrData['externalVimeoUrl'] . "' , externalVimeoFl = '" . $arrData['externalVimeoFl'] . "' WHERE goodsNo = '" . $arrData['goodsNo'] . "' ";
$this->db->query($strUpdateSQL);
//이부분은 원래 saveInfoGoods 실행하는 부분
$res = parent::saveInfoGoods($arrData);
return $res;
}
PHP 시간 출력 함수
2019. 12. 16. 13:12
<?php
// 날짜 계산 함수
function passing_time($datetime) {
$time_lag = time() - strtotime($datetime);
if($time_lag < 60) {
$posting_time = "방금";
} elseif($time_lag >= 60 and $time_lag < 3600) {
$posting_time = floor($time_lag/60)."분 전";
} elseif($time_lag >= 3600 and $time_lag < 86400) {
$posting_time = floor($time_lag/3600)."시간 전";
} elseif($time_lag >= 86400 and $time_lag < 2419200) {
$posting_time = floor($time_lag/86400)."일 전";
} else {
$posting_time = date("y-m-d", strtotime($datetime));
}
return $posting_time;
}
?>
읽어주셔서 감사합니다.
'Web Code > PHP' 카테고리의 다른 글
구글맵 좌표 파싱 문제 해결 (0) | 2019.12.16 |
---|---|
PHP 현재 URL 출력 (0) | 2019.12.16 |
구글맵 좌표 파싱 문제 해결
2019. 12. 16. 13:09
$address = "$view[wr_add]";
$xml = simplexml_load_file("http://maps.google.com/maps/api/geocode/xml?address=".urlencode($address)."&language=ko&sensor=false");
$lat = $xml->result->geometry->location->lat;
$lng = $xml->result->geometry->location->lng;
// php.ini 설정중 allow_url_fopen = On 확인 / Off 이면 추출안됨
echo "lat = ". $lat ."<br>";
echo "lng = ". $lng ."<br>";
읽어주셔서 감사합니다.
'Web Code > PHP' 카테고리의 다른 글
PHP 시간 출력 함수 (0) | 2019.12.16 |
---|---|
PHP 현재 URL 출력 (0) | 2019.12.16 |