我是采用容器方面安装的.但是配置自己的域名的时候,发现在产品目录列表中的左侧:单价/属性/一页60 等连接里面都是无效的链接.直接对应指向一级目录(facshop.com),而不是(appfront.facshop.com),求解
1.配置文件: @appfront/config/fecshop_local_services/Store.php
里面的域名的配置,请使用带有www的完整域名
www
2.nginx配置:
访问xxx.com 跳转到 www.xxx.com,这个网上自行搜索解决
xxx.com
www.xxx.com
3.把你的当前的url贴出来,是否存在www? 如果不存在,应该是你配置有问题
4.官方demo是没有问题的:
http://fecshop.appfront.fancyecommerce.com/catalogsearch/index?q=dress
http://fecshop.appfront.fancyecommerce.com/men
5.一个域名至于这样遮遮掩掩的吗?弄的看起来格外难读,贴上你的地址,直接就能看出来问题所在。
自己解决吧
http://appfront.dishylady.com/wedding-dresses-2016 请帮我看一下. 是生成的路径的地方有点问题.
自行追踪查看问题所在,除价格外的其他的属性过滤代码:
1.显示部分: https://github.com/fecshop/yii2_fecshop/blob/master/app/appfront/theme/base/front/catalog/category/index/filter/attr.php
<?php endif; $urlInfo = Yii::$service->url->category->getFilterChooseAttrUrl($attrUrlStr,$val,'p'); $url = $urlInfo['url']; $selected = $urlInfo['selected'] ? 'class="checked"' : ''; ?> <a <?= $selected;?> href="<?= $url;?>"><?= Yii::$service->page->translate->__($val); ?>(<?= $count; ?>)</a><br/>
可以看到a锚文本的href的url是由
a
$urlInfo = Yii::$service->url->category->getFilterChooseAttrUrl($attrUrlStr,$val,'p');
得到的
对于 Yii::$service->url->category->getFilterChooseAttrUrl 是 https://github.com/fecshop/yii2_fecshop/blob/master/services/url/Category.php 中的函数,大约在73行 ,在这个函数中,有一个函数得到当前的url $currentUrl = Yii::$service->url->getCurrentUrl();
Yii::$service->url->category->getFilterChooseAttrUrl
$currentUrl = Yii::$service->url->getCurrentUrl();
也就是:https://github.com/fecshop/yii2_fecshop/blob/master/services/Url.php 中的getCurrentUrl,你自行查看下输出。
getCurrentUrl
你自行打断点查看下问题所在
你看一下:https://github.com/fecshop/yii2_fecshop/blob/master/services/Url.php
/** * get current url. */ public function getCurrentUrl() { if (!$this->_currentUrl) { $pageURL = '//'; $pageURL .= $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; $this->_currentUrl = $pageURL; } return $this->_currentUrl; }
你输出一下这个函数的返回是什么。
你按照上面给予的步骤代码追踪一下问题,找一下你的问题是什么代码造成的域名不是http://appfront.dishylady.com,找到后,把问题贴一下。
http://appfront.dishylady.com
我没有看到services/Url.php
fecshop是以库包的方式发布的,对于@fecshop,也就是这个https://github.com/fecshop/yii2_fecshop
@fecshop
对于的文件路径是 vendor/fancyecommerce/fecshop,这是Yii2的知识。
vendor/fancyecommerce/fecshop
http://apphtml5.dishylady.com/maternity-wedding-dresses?price=20-30 在手机是可以直接生成单价等属性
@rocky #8楼
上面已经和你把文件代码说的很清楚,自己去bug这个问题的根源是什么导致的。
我发现http://appfront.dishylady.com 路径输出就是dishylady.com 而http://apphhtml5.dishylady.com 接受到的就是apphhtml5.dishylady.com 这个就是问题所在.
兄弟,好了,你自己玩吧,我这是对牛弹琴,上面给你贴的一堆代码和文件,说的很清楚,让你按照那个文件路径去追踪问题,你居然不看,真是浪费时间
你说的问题所在,那么对应到的代码呢?是哪个文件的哪行代码导致的这个问题?作为一个程序员居然说出来这样小白的话语。
最后,我想说,fecshop不适合你,建议你选择其他电商系统。
我看到apphhtml5.dishylady.com 的 $_SERVER['SERVER_NAME'] = 'dishylady.com', 而 apphhtml5.dishylady.com 的$_SERVER['SERVER_NAME'] = 'apphhtml5.dishylady.com', 这个方面在哪里设置的啊?
@rocky #12楼 描述能说清楚不?
什么文件,那个地方的代码,输出的什么内容?鬼知道你说的是什么,上面我给你的回复也这样说,你能看懂?
你把:https://github.com/fecshop/yii2_fecshop/blob/master/services/Url.php
将SERVER_NAME改成HTTP_HOST, 试试
SERVER_NAME
HTTP_HOST
找到问题所在,在nginx上面配置的时候,我们配置的第一位就是$_SERVER['SERVER_NAME'],以前放的第一位是www.dishylady.com ,第二位才是http://appfront.dishylady.com/ 所以就识别不出来.
@rocky #15楼
这样解决:
把:https://github.com/fecshop/yii2_fecshop/blob/master/services/Url.php 的方法getCurrentUrl()改成下面的:
getCurrentUrl()
/** * get current url. */ public function getCurrentUrl() { if (!$this->_currentUrl) { $pageURL = $this->getBaseUrl() . $_SERVER['REQUEST_URI']; $this->_currentUrl = $pageURL; } return $this->_currentUrl; }
$_SERVER['SERVER_NAME'] 和 apache nginx有关系,这样不健壮,改成上面的就可以了
$_SERVER['SERVER_NAME']
fecshop会修复这个bug
修复该bug的代码已提交: https://github.com/fecshop/yii2_fecshop/commit/66c623a8bcb0a51eea945d5fee073543f62ac433
你多去看几遍发帖说明:http://www.fecshop.com/topic/624
发帖的时候注意换位思考,这里不是QQ聊天。