バージョン選択

フォーラム

メニュー

オンライン状況

62 人のユーザが現在オンラインです。 (51 人のユーザが フォーラム を参照しています。)
登録ユーザ: 0
ゲスト: 62
もっと...

サイト内検索

質問 > フロント機能 > カートに入れたときに商品名に含む文字によって切り替えて表示をしたい。

フロント機能

新規スレッドを追加する

スレッド表示 | 新しいものから 前のトピック | 次のトピック | 下へ
投稿者 スレッド
mizuvan
投稿日時: 2015/2/5 19:11
対応状況: −−−
長老
登録日: 2013/3/26
居住地:
投稿: 253
カートに入れたときに商品名に含む文字によって切り替えて表示をしたい。
data/Smarty/templates/original/cart/index.tpl

に下記のように書き加えたのですがエラーになってしまいます。
どうもテンプレートエラーのようなのですが、この書き方は間違っていますでしょうか?

<!--{foreach item=itemname  from=$item.productsClass.name}-->
<!--{if itemname|strpos:"女性用" !== false}-->
さらに50%OFF商品はいかがでしょうか?
<!--{else itemname|strpos:"男性用" !== false}-->
本日だけ限定の商品はいかがでしょうか?
<!--{/if}-->


----------------

IPLOGIC
投稿日時: 2015/2/5 20:09
対応状況: −−−
一人前
登録日: 2014/12/8
居住地: 東京都
投稿: 96
Re: カートに入れたときに商品名に含む文字によって切り替えて表示をしたい。
mizuvan様

elseの部分をelseifに変えて実行してみてください。


----------------
アイピーロジック株式会社
EC-CUBE専用メール配信サービス「PostCarrier for EC-CUBE」
[url=http://www.rakusite.net/]EC-CUBE専用サイト保守監視サービス「らくらくサイト保守

mizuvan
投稿日時: 2015/2/6 12:45
対応状況: −−−
長老
登録日: 2013/3/26
居住地:
投稿: 253
Re: カートに入れたときに商品名に含む文字によって切り替えて表示をしたい。
IPLOGIC様、ありがとうございます!

ただ、elseif としても下記のエラーとなってしまいます。

line 195 には、</div>となっています。でもdivの数もあっていました。

Smarty error となっていることからもテンプレートのエラーなんですよね?

引用:
2015/02/06 12:20:33
[***/cart/index.php] Fatal error(E_USER_ERROR): Smarty error: [in ***/data/Smarty/templates/original/cart/index.tpl line 195]: syntax error: unexpected {else} (Smarty_Compiler.class.php, line 478) on [***/data/module/Smarty/libs/Smarty.class.php(1094)] from IPアドレス
customer_id = 1
***/cart/index.php(29): LC_Page_Cart_Ex->process
***/data/class_extends/page_extends/cart/LC_Page_Cart_Ex.php(54): LC_Page_Cart->process
***/data/class/pages/cart/LC_Page_Cart.php(66): LC_Page->sendResponse
***/data/class/pages/LC_Page.php(152): SC_Display->prepare
***/data/class/SC_Display.php(80): SC_View->getResponse
***/data/class/SC_View.php(101): Smarty->fetch
***/data/module/Smarty/libs/Smarty.class.php(1264): include
***/data/Smarty/templates_c/original/%%F1^F15^F158E3F4%%site_frame.tpl.php(177): Smarty->_smarty_include
***/data/module/Smarty/libs/Smarty.class.php(1870): include
***/data/Smarty/templates_c/original/%%58^587^5876E692%%site_main.tpl.php(39): Smarty->_smarty_include
***/data/module/Smarty/libs/Smarty.class.php(1868): Smarty->_compile_resource
***/data/module/Smarty/libs/Smarty.class.php(1423): Smarty->_compile_source
***/data/module/Smarty/libs/Smarty.class.php(1490): Smarty_Compiler->_compile_file
***/data/module/Smarty/libs/Smarty_Compiler.class.php(312): Smarty_Compiler->_compile_tag
***/data/module/Smarty/libs/Smarty_Compiler.class.php(478): Smarty_Compiler->_syntax_error
***/data/module/Smarty/libs/Smarty_Compiler.class.php(2256): Smarty->_trigger_fatal_error
***/data/module/Smarty/libs/Smarty.class.php(1816): Smarty->trigger_error
***/data/module/Smarty/libs/Smarty.class.php(1094): trigger_error


----------------

mizuvan
投稿日時: 2015/2/7 12:24
対応状況: −−−
長老
登録日: 2013/3/26
居住地:
投稿: 253
Re: カートに入れたときに商品名に含む文字によって切り替えて表示をしたい。
その後、

elseでエラーが出ているように見えたので

<!--{foreach item=itemname  from=$item.productsClass.name}-->
<!--{if itemname|strpos:"女性用" !== false}-->
さらに50%OFF商品はいかがでしょうか?
<!--{/if}-->


エラーは syntax error: unexpected {else}  

だったり、fromとitemを前後入れ替えたりしてみました。

<!--{foreach  from=$item.productsClass.name item=itemname}-->
<!--{if itemname|strpos:"女性用" !== false}-->
さらに50%OFF商品はいかがでしょうか?
<!--{else itemname|strpos:"男性用" !== false}-->
本日だけ限定の商品はいかがでしょうか?
<!--{/if}-->


さらに下記のようにしましたがエラー
<!--{foreach item=itemname  from=$item.productsClass.name}-->
<!--{$itemname}-->
<!--{/if}-->


エラーが syntax error: unrecognized tag 'itemname'

となりました。

ちゃんと商品名が入っているかもチェック済みです。
<!--{$item.productsClass.name|@debug_print_var:0:100}-->


何がダメなのでしょうか?何か初歩的な問題でしょうか・・


----------------

red
投稿日時: 2015/2/7 12:29
対応状況: −−−
登録日: 2010/2/15
居住地: 東京都
投稿: 1570
Re: カートに入れたときに商品名に含む文字によって切り替えて表示をしたい。
全体的にダメです
エラーメッセージを見てもう少し自分で考えましょう


----------------
EC-CUBEのカスタマイズ、トラブル解決承ります
お気軽にお問い合わせ下さい
https://www.ec-cube.net/integrate/partner/partner.php?partner_id=690

mizuvan
投稿日時: 2015/2/9 17:53
対応状況: 保留
長老
登録日: 2013/3/26
居住地:
投稿: 253
Re: カートに入れたときに商品名に含む文字によって切り替えて表示をしたい。
red様、ありがとうございます!

全体的にダメだったのですね・・・
もう少しのところで出来るものだと思っていました

もう少し勉強してきます・・・・


----------------

スレッド表示 | 新しいものから 前のトピック | 次のトピック | トップ


 



ログイン


EC-CUBE公式 Amazon Payプラグイン

統計情報

総メンバー数は88,700名です
総投稿数は109,944件です

投稿数ランキング

1
seasoft
7367
2
468
3217
3
AMUAMU
2712
4
nanasess
2313
5
umebius
2085
6
yuh
1819
7
h_tanaka
1638
8
red
1570
9
mcontact
1283
10
tsuji
958
11
fukap
907
12
shutta
835
13
tao_s
799
14 ramrun 789
15 karin 689
16 sumida 641
17
homan
633
18 DELIGHT 572
19
patapata
502
20
flealog
485


ネットショップの壺

EC-CUBEインテグレートパートナー

Copyright© EC-CUBE CO.,LTD. All Rights Reserved.