LoginSignup
2
3

More than 5 years have passed since last update.

CS-CART アカウント回りのSmartyコード

Last updated at Posted at 2016-08-04

テンプレート作成時に便利なSmartyコード集(アカウント関連回り)を作りましたので共有します。(CS-CART Ver.4.3.6)


ログイン中かどうか調べる

{if $auth.user_id}...{/if}

アカウント情報に氏名がある場合は氏名、無い場合はメールアドレスを表示する。

{if $user_info.firstname || $user_info.lastname}
    <p>{$user_info.firstname} {$user_info.lastname}</p>
{else}
    <p>{$user_info.email}</p>
{/if}

プロフィール更新ページへのリンク

 <a href="{"profiles.update"|fn_url}" rel="nofollow" >{__("profile_details")}</a>

注文履歴ページへのリンク

<a href="{"orders.search"|fn_url}" rel="nofollow">{__("orders")}</a>

返品リクエストページへのリンク(要返品管理アドオン)

 <a href="{"rma.returns"|fn_url}" rel="nofollow">{__("return_requests")}</a>

所持ポイントを表示する(要ポイントアドオン)

<p>{$user_info.points|default:"0"}</p>

ポイント獲得履歴ページへのリンク(要ポイントアドオン)

<a href="{"reward_points.userlog"|fn_url}" rel="nofollow">{__("my_points")}</a>

ほしい物リストへのリンク(要ほしい物リストアドオン)

<a href="{"wishlist.view"|fn_url}" rel="nofollow">{__("wishlist")}</a>

ほしい物リストに入っている商品の数を表示(要ほしい物リストアドオン)

{if $wishlist_count > 0}{$wishlist_count}{/if}

サインアウトボタンを表示

<a href="{"auth.logout?redirect_url=`$return_current_url`"|fn_url}" rel="nofollow" class="ty-btn ty-btn__primary">{__("sign_out")}</a>

サインアウト|サインイン|サインアップボタン

<div class="ty-account-info__buttons buttons-container">

    {if $auth.user_id}

         //SIGN OUT BUTTON
        <a href="{"auth.logout?redirect_url=`$return_current_url`"|fn_url}" rel="nofollow" class="ty-btn ty-btn__primary">{__("sign_out")}</a>

    {else}

         //SIGN IN BUTTON
        <a href="{if $runtime.controller == "auth" && $runtime.mode == "login_form"}
                     {$config.current_url|fn_url}
                 {else}
                     {"auth.login_form?return_url=`$return_current_url`"|fn_url}
                 {/if}" 
                 {if $settings.Security.secure_storefront != "partial"}
                     data-ca-target-id="login_block{$block.snapping_id}"
                     class="cm-dialog-opener cm-dialog-auto-size ty-btn ty-btn__secondary"
                 {else}
                     class="ty-btn ty-btn__primary"
                 {/if}
                 rel="nofollow">{__("sign_in")}</a>

        // REGISTER BUTTON         
        <a href="{"profiles.add"|fn_url}" rel="nofollow" class="ty-btn ty-btn__primary">
        {__("register")}</a>

        //HIDDEN FLOATING LOGIN DIALOG BOX  
        {if $settings.Security.secure_storefront != "partial"}
           <div id="login_block{$block.snapping_id}" class="hidden" title="{__("sign_in")}">
               <div class="ty-login-popup">{include file="views/auth/login_form.tpl" style="popup" id="popup`$block.snapping_id`"}</div>
           </div>
        {/if}

    {/if}

</div>
2
3
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3