OsCommerce

出自 ProgWiki
前往: 導覽搜尋
OsCommerce
Os commerce.png
開發者 Harald Ponce de Leon
穩定版本 2.3.4/
2014年06月5日,4年前2014-06-05
程式語言 PHP
類型 Webshop
許可協議 GPL
網站 www.oscommerce.com

OsCommerce,參照:『維基百科~OsCommerce

官網

相關外掛

FAQ

register_globals未開啟

  • 加上檔案 .htaccess
php_value register_globals 1

後台的【廣告總管】出現Warning: imagepng()的錯誤訊息

  • admin/images/graphs/ 资料夾及其底下所有的檔案權限,全部都改為777

網頁顯示的字太小

  • 前台,修改 \stylesheet.css
  • 後台,修改 \admin\includes\stylesheet.css

osCommerce需要搬網頁目錄時

當虛擬主機的網站套件,不允許osCommerce安裝到網站根目錄的話……
  • 前台,修改 \includes\configure.php
  • 後台,修改 \admin\includes\configure.php

改Logo圖

  1. 上傳圖檔到 /images/
  2. 前台,修改 /includes/header.php 把 'oscommerce.gif' 置換為您上傳的logo圖檔名
 <td valign="middle"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'oscommerce.gif', 'osCommerce') . '</a>'; ?></td>

移除首頁上,非必要的區塊

  • 修改檔案(以PHP註解方式關閉相關的的PHP程式碼)
  • 左邊區塊,修改 includes/column_left.php
  • 商品分類 categories.php
  • 製造廠商 manufacturers.php
  • 新進商品 whats_new.php
  • 快速尋找商品 search.php
  • 服務台 information.php
  • 右邊區塊,修改 includes/column_right.php
  • 購物車 shopping_cart.php
  • manufacturer_info.php
  • 購物紀錄 order_history.php
  • 暢銷商品 best_sellers.php
  • 商品通知狀態 product_notifications.php
  • 推薦給親友 tell_a_friend.php
  • 特價商品 specials.php
  • 商品評論 reviews.php
  • 語系 languages.php
  • 貨幣 currencies.php

移除首頁下的osCommerce版權聲明字串

  • 以繁體中文版的介面為例,修改 \includes\languages\tchinese.php
修改為 define('FOOTER_TEXT_BODY', ' ');

首頁右上角的【我的帳號】、【購物車】、【結帳】

  • 修改 includes/header.php
以 style="display:none" 方式將 td 區塊整個隱藏

隱藏【放到購物車】

  • 如果要做純商品展示用的網站的話
  • 修改 (在下列檔案尋找關鍵字 IMAGE_BUTTON_IN_CART)
    1. products_new.php
    2. product_info.php
    3. product_reviews.php
    4. product_reviews_info.php
    5. product_reviews_write.php

前台進得去,但後台進不去

  • 錯誤訊息
Fatal error Cannot re-assign $this in \admin\includes\classes\upload.php 
  • 修改方式
\admin\includes\classes\upload.php 以文字編輯器將31行 $this=null; 改成 unset($this); 


Select時,limit 的offset為負數

  • 檔案 \includes\classes\split_page_results.php
  • 檔案 \admin\includes\classes\split_page_results.php
原本是
$offset = ($max_rows_per_page * ($current_page_number - 1));
$sql_query .= " limit " . $offset . ", " . $max_rows_per_page;
修正為
$offset = ($max_rows_per_page * ($current_page_number - 1));
//fix code
if ($offset < 0) {
	$offset = 0;
}
$sql_query .= " limit " . $offset . ", " . $max_rows_per_page;


Select時,1054 - Unknown column 'p.products_id' in 'on clause'

  • 檔案 \advanced_search_result.php
  • 搜尋 「p.products_id = s.products_id」改為「pd.products_id = s.products_id」
原本是
$from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";
修正為
$from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on pd.products_id = s.products_id, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";

改以jQuery.lightbox 0.5版顯示商品圖

1.下載jquery-1.2.6.pack.js,並依下列的URL放置檔案

/script/jquery/jquery-1.2.6.pack.js 

2.下載jQuery.lightbox,解壓縮後並依下列的URL放置檔案

/images/lightbox-blank.gif
/images/lightbox-btn-close.gif
/images/lightbox-btn-next.gif
/images/lightbox-btn-prev.gif
/images/lightbox-ico-loading.gif
/script/jquery/lightbox/css/jquery.lightbox-0.5.css
/script/jquery/lightbox/js/jquery.lightbox-0.5.pack.js

3.修改 /product_info.php

  • function popupWindow(url) 不使用,改用jQuery.lightbox 0.5版
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<script language="javascript"><!--
function popupWindow(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}
//--></script>
<link rel="stylesheet" type="text/css" href="/script/jquery/lightbox/css/jquery.lightbox-0.5.css" media="screen" />
<script type='text/javascript' src="/script/jquery/jquery-1.2.6.pack.js"></script>
<script type='text/javascript' src="/script/jquery/lightbox/js/jquery.lightbox-0.5.pack.js"></script>
<script type="text/javascript">
$(function() {
	$('a[@rel*=lightbox]').lightBox({fixedNavigation:true}); // Select all links that contains lightbox in the attribute rel
});
</script>
</head>
  • 與不用彈出視窗的方式
<script language="javascript"><!--
/*
document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], big5_addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');
*/
document.write('<?php echo '<a rel="lightbox" href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" title="' .$product_info['products_name'] .'">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');
//--></script>

新增FAQ用的頁面

資料表

資料表 用途
action_recorder
address_book
address_format
administrators 管理者的帳密
banners
banners_history
categories 分類
categories_description 分類描述
configuration
configuration_group
counter
counter_history
countries
currencies
customers 顧客資料
customers_basket
customers_basket_attributes
customers_info
languages
manufacturers
manufacturers_info
newsletters
orders
orders_products
orders_status
orders_status_history
orders_products_attributes
orders_products_download
orders_total
products 商品
products_attributes
products_attributes_download
products_description 商品描述
products_images 商品圖示
products_notifications
products_options
products_options_values
products_options_values_to_products_options
products_to_categories
reviews 商品評論
reviews_description
sec_directory_whitelist
sessions
specials
tax_class 稅別
tax_rates 稅率
geo_zones
whos_online
zones 地區
zones_to_geo_zones