欢迎光临
我们一直在努力

zencart中Paypal快捷支付如何更换语言及Logo图标或名称

admin阅读(2530)

zencart网站程序中,如何把自带的paypal快捷支付模块的的语言及支付页面Logo图片设置为自己想要的语言及图片呢?

可以通在zencart中的paypal快捷支付模块“includesmodulespaymentpaypalwpp.php”中增加参数的方式来自定义Logo图片及更换语言,设置支付页面左上角用文字替代Logo。

如下图所示:

 

ZenCart 产品页下拉尺码改为文本单击选择方式

admin阅读(2761)

ZenCart 产品页下拉尺码改为文本单击选择方式,相信很多做服装,鞋类B2c网站比较喜欢这种方式。
下面就直奔主题吧

1:打开attributes.php(在includes/modules/模板名/下面,如果没有就去includes/modules下复制一个过来),找到大概595行把zen_draw_pull_down_menu修改为

zen_draw_pull_down_menu_options

2:打开html_output.php(在includes/functions下面),找到大概533行 ,在下面添加如下一个函数

function zen_draw_pull_down_menu_options($name, $values, $default = '',
  $parameters = '', $required = false) {
    $field = '<ul name="' . zen_output_string($name) . '"';
    if (zen_not_null($parameters)) $field .= ' ' . $parameters;$field .= '>' . "\n";
    if (empty($default) && isset($GLOBALS[$name]) && is_string($GLOBALS[$name]) )
 $default = stripslashes($GLOBALS[$name]);
    for ($i=0, $n=sizeof($values); $i<$n; $i++) {
 $field .= ' <li id="attribs' . zen_output_string($values[$i]['id']) . '"
 onclick="AttribUpdate(' . zen_output_string($values[$i]['id']) . ')"';
 if ($default == $values[$i]['id']) {
        $field .= ' selected="selected"';
      }
   $field .= '><span id="Attrtext' . zen_output_string($values[$i]['id']) . '"' =>
   '&quot;', '\'' => '&#039;', '<' => '&lt;', '>' => '&gt;')) . '">
   ' . zen_output_string($values[$i]['text'],
   array('"' => '&quot;', '\'' => '&#039;', '<' => '&lt;', '>' => '&gt;')) . '</span>'. "\n";
    }
    $field .= '</ul>' . "\n";
    if ($required == true) $field .= TEXT_FIELD_REQUIRED;
    return $field;
  }

3:找到tpl_product_info_display.php(在includes/templates/模板名/templates下面),打开以后找到129行,添加如下代码

<div id="selectsize"></div> <input type="hidden"  value="0" id="attrivalues" name="id[1]"/>

4:打开stylesheet.css(在includes/templates/模板名/css下面),添加如下样式,这个可以根据不同网站进行修改

.back ul li {
float: left;
line-height: 20px;
margin: 0 4px 4px 1px;
min-width: 22px;
padding: 1px;
position: relative;
vertical-align: middle;
list-style:none;}
.back ul li span {
display:block;padding:3px;}
.back ul li.selectAttr {
background-color: #FFFFFF;
border: 1px solid #CCCCCC;
cursor: pointer;}
.back ul li.selectAttr:hover {
background-color: #FF6600;
border: 1px solid #FFA500;}
.back ul li.select {
background-color: #FFA500;
}

5:添加一个jscript_size.js文件,放到includes/templates/模板名/jscript文件夹下,代码如下

function AttribUpdate(id)
{document.getElementById('attrivalues').value=id;
document.getElementById('selectsize').innerHTML=
"<div class='text'>Your Choice Size: "+document.getElementById('Attrtext'+id).className+"</div>";
for(i=1; i <=(document.getElementById('attrib-1').getElementsByTagName('li').length); i++)
{if(i == id)document.getElementById('attribs'+i).className = "select";
elsedocument.getElementById('attribs'+i).className = "selectAttr";}}

完成了,看看下面的效果图吧

2013092694352984

排版布局div+css样式可以根据自己网站的情况进行修改的,试试吧,看是不是成功啦。

 

zencart网站无法加载样式表及图片 IndexIgnore无效的解决方法

admin阅读(2501)

本地通过phpnow架设apache+php+mysql环境来运行zencart网站。

遇到一个错误“打开网站首页,发现无法加载css样式文件及js脚本文件,也无法加载到图片”。。。。

在浏览器中直接打开样式表文件或者图片,都显示 500内部服务器错误!

于是查看apache的错误日志文件,如下错误:

/includes/.htaccess: Invalid command 'IndexIgnore', perhaps misspelled or defined by a module not included in the server configuration

 

于是找到includes文件及images文件夹中的.htaccess文件删除

IndexIgnore */*

 

刷新网页,正常!

原因分析:

由于phpnow一键安装包配置的apache+php+now环境中没有加载

LoadModule autoindex_module modules/mod_autoindex.so 模块导致 IndexIgnore 命令无法使用!

可以通过以下操作加载mod_autoindex.so模块

1、打开apache配置文件 httpd.conf (PHPnowApache-22confhttpd.conf)  找到

LoadModule autoindex_module modules/mod_autoindex.so

2、将该行的前面的#去掉。

重启apache,ok!

Zencart如何获取产品描述函数

admin阅读(2448)

Zencart如何获取产品描述函数,相信这个函数在做Zencart模板的时候很多地方用得到.那么强创网络工作室就写一个函数来获取产品描述的.

第一.在路径includes\functions\extra_functions下创建一个文件名为functions_qcf.php
在文件中添加以下代码

<?php
function zen_products_id_products_description($proid) {
    global $db;
$products = $db->Execute("select p.products_id, pd.products_name, pd.products_description
                              from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
                              where p.products_id = pd.products_id
                              and pd.language_id = '" . (int)$_SESSION['languages_id'] . "' and pd.products_id='".$proid."'");
$productdes=$products->fields['products_description'];
return $productdes;
}

zencart网站无法加载样式表及图片 IndexIgnore无效的解决方法

admin阅读(2561)

本地通过phpnow架设apache+php+mysql环境来运行zencart网站。

遇到一个错误“打开网站首页,发现无法加载css样式文件及js脚本文件,也无法加载到图片”。。。。

在浏览器中直接打开样式表文件或者图片,都显示 500内部服务器错误!

于是查看apache的错误日志文件,如下错误:

/includes/.htaccess: Invalid command 'IndexIgnore', perhaps misspelled or defined by a module not included in the server configuration

 

于是找到includes文件及images文件夹中的.htaccess文件删除

IndexIgnore */*

 

刷新网页,正常!

原因分析:

由于phpnow一键安装包配置的apache+php+now环境中没有加载

LoadModule autoindex_module modules/mod_autoindex.so 模块导致 IndexIgnore 命令无法使用!

可以通过以下操作加载mod_autoindex.so模块

1、打开apache配置文件 httpd.conf (PHPnowApache-22confhttpd.conf)  找到

LoadModule autoindex_module modules/mod_autoindex.so

2、将该行的前面的#去掉。

重启apache,ok!

nginx环境下zencart伪静态rewrite规则

admin阅读(3489)

#————————zen-cart start——————

# From Ultimate SEO URLs
rewrite "^(.*)-p-(.*).html" /index.php?main_page=product_info&products_id=$2&% last;
rewrite "^(.*)-c-(.*).html" /index.php?main_page=index&cPath=$2&% last;
rewrite "^(.*)-m-([0-9]+).html" /index.php?main_page=index&manufacturers_id=$2&% last;
rewrite "^(.*)-pi-([0-9]+).html" /index.php?main_page=popup_image&pID=$2&% last;
rewrite "^(.*)-pr-([0-9]+).html" /index.php?main_page=product_reviews&products_id=$2&% last;
rewrite "^(.*)-pri-([0-9]+).html" /index.php?main_page=product_reviews_info&products_id=$2&% last;

# For Open Operations Info Manager
rewrite "^(.*)-i-([0-9]+).html" /index.php?main_page=info_manager&pages_id=$2&% last;

# For dreamscape’s News & Articles Manager
rewrite "^news/?" /index.php?main_page=news&% last;
rewrite "^news/rss.xml" /index.php?main_page=news_rss&% last;
rewrite "^news/archive/?" /index.php?main_page=news_archive&% last;
rewrite "^news/([0-9]{4})-([0-9]{2})-([0-9]{2}).html" /index.php?main_page=news&date=$1-$2-$3&% last;
rewrite "^news/archive/([0-9]{4})-([0-9]{2}).html" /index.php?main_page=news_archive&date=$1-$2&% last;
rewrite "^news/(.*)-a-([0-9]+)-comments.html" /index.php?main_page=news_comments&article_id=$2&% last;
rewrite "^news/(.*)-a-([0-9]+).html" /index.php?main_page=news_article&article_id=$2&% last;

# All other pages
# Don’t rewrite real files or directories
#RewriteCond %{REQUEST_FILENAME} !-f [NC]
#RewriteCond %{REQUEST_FILENAME} !-d
rewrite "^(.*).html" /index.php?main_page=$1&% last;
#—————————-zen-cart end—————–

利用htaccess将全站无效url转到404页面

admin阅读(2518)

如果你的网站原有的很多链接被删除之后,或者是因为网站原因造成网站出现很多无效链接,多出来很多404页面,我们考虑把无效的URL比如:用户拼错的 URL、不存在的URL重定向到别的网页,例如网站的首页、404页面等。这里我们建议大家不要将404错误直接指向网站首页,最好创建一个 404页面。

在httpd.conf或.htaccess文件中使用ErrorDocument来捕获404 (找不到文件)错误,写法如下:

2、在根目录的.htaccess文件中加入以下代码:
# 404 page
ErrorDocument 404 /404.html

404.html 前面不要带主域名,否者返回的状态码是302或200状态码。

3、把404.html放置在网站根目录

jQuery获取input值(单选,多选,文本框,文本区域)的方法

admin阅读(2752)

1 if($(“input[name=item][value=’val’]”).attr(‘checked’)==true) //判断是否已经打勾
name即控件name属性,value即控件value属性
可以不指定属性值,因一组checkbox的value值都会保存其在数据库中对应的id,最好写成如下方式
if($(“input[name=row_checkbox]”).attr(‘checked’)==true)
{
alert(“j”);
}
else
{
alert(“请选择数据!”);
}
另,还可以写成if($(“[name=row_checkbox]”).attr(‘checked’)==true)

jquery radio取值,checkbox取值,select取值,radio选中,checkbox选中,select选中,及其相关

文章分类:Web前端
jQuery 1.3.2版本下的
jquery radio取值,checkbox取值,select取值,radio选中,checkbox选中,select选中,及其相关
设置
获取一组radio被选中项的值:var item = $(‘input[name=items][checked]’).val();
获取select被选中项的文本
var item = $(“select[@name=items] option[@selected]”).text();
获取select被选中项的文本 :var item = $(“select[name=items] option[selected]”).text(); 或$(“select[name=items]”).find(“option:selected”).text();
select下拉框的第二个元素为当前选中值:$(‘#select_id’)[0].selectedIndex = 1;
select下拉框value = ‘val’的元素为当前选中项:$(“select[name=items] option[value=’val’]”).attr(“selected”,”selected”);
radio单选组的第二个元素为当前选中项 :$(‘input[@name=items]’).get(1).checked = true; 或$(‘input[name=items]’).attr(“checked”, ‘1′);
radio的value = ‘val’的元素为当前选中项:$(‘input[name=items] [value=’val’]’).attr(“checked”,”checked”);

获取值:
文本框,文本区域:$(“#txt”).attr(“value”);
多选框checkbox:$(“input[name=’checkbox’:checked]”).each(function(){
var val = $(this).val();
});
单选组radio: $(“input[type=radio][checked]”).val();
下拉框select的value值: $(‘select’).val();
下拉框select选中的text 值:$(“select”).find(“option:selected”).text();
控制表单元素:
文本框,文本区域:$(“#txt”).attr(“value”,”); //清空内容
$(“#txt”).attr(“value”,’11′); //填充内容
多选框checkbox:
checkbox的第二个元素被打勾:$(“input[name=items]”).get(1).checked = true; //打勾
$(“input[name=items]”).get(1).checked = false; //不打勾
checkbox的value=’val’的元素前打勾:$(“input[name=item] [value=’val’]”).attr(“checked”,true); 或$(“input[name=item][value=’val’]”).attr(“checked”,”checked”);
if($(“input[name=item][value=’val’]”).attr(‘checked’)==true) //判断是否已经打勾
单选组radio: $(“input[type=radio]”).attr(“checked”,’2′);//设置value=2的项目为当前选中项
下拉框select: $(“#sel”).attr(“value”,’-sel3′);//设置value=-sel3的项目为当前选中项
$(“

“).appendTo(“#sel”)//添加下拉框的option
$(“#sel”).empty();//清空下拉框
jQuery获取Radio选择的Value值
代码
$(“input[name=’radio_name’][checked]”).val(); //选择被选中Radio的Value值
$(“#text_id”).focus(function(){//code…}); //事件 当对象text_id获取焦点时触发
$(“#text_id”).blur(function(){//code…}); //事件 当对象text_id失去焦点时触发
$(“#text_id”).select(); //使文本框的Vlaue值成选中状态
$(“input[name=’radio_name’][value=’要选中Radio的Value值’”).
attr(“checked”,true); //根据Value值设置Radio为选中状态
jQuery获取CheckBox选择的Value值
$(“input[name=’checkbox_name’][checked]”); //选择被选中CheckBox元素的集合 如果你想得到
Value值你需要遍历这个集合
$($(“input[name=’checkbox_name’][checked]”)).
each(function(){arrChk+=this.value + ‘,’;});//遍历被选中CheckBox元素的集合 得到Value值
$(“#checkbox_id”).attr(“checked”); //获取一个CheckBox的状态(有没有被选中,返回true/false)
$(“#checkbox_id”).attr(“checked”,true); //设置一个CheckBox的状态为选中(checked=true)
$(“#checkbox_id”).attr(“checked”,false); //设置一个CheckBox的状态为不选中(checked=false)
$(“input[name=’checkbox_name’]”).attr
(“checked”,$(“#checkbox_id”).attr(“checked”));//根据3,4,5条,你可以分析分析这句代码的意思
$(“#text_id”).val().split(“,”); //将Text的Value值以’,’分隔 返回

单击返回顶部的简单js代码

admin阅读(2557)

js代码:

<script type="text/javascript">  
function gotoTop(min_height){  
    var gotoTop_html = '<div id="gotoTop"></div>';  
    $("#footer").append(gotoTop_html);  
    $("#gotoTop").click(  
        function(){$('html,body').animate({scrollTop:0},700);  
    }).hover(  
        function(){$(this).addClass("hover");},  
        function(){$(this).removeClass("hover");  
    });  
    min_height ? min_height = min_height : min_height = 600;  
    $(window).scroll(function(){   
        var s = $(window).scrollTop();  
        if( s > min_height){  
            $("#gotoTop").fadeIn(100);  
        }else{  
            $("#gotoTop").fadeOut(200);  
        };  
    });  
};  
gotoTop();  
</script>

注意:只要将这段代码放在网站的最后,将代码中的#footer替换成你网站的最后一个div id即可。

css代码:

#gotoTop{display:none;position:fixed;top:75%;left:50%;cursor:pointer;margin-top:-50px;margin-left:535px;width:55px; height:55px;background:url(../images/backtop.png) no-repeat left top;}  
  
#gotoTop.hover{background:url(../images/backtop.png) no-repeat rightright top;} 

图片自己准备一个.

zencart网页乱码问题总结

admin阅读(2596)

encart新手在使用zencart网站做国内中文网站或者一些小语种网站的时候,经常会遇到zencart网页乱码问题。其实网页乱码外呼就是编码出现问题了,整个程序就三个地方会有编码:数据库操作时的编码设置、网页html编码设置、php等代码文件的编码。

我们只要从这4个方面着手去找肯定能解决问题。

下面我来总结下zencart出现编码问题,即乱码问题的时候该怎么解决?

1、数据库操作编码设置

配置文件中添加

define('DB_CHARSET','utf8');

 

如果已经定义了该常量,找到对应常量值改为utf8即可。

2、网页html编码设置

对应语言文件中设置

比如:includes/languages/english.php (对应语言)文件如下图设置:

3、php等代码文件的编码

可以用editplus、notepad++等专业代码编辑工具转化编码

4、数据库表中字符串字段编码类型

35PHP 更全 更专业 更方便