搜索
开启辅助访问 切换到宽版

QQ登录

只需一步,快速开始

扫一扫,访问微社区

注册 找回密码
查看: 5040|回复: 0
打印 上一主题 下一主题

opencart如何只能让登录会员看到商品价格

[复制链接]
跳转到指定楼层
楼主
发表于 2011-3-20 10:49:05 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
Top



如图:游客



For Visitors visitor.jpg (51.81 KiB) Viewed 57 times

会员登录显示
If the client has logged in, show as normal
For registered Logged in.jpg (51.1 KiB) Viewed 57 times

I've made some revise, it will be much better for multi-language system. Since I'm not so good in PHP, if anything wrong with the code, please let me know, but this works at our site. Thanks for all the helps and advise.

in catalog\controller\product\product.php add below
Code: Select all     $this->data['logged'] = $this->customer->isLogged();
       $this->data['text_login'] = $this->language->get('text_login');
      $this->data['login'] = HTTPS_SERVER . 'index.php?route=account/login';
    $this->data['text_create'] = $this->language->get('text_create');
    $this->data['create'] = HTTPS_SERVER . 'index.php?route=account/create';


in catalog\language\english\product\product.php add below
Code: Select all     $_['text_create']   = 'Register';
$_['text_login']    = 'Log In';


in catalog\view\theme\default\template\product\product.tpl revise it as below
Code: Select all               <tr>
                <td><b><?php echo $text_price; ?></b></td>
                <td>
    <?php if (!$logged) { ?>
      [ <a href="<?php echo $login; ?>"><?php echo $text_login; ?></a> ] [ <a href="<?php echo $create; ?>"><?php echo $text_create; ?></a> ]
    <?php } else { ?>
                  <?php if (!$special) { ?>
                  <span style="color: #900;"><?php echo $price; ?></span>
                  <?php } else { ?>
                  <span style="color: #900; text-decoration: line-through;"><?php echo $price; ?></span> <span style="color: #F00;"><?php echo $special; ?></span>
    <?php } ?>
                </td>
              <?php } ?>
              </tr>

.

find

Code: Select all <div class="content">
                <?php echo $text_qty; ?>
                <input type="text" name="quantity" size="3" value="<?php echo $minimum; ?>" />
                <a id="add_to_cart" class="button"><span><?php echo $button_add_to_cart; ?></span></a>
                <?php if ($minimum > 1) { ?><br/><small><?php echo $text_minimum; ?></small><?php } ?>
              </div>

replace with

Code: Select all <div class="content">
<?php if ($logged) { ?>
                <?php echo $text_qty; ?>
                <input type="text" name="quantity" size="3" value="<?php echo $minimum; ?>" />
                <a id="add_to_cart" class="button"><span><?php echo $button_add_to_cart; ?></span></a>
                <?php if ($minimum > 1) { ?><br/><small><?php echo $text_minimum; ?></small><?







分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
收藏收藏 分享分享 支持支持 反对反对
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /1 下一条

QQ|手机版|OpenCart - 中文官方网站 ( 蜀ICP备09033774号|人工智能

GMT+8, 2024-5-6 00:14 , Processed in 0.058303 second(s), 20 queries , Gzip On.

快速回复 返回顶部 返回列表