在zencart網站程序中,如何把自帶的paypal快捷支付模塊的的語言及支付頁面Logo圖片設置為自己想要的語言及圖片呢?
可以通在zencart中的paypal快捷支付模塊“includesmodulespaymentpaypalwpp.php”中增加參數的方式來自定義Logo圖片及更換語言,設置支付頁面左上角用文字替代Logo。
如下圖所示:
在zencart網站程序中,如何把自帶的paypal快捷支付模塊的的語言及支付頁面Logo圖片設置為自己想要的語言及圖片呢?
可以通在zencart中的paypal快捷支付模塊“includesmodulespaymentpaypalwpp.php”中增加參數的方式來自定義Logo圖片及更換語言,設置支付頁面左上角用文字替代Logo。
如下圖所示:
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']) . '"' => ?? '"', '\'' => ''', '<' => '<', '>' => '>')) . '"> ?? ' . zen_output_string($values[$i]['text'], ?? array('"' => '"', '\'' => ''', '<' => '<', '>' => '>')) . '</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";}}
完成了,看看下面的效果圖吧
排版布局div+css樣式可以根據自己網站的情況進行修改的,試試吧,看是不是成功啦。
本地通過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如何獲取產品描述函數,相信這個函數在做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 ; } |
本地通過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!
#————————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—————–
如果你的網站原有的很多鏈接被刪除之后,或者是因為網站原因造成網站出現很多無效鏈接,多出來很多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放置在網站根目錄
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代碼:
<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;}? |
圖片自己準備一個.
encart新手在使用zencart網站做國內中文網站或者一些小語種網站的時候,經常會遇到zencart網頁亂碼問題。其實網頁亂碼外呼就是編碼出現問題了,整個程序就三個地方會有編碼:數據庫操作時的編碼設置、網頁html編碼設置、php等代碼文件的編碼。
我們只要從這4個方面著手去找肯定能解決問題。
下面我來總結下zencart出現編碼問題,即亂碼問題的時候該怎么解決?
配置文件中添加
define('DB_CHARSET','utf8');
如果已經定義了該常量,找到對應常量值改為utf8即可。
對應語言文件中設置
比如:includes/languages/english.php (對應語言)文件如下圖設置:
可以用editplus、notepad++等專業代碼編輯工具轉化編碼