Labo

[EC-CUBE 2.12.3] 商品詳細ページから商品問い合わせをできるようにする その2

2013年04月20日 / 投稿者名:fukap


先日、同じタイトルの記事を書きましたが、「商品コードを表示できないか?」というご質問をいただきましたので、やってみました。
ちなみに前回の記事はこちら。
[EC-CUBE 2.12.2] 商品詳細ページから商品問い合わせをできるようにする

 

1.data/Smarty/templates/default/products/detail.tpl の適当な箇所に下の一行を追加。

<a href="/contact/index.php?product_code=<!--{$arrProduct.product_code_min|h}-->">この商品に関して問い合わせをする</a>

2.data/Smarty/templates/default/contact/index.tpl のお問い合わせテーブル内の適当な箇所に下の一行を追加。

<tr>
    <th>お問い合わせの商品コード</th>
    <td>
        <span class="attention"><!--{$arrErr.product_id}--></span>
        <input type="text" class="box120" name="product_code" value="<!--{$arrForm.product_code.value|h|default:$smarty.get.product_code|h}-->" maxlength="<!--{$smarty.const.INT_LEN}-->" style="<!--{$arrErr.product_code|sfGetErrorColor}-->;" />
    </td>
</tr>

3.data/Smarty/templates/default/contact/confirm.tpl のお問い合わせ内容確認テーブル内の適当な箇所に下の一行を追加。

<tr>
    <th>お問い合わせの商品コード</th>
    <td><!--{$arrForm.product_code.value|h}--></td>
</tr>

4.data/Smarty/templates/default/mail_templates/contact_mail.tpl の任意の箇所に下の一行を追加。

■お問い合わせの商品コード:<!--{$arrForm.product_code.value}-->

5.data/class/pages/contact/LC_Page_Contact.php の lfInitParamメソッドに以下の一行を追加。

$objFormParam->addParam('商品コード', 'product_code', STEXT_LEN, 'KVa', array('SPTAB_CHECK','MAX_LENGTH_CHECK'));

product_code_min を採用している時点で、規格ごとの商品コードを無視した粗雑な仕様ではあるのですが、
規格を用いていない場合なら使えるのではないかと思ったりします。

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

* Copy This Password *

* Type Or Paste Password Here *

*

コメント欄にコードを挿入したい場合は、[php][/php] を使ってください。