Wordpress嵌入osCommerce/Wordpress和osCommerce 整合

Wordpress嵌入osCommerce/Wordpress和osCommerce 整合

帮朋友做了一个osCommerce的应用商城网站,在制作中需要把Wordpress和osCommerce整合。从国外网站找到了一片文章,按照他的说明整合完成,现在把步骤描述如下:

1、先在商城的目录中建立wordpress文件夹。安装wordpress,然后把wordpress的数据表迁移到osCommerce的数据库中,即整合数据库。这步不用多说,很简单,会使用phpMyAdmin就可以。

2、 在osCommerce商城根目录建立blog.php文件,内容如下:

< ?php /* Title: Embedding WordPress into OS Commerce Author: Michael Wender (www.michaelwender.com) Disclaimer: This Software is provided "AS IS" and without warranty of any kind. The user assumes all risks associated with its use and installation.

$Id: blog.php,v 1.1.1.1 2004/03/04 23:38:02 ccwjr Exp $

osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce

Released under the GNU General Public License */ // turn off WordPress themes and include the WordPress core: define('WP_USE_THEMES', false); require('./wordpress/wp-blog-header.php');

require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_BLOG); $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_BLOG)); $content = CONTENT_BLOG; require(DIR_WS_TEMPLATES . TEMPLATE_NAME . ‘/’ . TEMPLATENAME_BLOG_PAGE); require(DIR_WS_INCLUDES . ‘application_bottom.php’); ?>

3、打开oscommerce_root/includes/filenames.php 文件,找到“// define the content used in the project”注释,在下面加入: define(’CONTENT_BLOG’, ‘blog’);

在找到“// define the filenames used in the project”注释,在下面加入: define(’FILENAME_BLOG’, CONTENT_BLOG . ‘.php’);

接着找到“// define the templatenames used in the project”注释,加入: define(’TEMPLATENAME_BLOG_PAGE’, ‘blog_page.tpl.php’);

4、建立blog模版文件:oscommerce_root/templates/your_template_dir/blog_page.tpl.php ,文件名blog_page.tpl.php。 在文件中拷贝下面代码。当然,这个文件是可以被修改定制的,您可以学会使用WordPress Loop模版语法,来调整显示的内容和样式等。 WordPress Loop说明地址:http://codex.wordpress.org/The_Loop > “> // INSERT YOUR WordPress Loop Code HERE: if (have_posts()) : while (have_posts()) : the_post(); the_content(); endwhile; endif; // END WordPress Loop Code ?> 5、建立blog语言定义文件。目录:oscommerce_root/includes/languages/your_language/blog.php,文件名:blog.php 文件内容如下: /* Title: Embedding WordPress into OS Commerce Author: Michael Wender (www.michaelwender.com) Disclaimer: This Software is provided “AS IS” and without warranty of any kind. The user assumes all risks associated with its use and installation.

$Id: blog.php,v 1.2 2004/03/05 00:36:42 ccwjr Exp $

osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce

Released under the GNU General Public License */

define(’NAVBAR_TITLE’, STORE_NAME. ‘ Blog’); define(’HEADING_TITLE’, ‘Blog’); ?>

6、完成整合,上面说明只是基本的整合方法,具体的内容美化还要花费一些经历。如果wordpress loop使用的好,整合效果会更理想。访问blog地址:http://your-domain.com/blog.php

英文原文: Embedding WordPress into OS Commerce I’ve created the following tutorial in response to topic 47148: osCommerce and WordPress at WordPress Support.

While I have been programming PHP for a while, I am new to both OS Commerce and WordPress. That being said, for this integration I have tried to follow the coding standards for creating a new OS Commerce page. If you see any refinements I need to make to my code, feel free to comment. I hope this helps all of you who are looking to integrate OS Commerce and WordPress.

10/06/2006 - UPDATE: In response to comments below, I’ve written a Part II to this tutorial showing how to embed WordPress into a default install of OSC MS2.2.

PLEASE NOTE: The code in this tutorial assumes that your OS Commerce install is located in your server’s web root and your WordPress install is located in a subdirectory named wordpress/.

ALSO NOTE: This tutorial is written for OS Commerce installs using the Basic Template Structure (BTS). For OSC installs using the Simple Template Structure (STS), please see comment number 9 below:

Create a file for your WordPress blog in the root folder of your OS Commerce install. For our purposes, we’ll name this file blog.php. The contents of this file are as follows: view plaincopy to clipboardprint? Open the file oscommerce_root/includes/filenames.php. Find the section that begins with the comment // define the content used in the project, and add the following code: define('CONTENT_BLOG', 'blog');  and add the following: define('FILENAME_BLOG', CONTENT_BLOG . '.php');  define('TEMPLATENAME_BLOG_PAGE', 'blog_page.tpl.php');Create the following file: oscommerce_root/templates/your_template_dir/blog_page.tpl.php (Note: This file’s filename matches the variable you defined as TEMPLATENAME_BLOG_PAGE in filenames.php). The contents of this file will vary according to which template you are using (to start, I suggest making a copy of your main_page.tpl.php); however, the body content on this page will be your WordPress blog. You will display your blog using The WordPress Loop. The following file is only meant to show you how to get started. Your blog_page.tpl.php will vary according to the template you are using in OS Commerce:

<?php   /* Title: Embedding WordPress into OS Commerce Author: Michael Wender (www.michaelwender.com) Disclaimer: This Software is provided "AS IS" and without warranty of any kind. The user assumes all risks associated with its use and installation. $Id: blog.php,v 1.1.1.1 2004/03/04 23:38:02 ccwjr Exp $

osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */    // turn off WordPress themes and include the WordPress</b> core:   define('WP_USE_THEMES', false);   require('./wordpress/wp-blog-header.php');     require('includes/application_top.php');   require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_BLOG);   $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_BLOG));   $content = CONTENT_BLOG;   require(DIR_WS_TEMPLATES . TEMPLATE_NAME . '/' . TEMPLATENAME_BLOG_PAGE);   require(DIR_WS_INCLUDES . 'application_bottom.php');   ?> 

 

<?php /* Title: Embedding WordPress into OS Commerce Author: Michael Wender (www.michaelwender.com) Disclaimer: This Software is provided "AS IS" and without warranty of any kind. The user assumes all risks associated with its use and installation. $Id: blog.php,v 1.1.1.1 2004/03/04 23:38:02 ccwjr Exp $

osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */

// turn off WordPress themes and include the WordPress</b> core: define('WP_USE_THEMES', false); require('./wordpress/wp-blog-header.php');

require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_BLOG); $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_BLOG)); $content = CONTENT_BLOG; require(DIR_WS_TEMPLATES . TEMPLATE_NAME . '/' . TEMPLATENAME_BLOG_PAGE); require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

define('CONTENT_BLOG', 'blog');Find the section that begins with // define the filenames used in the project,

 

define('FILENAME_BLOG', CONTENT_BLOG . '.php');Find the section that begins with // define the templatenames used in the project, and add the following: view plaincopy to clipboardprint? define('TEMPLATENAME_BLOG_PAGE', 'blog_page.tpl.php'); 

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">   <html <?php echo HTML_PARAMS; ?>>   <head>   <meta http-equiv="Content-Type" content="text/html;   charset=<?php echo CHARSET; ?>">   <?php   if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {     require(DIR_WS_INCLUDES . 'header_tags.php');   } else {   ?>     <title><?php echo TITLE ?></title>   <?php   }   ?>   <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">   <link rel="stylesheet" type="text/css" href="<? echo TEMPLATE_STYLE;?>">   </head>   <body οnlοad="preloadImages();" style="background-color: #8E8B8B;">   <!-- warnings //-->   <?php require(DIR_WS_INCLUDES . 'warnings.php'); ?>   <!-- warning_eof //-->     <!-- header //-->   <?php require(DIR_WS_TEMPLATES . TEMPLATE_NAME .'/header.php'); ?>   <!-- header_eof //-->   <?php       // INSERT YOUR WordPress Loop Code HERE:       if (have_posts()) :          while (have_posts()) :             the_post();             the_content();          endwhile;       endif;       // END WordPress Loop Code   ?>   <!-- footer //-->   <?php require(DIR_WS_TEMPLATES . TEMPLATE_NAME .'/footer.php'); ?>   <!-- footer_eof //-->   </body>   </html> 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <?php if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {   require(DIR_WS_INCLUDES . 'header_tags.php'); } else { ?>   <title><?php echo TITLE ?></title> <?php } ?> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <link rel="stylesheet" type="text/css" href="<? echo TEMPLATE_STYLE;?>"> </head> <body οnlοad="preloadImages();" style="background-color: #8E8B8B;"> <!-- warnings //--> <?php require(DIR_WS_INCLUDES . 'warnings.php'); ?> <!-- warning_eof //-->

<!-- header //--> <?php require(DIR_WS_TEMPLATES . TEMPLATE_NAME .'/header.php'); ?> <!-- header_eof //--> <?php  // INSERT YOUR WordPress Loop Code HERE:  if (have_posts()) :     while (have_posts()) :     the_post();     the_content();     endwhile;  endif;  // END WordPress Loop Code ?> <!-- footer //--> <?php require(DIR_WS_TEMPLATES . TEMPLATE_NAME .'/footer.php'); ?> <!-- footer_eof //--> </body> </html>

 

The WordPress Loop The WordPress Loop in Action Create the following file: oscommerce_root/includes/languages/your_language/blog.php (Note: This file must be named the same as the file you created in step 1). The contents of this file are as follows: view plaincopy to clipboardprint? Okay, your WordPress blog should now be embedded into your OS Commerce install. Keep in mind that you will need to adjust your menus and links to point to this new page you have created. If your OS Commerce install is located in your site’s web root, and you have used the same filenames suggested in this tutorial, then the link to your blog will be: http://your-domain.com/blog.php.

<?php   /* Title: Embedding WordPress into OS Commerce Author: Michael Wender (www.michaelwender.com) Disclaimer: This Software is provided "AS IS" and without warranty of any kind. The user assumes all risks associated with its use and installation.

$Id: blog.php,v 1.2 2004/03/05 00:36:42 ccwjr Exp $

osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce

Released under the GNU General Public License */    define('NAVBAR_TITLE', STORE_NAME. ' Blog');   define('HEADING_TITLE', 'Blog');   ?> 

 

<?php /* Title: Embedding WordPress into OS Commerce Author: Michael Wender (www.michaelwender.com) Disclaimer: This Software is provided "AS IS" and without warranty of any kind. The user assumes all risks associated with its use and installation.

$Id: blog.php,v 1.2 2004/03/05 00:36:42 ccwjr Exp $

osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce

Released under the GNU General Public License */

define('NAVBAR_TITLE', STORE_NAME. ' Blog'); define('HEADING_TITLE', 'Blog'); ?>

 

A discussion of The WordPress Loop is beyond the scope of this tutorial; however, here are some excellent resources:
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
4S店客户管理小程序-毕业设计,基于微信小程序+SSM+MySql开发,源码+数据库+论文答辩+毕业论文+视频演示 社会的发展和科学技术的进步,互联网技术越来越受欢迎。手机也逐渐受到广大人民群众的喜爱,也逐渐进入了每个用户的使用。手机具有便利性,速度快,效率高,成本低等优点。 因此,构建符合自己要求的操作系统是非常有意义的。 本文从管理员、用户的功能要求出发,4S店客户管理系统中的功能模块主要是实现管理员服务端;首页、个人中心、用户管理、门店管理、车展管理、汽车品牌管理、新闻头条管理、预约试驾管理、我的收藏管理、系统管理,用户客户端:首页、车展、新闻头条、我的。门店客户端:首页、车展、新闻头条、我的经过认真细致的研究,精心准备和规划,最后测试成功,系统可以正常使用。分析功能调整与4S店客户管理系统实现的实际需求相结合,讨论了微信开发者技术与后台结合java语言和MySQL数据库开发4S店客户管理系统的使用。 关键字:4S店客户管理系统小程序 微信开发者 Java技术 MySQL数据库 软件的功能: 1、开发实现4S店客户管理系统的整个系统程序; 2、管理员服务端;首页、个人中心、用户管理、门店管理、车展管理、汽车品牌管理、新闻头条管理、预约试驾管理、我的收藏管理、系统管理等。 3、用户客户端:首页、车展、新闻头条、我的 4、门店客户端:首页、车展、新闻头条、我的等相应操作; 5、基础数据管理:实现系统基本信息的添加、修改及删除等操作,并且根据需求进行交流信息的查看及回复相应操作。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值