Edit for opencart 1.4.x By Siamopencart.com 13 feb 2010 auth:Somsak2004 1. copy all to toue store 2. goto phpmyadmin ->select database -> press sql [right tab menu] -> patse under sql to textarea -- table blog CREATE TABLE `blog` ( `post_id` int(11) NOT NULL auto_increment, `subject` text NOT NULL, `content` text NOT NULL, `author_id` int(11) NOT NULL, `status` enum('draft','published') NOT NULL default 'draft', `date_posted` datetime NOT NULL, `date_modified` datetime NOT NULL, PRIMARY KEY (`post_id`) ); -- end table blog 3. press ok insert database to your mysql. 4. goto backend of store to set permission of use blog 5. system->user->user group->Top Administrator->[Edit]-Access Permission:->press check->extension/blog ->Modify Permission:press check->extension/blog->press [SAVE] in roght top menu 6. press -> Extension -> Blog for new tpur blog & news Thank! ********************************************************************************** ############################################################################# # Module Blog & News for Opencart 1.4.x From Team SiamOpencart.com # # เว็บผู้พัฒนา www.siamopencart.com ,www.thaiopencart.com # # โดย Somsak2004 วันที่ 13 กุมภาพันธ์ 2553 # ############################################################################# # โดยการสนับสนุนจาก # # Unitedsme.com : ผู้ให้บริการเช่าพื้นที่เว็บไซต์ จดโดเมน ระบบ Linux # # Net-LifeStyle.com : ผู้ให้บริการเช่าพื้นที่เว็บไซต์์ จดโดเมน ระบบ Linux # # SiamWebThai.com : SEO ขั้นเทพ โปรโมทเว็บขั้นเซียน ออกแบบ พัฒนาเว็บไซต์ / ตามความต้องการ และถูกใจ Google # ############################################################################# OpenCart_Blog v1.3.4.1 Written by Seth Syberg (www.sethsyberg.com) Copyright 2009 Seth Syberg License: http://creativecommons.org/licenses/by-sa/3.0/us/ Disclaimer: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. IF YOU DO NOT AGREE TO THIS DISCLAIMER OR LICENSE, YOU MAY NOT USE THIS SOFTWARE. CONTENTS 0. Hire Me 1. Introduction 2. Database Changes 3. Install 3.1 Add New Files 3.2 hearder File Modifications 3.3 Displaying the Blog 3.4 Customizing the Blog Template 4. Using the Blog 4.1 Setting Permissions 4.2 Adding a Post 4.3 Editing a Post 4.4 Deleting Posts 5. Bugs, Troubleshooting, and Suggestions 0. HIRE ME A quick advertisement. I'm available for hire if you are interested in any kind of opencart modifications or customizations (or just about any other web development for that matter). Just contact me at www.sethsyberg.com. 1. INTRODUCTION This is the Blog mod for OpenCart version 1.3.4. It's a very simple blog and requires almost zero code modification. Install should be fairly painless, though it requires a bit of technical skill to edit the three hearder files and add a table to the database. I'm open to expanding this module if folks have any feature requests they should let me know. See my contact information below. 2. DATABASE CHANGES Run the following SQL query in your opencart database (if you use a database prefix for opencart, be sure to append it to the beggining of "blog"). This simply adds a new "Blog" table to the database. CREATE TABLE `blog` ( `post_id` int(11) NOT NULL auto_increment, `subject` text NOT NULL, `content` text NOT NULL, `author_id` int(11) NOT NULL, `status` enum('draft','published') NOT NULL default 'draft', `date_posted` datetime NOT NULL, `date_modified` datetime NOT NULL, PRIMARY KEY (`post_id`) ) 3. INSTALL 3.1 ADD NEW FILES In the zip file you downloaded, there is a directory named opencart. This directory replicates the directory structure of the OpenCart framework. To install, simply move each file in the downloaded opencart directory into the corresponding directory in your opencart install. If you are using an application like WinSCP, just copy the admin and catalog directories to your opencart root and it should put the files in the right place for you (note: your experience may vary depending on your scp/ftp program and settings). A complete list of the files that are added is as follows: opencart/admin/controller/extension/blog.php opencart/admin/language/english/extension/blog.php opencart/admin/model/extension/blog.php opencart/admin/view/template/extension/blog_list.tpl opencart/admin/view/template/extension/blog_post.tpl opencart/catalog/controller/module/blog.php opencart/catalog/language/english/module/blog.php opencart/catalog/model/module/blog.php opencart/catalog/view/theme/default/template/module/blog.tpl 3.2 hearder FILE MODIFICATIONS This mod requires a few very minor changes to the admin hearder files (so the blog functionality can show up in the admin hearder). (1) In admin/controller/common/hearder.php find this line: $this->data['text_zone'] = $this->language->get('text_zone'); And add this line directly under it: $this->data['text_blog'] = $this->language->get('text_blog'); In the same file, find this line: $this->data['zone'] = $this->url->https('localisation/zone'); And add this line directly under it: $this->data['blog'] = $this->url->https('extension/blog'); (2) In admin/view/template/common/hearder.tpl find this line:
  • And add this line directly under it:
  • (3) In admin/language/english/common/hearder.php find this line $_['text_zone'] = 'Zone'; And add this lne directly under it: $_['text_blog'] = 'Blog'; 3.3 DISPLAYING THE BLOG It's up to you where you want to actually display the blog posts. It requires only two lines of code, one line added to a controller and one to a template. To the controller that you want to display the blog in, add this line (make sure $this->children isn't overwritten below where you add it): $this->children[] = "module/blog"; And to the template for this controller add this line: For example, to display the blog on the opencart home page just above the "Latest Products" you would do the following: (1) In catalog/common/home.php, add this line to the index() function, it must appear before any calls to render() and after all other modifications of $this->children (I tend to put it right above the call to render()): $this->children[] = "module/blog"; (2) In catalog/view/theme/default/template/common/home.tpl find this line:
    And add this line directly under it: 3.4 CUSTOMIZING THE BLOG DISPLAY To customize the blog display, edit the template file in catalog/view/theme/default/module/blog.tpl You may want to move the styles in that file to your sytlesheet (your page will not validate without moving these). If you want to change the format of the date or anything more complex you'll need to edit the model file at: catalog/model/module/blog.php 4. USING THE BLOG Using the blog should be extremely straight forward, but here's a little instruction. NOTE: Be sure to set the "First Name" field for any users creating posts in Admin -> Configuration -> Users -> User as this is where the tagline gets it's author name from. 4.1 SETTING PERMISSIONS In the administration panel, go to Admin -> Configuration -> Users -> User Groups and edit permissions for the group you want to give blog use to. Check the access and modify permissions for "extension/blog" and hit "Save". 4.2 ADDING A POST You can access the blog administration from the Extensions hearder. Hit the "Add New Post" button, fill out the form and hit "Post". You can save a post as "draft" and it won't be published until the status is changed. 4.3 EDITING A POST You can edit a post by clicking the edit button on the blog administration main page. Changes are lives as soon as you hit "Post", but the original post date remains unchanged. Posts are displayed in order of post date. There is currently no way to move a post by changing it's post date. 4.4 DELETING POSTS You can delete posts by checking the checkbox next to the posts to be deleted and hitting the delete button. This action CAN NOT BE UNDONE. 5. BUGS, TROUBLESHOOTING, AND SUGGESTIONS Please tell me about bugs or other issues you may have, or features you would like to see in a future release. When contacting me with a bug or for troubleshooting you must include a link to your opencart install, all necessary steps to reproduce the problem, and any php errors or relevant apahce error logs entries. Failure to include this information may result in no response to your request. You can contact me here: http://www.sethsyberg.com/contact.php Enjoy!