Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

STS Articles - infobox - Easily updateDeleteList Articles under STS


MatthewRitchie

Recommended Posts

I tried uploading this several times to the contributions page but there are mysql errors all over the page so here is the topic so far:

 

 

STS Articles

pixel_trans.gifSTS Articles is a simple contribution for OSCommerce and the Simple-Template-System that allows you to add, edit and delete articles that are viewed via an info box. Although this is made for STS it is a standalone contribution that should work (with a little tweaking) without STS. It is also Standalone in the sense that very few if any OSC functions are used. All the [functions/object classes/database access] I needed to make this work have been reworked into this contribution.

 

 

Example Views.

The articles can be either sorted by category or by file name and are viewed on screen via an info box as seen below. Articles may associated with several categories and individual pages by file name.

 

To see the different layouts (by category/file name) please see:

 

This file you are now viewing and [bY FILE] Wind_Power.php <LI>[bY CATEGORY] Articles.php

 

 

Articles by File Name

The explanation for 'by file name' is that an article can be directly related to a given file name such as 'About_Us.php' and when visitors navigate to this file only those articles can be viewed. File name articles are accessed in admin exactly the same way as category articles because the file name is stored as a category heading.

 

Because only the file name (including the .php extension) is recognised using the basename() function, no query strings will alter the resulting output. However using the query string will extend the usability of this contribution to providing articles related to say individual products but this feature will only be available in a later update.

 

 

Public/Private Categories/Articles

There is a distinction made between public and admin article categories. In the database table `article_categories` each category has a `status`. If `status` is '1' the category and articles contained within may be viewed by the public. If `status` is '0' the category and articles can only be viewed via admin. This feature can be extended upon to provide greater flexibility. At present the `status` can not be changed via admin/articles.php but can be easily done in PHPMYADMIN.

 

 

Admin - articles.php

The 'admin/articles.php' file is where the articles may be listed by category or are all listed by date of creation. It is a single file that will do all the article admin such as:

 

<LI>Creating, Editing and Deleting Article Categories. <LI>Inserting New Articles. <LI>Editing Existing Articles. <LI>Deleting Articles.

 

 

Number of Articles per Page (in info box). Number of Page navigation Links.

If there are more than four articles associated with a category or file name you will see a page navigation appear at the top of the Articles info box. This is the same page navigation system used by OSC to page through a large list of products as used in 'products_new.php'.

The number of articles shown per page can be changed in the file catalog/includes/boxes/articles.php where $max_rows = 4;. This is also where you can edit $max_page_links, i.e. the number of pages available as links in the page navigation.

 

 

 

 

 

Please find instructions provided in the Articles section at the bottom of the screen.

 

Many Thanks, hope you like it - it has been many months in development/learning php/mysql I think am beginning to get better, but let me know..

 

:rolleyes:

 

Matthew

Link to comment
Share on other sites

Install - STS Articles.

STS Articles contains only four new files and some small additions to the database.

Other changes to OSC/STS files are for access via admin and inclusion of the info box contents.

 

Add New files keeping directory structure:

www_root/catalog/admin/articles.php

www_root/articles/article_details.php

www_root/catalog/includes/boxes/articles.php

Because this contribution is designed for STS using 'external page templates' [a previous BlueGreenEnterprises contribution] the admin/articles.php file does not have the general OSC admin look and feel. The article file does not actually use anything from admin to opperate and is only in the admin folder to protect it under the htaccess password. The file admin/articles.php is really supported by STS in catalog/includes and hence will be visually the same as your sts_template output like other shop files. I built a separate template file for articles.php, kept the heading/header/footer etc and removed the left and right columbs to make it easier to reed. My articles template file is supplied for reference.

 

YOU WILL NEED TO EDIT THIS MANUALLY.......

'external page templates' requires that DIR_WS_INCLUDES is redefined in the file locally, if that file resides/is located outside of the catalog directory.

My catalog has had a change of name to shop/etc etc etc. sorry for the incovienance if you are still using catalog/ it is just a minor change in a few files, happy fishing.

 

Hence you may need a new template file for admin/articles.php. Call it 'articles.php.html ' and add it to your STS templates folder.

templates/articles.php.html [template for admin/articles.php]

Modify... www_root/catalog/includes/modules/sts_inc/sts_user_code.php

 

Under:

 

$sts->start_capture();

echo "\n\n";

echo tep_draw_form('goto', FILENAME_DEFAULT, 'get', '');

echo tep_draw_pull_down_menu('cPath', tep_get_category_tree(), $current_category_id, 'onChange="this.form.submit();"');

echo "\n";

echo "\n";

$sts->stop_capture('catmenu');

 

 

Add:

 

// ****************************************************

// Articles

// ****************************************************

$sts->start_capture();

require(DIR_WS_BOXES . 'articles.php');

$sts->stop_capture('articles');

// ****************************************************

 

 

In the STS_TEMPLATE file Add:

 

$ articles [without the space after the $_. Without the space here, the placeholder would be processed by STS.]

where you like - preferable in the content section as the info box will be quite wide.

 

So that the file 'article_details.php' and the 'stylesheet.css' can be found add the following lines to www_root/catalog/includes/filenames.php:

 

 

define('ARTICLE_DETAILS_FILE', 'articles/Article_Details.php');

define('ARTICLE_STYLESHEET', 'articles/assets/stylesheet.css');

 

 

 

www_root/catalog/includes/boxes/articles.php contains the line:

 

$conn = new mysqli(DB_SERVER, DB_SERVER_USERNAME_II, DB_SERVER_PASSWORD_II, DB_DATABASE_II) or die ('Cannot open database');

 

For testing on my home server and remote I have a second database setup alongside OSC. Therefore, I have added the above defined variables to catalog/includes/configure.php for easy access. Like so:

 

define('DB_SERVER_USERNAME_II', 'userii'); define('DB_SERVER_PASSWORD_II', 'passwordii'); define('DB_DATABASE_II', 'testdb');

 

 

 

Matthew John Ritchie

BlueGreenEnterprises.com

Link to comment
Share on other sites

Using STS Articles

 

Through admin/articles.php you can:

List, Insert, Edit, Delete Article Categories.

List Articles by Category.

List All Articles by date.

Insert New Article

Edit and Delete Articles from the two Listing Pages.

via the links and buttons provided.

 

This is all done in one file so when you look through the code to do edits yourself Please backup! at each stage. If not you will have to reDownload and start again.

 

Article Listing

 

Articles (at present) are associated with a page with respect to the page name as you would see it in it's folder i.e. 'STS_Articles.php'. This is done with the function 'basename($PHP_SELF)' as seen in boxes/articles.php.

 

There is Provision within the infobox code to pass a query string like '?cat=5' to designate category number '5' to list articles associated with that particular category. A demonstration of this is available in New Articles by Category. You can do the same with a menu of static links or copy the dynamic menu code from admin/articles.php.

 

 

File Name as Category Heading

 

When inserting a new article you must relate the article to a category! Therefore the category must already exist, if not you must create it. Use the 'Insert & Edit & Delete Article Categories' link. To have articles related to a particluar file name such as 'About_Us.php' simply type this in as a new category heading and that is it. OH! Remember if you are on linux like me your file names etc are case sensitive!. This caused me no end of head scratching untill I discovered the problem three weeks later.

 

Deleting Articles

Link to comment
Share on other sites

Since I have been away, and now have STS Articles working I now have the know-how on getting my next (origional) contribution running.

 

Here is a basic lowdown.

 

I wanted a very basic supplier admin that listed all products by supplier or individual company. all company details, product details and cost/margin/ etc etc can easily be updated and in bulk.

 

Order emails would be created automatically and sent only on receit of payment confirmation and your own acknowledgement.

 

essentially extending the admin categories to include supplier contact details and the rest to act like a directory of companies but it wont look like osc admin for now. Oh an you could keep tabs on your competitors by listing them is a category 'competitiors'. I also have a category for installers etc etc so groupings would be flexable.

 

Although this is semi-working on my home computer (STS article) will give me the boost to get this contribution ready and working live.

 

will keep you updated soon...

 

Matthew John Ritchie

Link to comment
Share on other sites

  • 3 weeks later...

STS + GCO FILES AND MODS NOW AVAILABLE AT

 

STS POWER PACK

 

MORE INFO AND NOTES AT

 

BGE/STS_GoogleCheckout

 

Matthew John Ritchie

 

p.s.

 

I have another contrib in development:

 

WEB MOBILE COMPLIANT THUMBNAILS

 

it is a fix so you can have thumbnails for the public viewing pages for fast uploads to mobiles as well as having large pictures in the popup windows

 

if this reminds you of anything please let me know so i can have a look

Link to comment
Share on other sites

  • 2 weeks later...

see the demo at: www.bluegreenenterprises.com

 

New OSC Bundle package cmming soon:

 

give it a try and let me know what you think...

 

Google Checkout (v1.4.5a).

STS v4.5.8.

Web Mobile Thumbnails - in POPUP IMAGE.

Dynamenu (Gone Nuts Bonkers) - Multiple Flyout Menu System.

Extra Admin links to New Add-Ons.

Admin - Multi Product Update - Weight, Prices and QTY.

Hide Empty Categories (Dynamenu also hides empty Categories).

Admin->modules->shipping - Individual Product Shipping Prices.

STS Articles

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...