内容列表页的值,在哪里了获取到的?

技术问题 · gtcarry888 · 于 3年前 发布 · 1221 次阅读

问题: PC端列表页面中,人气单品下面的数据从后台管理系统添加,如下图,代码中循环展示获取$hot_products 中的值,我在PC端这里打印可以获取到$hot_products的值, 当我在H5端,同样操作,并且打印$hot_products的时候,是空数组,这也就是我的疑问,这个值从那里传过来的。

本文由 gtcarry888 创作,采用 知识共享署名 3.0 中国大陆许可协议 进行许可。 可自由转载、引用,但需署名作者且注明文章出处。

共收到 3 条回复
Fecmall#13年前 0 个赞

写清楚文件路径。。。

gtcarry888#23年前 0 个赞

文件路径 /addons/fecmall/fecyo/app/appfront/theme/fecyo/cms/home/index.php

Fecmall#33年前 0 个赞

1.appfront:

@fecyo\app\appfront\modules\Cms\block\home\Index.php

public function getLastData()
    {
        $this->initHead();
        
        $hot_product_skus = Yii::$app->store->get('fecyo_info', 'hot_product_skus'); 
        $chaoliu_s_skus_1 = Yii::$app->store->get('fecyo_info', 'chaoliu_s_skus_1'); 
        $chaoliu_s_skus_2 = Yii::$app->store->get('fecyo_info', 'chaoliu_s_skus_2'); 
        $chaoliu_x_skus_1 = Yii::$app->store->get('fecyo_info', 'chaoliu_x_skus_1'); 
        $chaoliu_x_skus_2 = Yii::$app->store->get('fecyo_info', 'chaoliu_x_skus_2'); 
        $new_product_skus = Yii::$app->store->get('fecyo_info', 'new_product_skus'); 
        
        $hot_product_sku_arr = $this->getConfigArr($hot_product_skus);
        $chaoliu_s_sku_1_arr = $this->getConfigArr($chaoliu_s_skus_1);
        $chaoliu_s_sku_2_arr = $this->getConfigArr($chaoliu_s_skus_2);
        $chaoliu_x_sku_1_arr = $this->getConfigArr($chaoliu_x_skus_1);
        $chaoliu_x_sku_2_arr = $this->getConfigArr($chaoliu_x_skus_2);
        $new_product_sku_arr = $this->getConfigArr($new_product_skus);
        
        return [
            'hot_products' => $this->getProductBySkus($hot_product_sku_arr),
            'chaoliu_s1_products' => $this->getProductBySkus($chaoliu_s_sku_1_arr),
            'chaoliu_s2_products' => $this->getProductBySkus($chaoliu_s_sku_2_arr),
            'chaoliu_x1_products' => $this->getProductBySkus($chaoliu_x_sku_1_arr),
            'chaoliu_x2_products' => $this->getProductBySkus($chaoliu_x_sku_2_arr),
            'new_products' => $this->getProductBySkus($new_product_sku_arr),
        ];
        
    }

hot_products是这里返回的,这个数组里面的参数,就是view里面的变量

2.html5部分,fecyo没有重写cms/home/index,您可以用这里的参数:https://github.com/fecshop/yii2_fecshop/blob/master/app/apphtml5/modules/Cms/block/home/Index.php#L20

或者自己重写

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