请问怎样在产品页面增加自定义内容?

文档问题 · Aswe · 于 5年前 发布 · 2455 次阅读

想在产品页面添加自定义内容,请问是哪几个文件控制的?

共收到 11 条回复
Fecmall#15年前 0 个赞

看不懂,什么是自定义内容

Aswe#25年前 0 个赞

在产品里添加了一个属性“referee”,想让referee的值出现在产品页面。

Aswe#45年前 0 个赞

@KaiJuan [[#3楼](#comment3)](#comment3) 谢谢!我是想修改这上面的内容:产品页面

没弄懂怎么去调用数据库

Fecmall#55年前 0 个赞

@Aswe [#4楼](#comment4)

http://www.fecshop.com/topic/624

先去学习下如何发帖描述清楚问题吧,看不懂

Aswe#65年前 0 个赞

想在产品页下的"add to cart"下方增加个按钮"url of referee",点击按钮转向推荐人的微博。

这个按钮需要检测是否已登录。

”url of referee“的值已事先保存在产品信息里。

Aswe#85年前 0 个赞

@Fecshop [#7楼](#comment7) 对fecshop还不熟,请多指教:

mongodb和theme部分已重写,检查没问题。直接在@fecshop下的fecshop\app\appfront\modules\Catalog\block\product\Index.php增加

'url_referee'                => $this->_product['url_referee'],

没有问题,能取到数据并正常显示到页面。

现在把Index.php文件复制到appfront\local\local_modules\Catalog\block\product下编辑:

namespace appfront\local\local_modules\Catalog\block\product;
...
...
'url_referee'                => $this->_product['url_referee'],

,url_referee没有返回值,也没报错。

YiiRewriteMap:

return [
    /**
     * \fecshop\models\mongodb\Category 为原来的类
     * \appfront\local\local_models\mongodb\Category 为重写后的类
     * 重写后的类可以集成原来的类。
     */
    '\fecshop\models\mongodb\Category'  => '\appfront\local\local_models\mongodb\Category',
	'\fecshop\models\mongodb\Product'   => '\appfront\local\local_models\mongodb\Product',
	'\fecshop\app\appfront\modules\Catalog\block\product'   => '\appfront\local\local_modules\Catalog\block\product',
    // '\fecshop\app\appfront\modules\Cms\block\home\Index'  => '\appfront\local\local_modules\Cms\block\home\Index',
    
    // '\fecshop\app\appfront\modules\Catalog\block\product\CustomOption'  => '\appfront\local\local_modules\Catalog\block\product\CustomOption',
];

我是不是漏步骤了?

Aswe#105年前 0 个赞

@Fecshop #9楼 这个字段要用产品属性组的方法?没明白

Aswe#115年前 1 个赞

解决了,YiiRewriteMap写错。改正后正常:

'\fecshop\app\appfront\modules\Catalog\block\product\Index'   => '\appfront\local\local_modules\Catalog\block\product\Index',

重写功能很方便

添加回复 (需要登录)
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册
Your Site Analytics