2011-04-08
2.11.0系 商品購入手続き画面のお届け日に定休日を反映させる
フォーラムに投げた内容をこちらにも転載。
そういえば2.11.0ではどうやるんだろう?と思って試しにやってみたら、
なんとなく出来た気が・・・
内容に問題があったらご報告お願いします!
/data/class/helper/SC_Helper_Purchase.php
/**
* お届け可能日のスタート値から, お届け日の配列を取得する.
*/
function getDateArray($start_day, $end_day) {
/*---------- ↓ 追加 ↓ --------*/
//カレンダーを呼び出す
require_once(CLASS_REALDIR . "pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Calendar.php");
$blockCalender = new LC_Page_FrontParts_Bloc_Calendar();
/*---------- ↑ 追加 ↑ --------*/
$masterData = new SC_DB_MasterData();
$arrWDAY = $masterData->getMasterData("mtb_wday");
//お届け可能日のスタート値がセットされていれば
if($start_day >= 1) {
$now_time = time();
$max_day = $start_day + $end_day;
// 集計
for ($i = $start_day; $i < $max_day; $i++) {
// 基本時間から日数を追加していく
$tmp_time = $now_time + ($i * 24 * 3600);
list($y, $m, $d, $w) = explode(" ", date("Y m d w", $tmp_time));
/*---------- ↓ 変更 ↓ --------*/
//休日かどうかチェックする
if(!$blockCalender->lfCheckHoliday_Payment($y, $m, $d)){
$val = sprintf("%04d/%02d/%02d(%s)", $y, $m, $d, $arrWDAY[$w]);
$arrDate[$val] = $val;
}
/*---------- ↑ 変更 ↑ --------*/
}
} else {
$arrDate = false;
}
return $arrDate;
}
/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Calendar
/*---------- ↓ 追加 ↓ --------*/
/**
* 休日チェック取得.
* (購入手続き内、配送日時判定)
*/
function lfCheckHoliday_Payment($year, $month, $day) {
// 休日取得取得
$this->arrHoliday = $this->lfGetHoliday();
// 定休日取得取得
$this->arrRegularHoliday = $this->lfGetRegularHoliday();
if (!empty($this->arrHoliday[$month])) {
if (in_array($day, $this->arrHoliday[$month])) {
return true;
}
}
if (!empty($this->arrRegularHoliday)) {
$day = date('w', mktime(0,0,0 ,$month, $day, $year));
if (in_array($day, $this->arrRegularHoliday)) {
return true;
}
}
return false;
}
/*---------- ↑ 追加 ↑ --------*/
リンク元
- 3 http://d.hatena.ne.jp/keyword/EC-CUBE
- 3 http://www.google.co.jp/search?hl=ja&client=firefox-a&hs=AcT&rls=org.mozilla:ja:official&q=$smarty.now+現在 未来&aq=f&aqi=&aql=&oq=
- 3 http://www.google.co.jp/search?source=ig&hl=ja&rlz=1G1GGLQ_JAJP314&q=eccube+2.11.0+デザインテンプレート&aq=f&aqi=&aql=&oq=
- 2 http://search.yahoo.co.jp/search?p=EC-CUBE2.11.0&search.x=1&fr=top_ga1_sa&tid=top_ga1_sa&ei=UTF-8&aq=&oq=
- 2 http://www.google.co.jp/search?q=ECCUBE ログアウト&ie=utf-8&oe=utf-8&aq=t&hl=ja&client=firefox-a&rlz=1R1MOZA_ja___JP399
- 2 http://www.google.co.jp/search?sourceid=chrome&ie=UTF-8&q=ECCUBE+2.11+テンプレート
- 2 http://www.google.co.jp/search?sourceid=navclient&hl=ja&ie=UTF-8&rlz=1T4GGHP_jaJP419JP419&q=heteml+mail+thunderbird3
- 2 http://xoops.ec-cube.net/modules/newbb/viewtopic.php?viewmode=flat&order=ASC&topic_id=7398&forum=10
- 1 http://b.rank-in.net
- 1 http://eccube-news.com/ec-cube/2010/11/18/287/
