ITOBEN STYLE > EC-CUBE:特定商品のお問い合わせフォーム 2012年5月13日カテゴリー:未分類 EC-CUBE:特定商品のお問い合わせフォーム 商品詳細ページに、その商品へのお問い合わせリンクを設定し、クリックすると商品情報が入力されたお問い合わせページが開く。 ブロック配置されている「お問い合わせボタン」をクリックしたときは、通常のお問い合わせページへ移動。 商品詳細ページ お問い合わせページ 1 商品詳細ページに、お問い合わせページへのリンクを設定する。 ■/data/Smarty/templates/default/products/detail.tpl [php] ■data/class/pages/contact/LC_Page_Contact.php function action()メソッド内の最後に追加 [php] //この商品へのお問い合わせ $objQuery =SC_Query_Ex::getSingletonInstance(); $this->arrRet = array(); //パラメータ $contact_product = $_GET[‘contact_product’]; //商品情報を取得 if(isset($contact_product)){ $arrRet = $objQuery->select(“*”, “dtb_products”, “product_id = $contact_product”); } //データベースからデータの取得ができたか if(isset($arrRet)){ $this->arrRet = $arrRet[0]; } [/php] 3 お問い合わせフォームに追加 ■/data/Smarty/templates/default/contact/index.tpl (1)「 内容によっては回答をさしあげるのに・・・」の上に追加 [php] (2)お問い合わせ内容のテキストエリアに追加→「商品名:」について [php]
商品詳細ページに、その商品へのお問い合わせリンクを設定し、クリックすると商品情報が入力されたお問い合わせページが開く。
ブロック配置されている「お問い合わせボタン」をクリックしたときは、通常のお問い合わせページへ移動。
商品詳細ページ
お問い合わせページ
1 商品詳細ページに、お問い合わせページへのリンクを設定する。
■/data/Smarty/templates/default/products/detail.tpl
[php]
function action()メソッド内の最後に追加
[php]
//この商品へのお問い合わせ
$objQuery =SC_Query_Ex::getSingletonInstance();
$this->arrRet = array();
//パラメータ
$contact_product = $_GET[‘contact_product’];
//商品情報を取得
if(isset($contact_product)){
$arrRet = $objQuery->select(“*”, “dtb_products”, “product_id = $contact_product”);
}
//データベースからデータの取得ができたか
if(isset($arrRet)){
$this->arrRet = $arrRet[0];
}
[/php]
3 お問い合わせフォームに追加
■/data/Smarty/templates/default/contact/index.tpl
(1)「
内容によっては回答をさしあげるのに・・・」の上に追加
[php]
[php]