• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS made Simple Czech Site Zur deutschsprachigen Supportseite Site francophone Sitio en Castellano CMSMS - Magyarország CMSMS -  ???????
Pages: [1]
  Print  
Author Topic: CMSMS Shop Skin Helper for osCommerce and Zen Cart + others  (Read 5444 times)
0 Members and 1 Guest are viewing this topic.
Owens
Forum Members
**

Karma: 0
Offline Offline

Posts: 61



WWW
« on: 09 Aug 2009, 23:07 »

Latest Version: 1.2
Download: http://www.studio-owens.com/code/cmsms-shop-skin-helper.htm

About CMSMS Shop Skin Helper:
I've been contacted via email a great deal lately in regards to how I "integrated" CMS Made Simple with osCommerce / Zen Cart. I didn't integrate them, just skinned them.

I skin all the osCommerce / Zen Cart projects with cached skin files, which are generated from a CMS Made Simple page using some predefined HTML comments placed in the template.

I am releasing the basic code I use to do this under the GNU GPL so others can modify and share as desired. The code to generate the skin files is very simple, and every line is commented to make it easy for someone to adapt to their needs. I use variations of this code to create skin files for a variety of PHP apps, not just osCommerce and Zen Cart. I have even used it in conjunction with existing caching systems.

This tool removes that headache of trying to maintain a similarly themed eCommerce package. When a new page is added, or the design changes in CMS Made Simple, the CMSMS Shop Skin Helper does the work of updating the skin files for osCommerce / Zen Cart. The code creates three files from the CMS Made Simple page and uses those files to sandwich the eCommerce pages. This allows the CMS Made Simple menus to be easily updated on a time schedule and/or with a manual call to the CMSMS Shop Skin Helper code.

Manually skinning an osCommerce or Zen Cart installation with a template similar to the CMS Made Simple template is a pain. As multiple template files have to be updated each time something changed with your site's design or a new page is added to the menu. Yuck.

How To Skin osCommerce / Zen Cart:
I provide an example in the download for skinning an osCommerce and Zen Cart installation.

Support:
This thread will be the support page for the CMSMS Shop Skin Helper. Post your questions here and maybe I, or someone else in the community, can help you out.

File Create Functions:
Some servers have disabled allow_url_include for better security. Two create file functions exist: create_file() requires allow_url_include to be turned on; create_file_curl() uses CURL to create the files.
« Last Edit: 13 Nov 2009, 10:37 by Owens » Logged

Simon66
Forum Members
**

Karma: 2
Offline Offline

Posts: 91

Gravatar


« Reply #1 on: 09 Aug 2009, 23:19 »

Very impressive!
I'll test this out on one of my own ideas. If it works out I'll add it to my list of 'offerings'.
I'm getting more and more enquiries about e-commerce.
This looks like a great solution.
Thanks

Simon66
Logged

A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.

This must be Thursday. I never could get the hang of Thursdays.

Douglas Adams - The only sane person in the asylum.
Owens
Forum Members
**

Karma: 0
Offline Offline

Posts: 61



WWW
« Reply #2 on: 10 Aug 2009, 15:54 »

Let me know how you end up using it, or if the instructions included in the download need changed.
Logged

Owens
Forum Members
**

Karma: 0
Offline Offline

Posts: 61



WWW
« Reply #3 on: 13 Aug 2009, 15:35 »

CMSMS Shop Skin Helper - Update v1.1

Some servers have allow_url_include disabled for better security. Starting with PHP 5.2.X allow_url_include is disabled by default. As an alternative method of creating files I have included a second create file function that uses cURL.

If allow_url_include is disabled PHP will throw an error like:
Quote
Warning: require() [function.require]: URL file-access is disabled in the server configuration in /catalog/cmsms_shop_skin_helper.php on line 100

In this case use the function: create_file_curl()

The the original function requires allow_url_include to be enabled: create_file()

The first post of this thread has the download link.
« Last Edit: 18 Aug 2009, 11:04 by Owens » Logged

Connie
Translator
Forum Members
***

Karma: 2
Offline Offline

Posts: 236


WWW
« Reply #4 on: 13 Nov 2009, 03:25 »

I run into a funny result  Huh

The website where I am testing the functionality is password-protected (because in state of development, non-public)
Now the 3 generated files contain this content:

Code:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>401 Authorization Required</title>
</head><body>
<h1>Authorization Required</h1>
<p>This server could not verify that you
are authorized to access the document
requested.  Either you supplied the wrong
credentials (e.g., bad password), or your
browser doesn't understand how to supply
the credentials required.</p>
</body></html>

What to do? I do not want to disable the auth-directive in the .htaccess ;=)
Logged

Connie Müller-Gödecke
www.webdeerns.de
Hamburg
Connie
Translator
Forum Members
***

Karma: 2
Offline Offline

Posts: 236


WWW
« Reply #5 on: 13 Nov 2009, 03:35 »

And I have a second question, which I want to post separately:

How does the script react to changes in the menue (in example new pages are added or deleted), I understand that the script must run to write these into the 3 files

so what do you suggest:

1) run the script using a cron-job

2) include the script in the application (in my case it is a database-related script which outputs some text) and invoke it everytime the script is called?

Thanks in advance, Connie
Logged

Connie Müller-Gödecke
www.webdeerns.de
Hamburg
Connie
Translator
Forum Members
***

Karma: 2
Offline Offline

Posts: 236


WWW
« Reply #6 on: 13 Nov 2009, 04:12 »

I used it on a "non-secured" local installation and I am totally impressed! It is exactly what I need!

I ran it manually and was missing some info that the script succeeded.

Would it be too much asked to print some success-message on screen?

Logged

Connie Müller-Gödecke
www.webdeerns.de
Hamburg
Owens
Forum Members
**

Karma: 0
Offline Offline

Posts: 61



WWW
« Reply #7 on: 13 Nov 2009, 10:36 »

Hello Connie,

Output Messages
I added the $debug variable back into the code. Download v1.2 of the CMSMS Shop Skin Helper from my website, and set the debug variable to true (this is found in the source code around line 56). This will output a success or fail messages to the screen on each step.
http://www.studio-owens.com/code/cmsms-shop-skin-helper.htm



Automatic Script Running
How does the script react to changes in the menue (in example new pages are added or deleted), I understand that the script must run to write these into the 3 files

The script doesn't react to changes in the menu, as it is very generic and can be used for any PHP application and not just CMSMS. That being said, you could integrate it into core so each time the menu is updated, the script fires and creates the new skins. However, this change would need to be made each time you updated the code, and it would negate your ability to receive technical support on the core. Therefore, it is easiest to use one of the three following methods to update the menus.


Method One - Setup a Cron Job
1) run the script using a cron-job

1) A Cron Job will work fine. Since the Cron Job runs on a set schedule there will be a delay between when the pages are updated and the script fires.

Setting the debug variable to true would be great for running this script as a cron, as it would then send you the success or fail output messages when it runs.


Method Two - Include the File in the Site's Home Page
2) include the script in the application (in my case it is a database-related script which outputs some text) and invoke it everytime the script is called?

2) timeToLive
You asked about this on my site, and I personally use this method for some of my clients. The timeToLive variable, and comments on its use, are found directly in the source code.

Open the file: cmsms_shop_skin_helper.php file and look around line 48:
Code:
/* timeToLive can be useed for automated updating of the skin files; not used in the example
install instructions; if you include this file at the top of your eCommerece home page then
timeToLive will cause the skin files to be re-generated every # of seconds; set timeToLive to a low
time if doing many CMSMS template changes; seconds to keep the skin files for;
600 = 10 minutes; 43200 = 12 hours */
$timeToLive = 10;

Set this variable higher to keep the cached skin files longer. The reason to cache the skins is a reduced load time. I had an old method (the old method can be found on my site's blog) that didn't cache the skins from CMSMS and it took way to much time to process.

After you set the timeToLive variable in the source code, include the skin helper file at the top of your site's home page, or in the PHP Application (for example, I typically choose the main page of osCommerce). Your PHP include would look something like this:
Code:
<?php include('cmsms_shop_skin_helper.php'); ?>

Make sure you set the debug variable to false if you are going to use the timeToLive feature. You wouldn't want messages output to the visitor each time the script fires.


Method Three - Manually Call the File
This by far the easiest method. Simply call the file after you make all your page changes. I sometimes create a shortcut in CMSMS for the client to use. http://wiki.cmsmadesimple.org/index.php/User_Handbook/Admin_Panel/Site_Admin/Manage_Shortcuts


Secured Directory
Hum... haven't run into this problem myself. I will ask some of the other developers that are using this script if they have run into this problem.
« Last Edit: 13 Nov 2009, 10:39 by Owens » Logged

Connie
Translator
Forum Members
***

Karma: 2
Offline Offline

Posts: 236


WWW
« Reply #8 on: 13 Nov 2009, 11:04 »

Owen,

it is great. Thank you for your answers and suggestions.

I think I will include into the application script without debug-messages when the inplementation will be set productive ..

I think as I have to integrate some "old" application because it is a relaunch of a 12 year old very active website, I will have need of more than one $cmsmsURL, so maybe I will rename that script or add the $cmsmsURL as variable, would you mind about that?

Thanks again, this is a great tool!

Connie
Logged

Connie Müller-Gödecke
www.webdeerns.de
Hamburg
Owens
Forum Members
**

Karma: 0
Offline Offline

Posts: 61



WWW
« Reply #9 on: 13 Nov 2009, 11:31 »

I will have need of more than one $cmsmsURL, so maybe I will rename that script or add the $cmsmsURL as variable, would you mind about that?

You can do what you want with it as long as you keep the copyright and GNU GPL license intact. More details here: http://www.studio-owens.com/code.htm

This code is distributed under the GNU General Public License, which is a Free Software license. It grants to you the four following freedoms: (1) The freedom to run the program for any purpose; (2) The freedom to study how the program works and adapt it to your needs; (3) The freedom to redistribute copies so you can help your neighbor; (4) The freedom to improve the program and release your improvements to the public, so that the whole community benefits.
Logged

Pages: [1]
  Print  
 
Jump to: