CornerStore
FAQ
See also: Shared FAQ
How do I configure/customize CornerStore?
How do I change CornerStore's styling?
How do I use the /store shortcut URL?
How do I embed CornerStore in another page, or within my site's existing layout?
I get an Internal Server Error!
I get an error saying "undefined function virtual" or "request execution failed."
Can you add feature XYZ to CornerStore?
How do I enable the image features (product thumbnails)?
How do I enable email notifications, or fix email-sending errors?
How do I set or reset my password?
How can I hide or password-protect certain features?
How do I integrate CornerStore with UserBase?
How do I integrate CornerStore with FileChucker?
How do I change the currency in CornerStore?
How do I sell digital goods in CornerStore?
Can I make CornerStore work with my existing login system?
Does CornerStore work with iWeb, or other 3rd-party website editors?
Does CornerStore work with Drupal?
How do I configure/customize CornerStore?
Just edit your cornerstore_prefs.cgi file in a text editor. This file is normally in your server's cgi-bin directory, or it may be in your store directory on Windows servers. The prefs file contains many adjustable settings along with documentation for them. For example, you may want to adjust $PREF{title}.
You'll notice that many lines in the prefs file begin with a "#" character. These lines are inactive "comment" lines containing instructions and examples, so don't change anything on them, because it won't have any effect on CornerStore. If you see a pref that you want to adjust, but it's on an inactive line, that usually means it's just an example included as part of the documentation, so you should look for another instance of that same pref on a line that doesn't begin with a "#" character – that will be the active version of the pref, so that's the one you should adjust.
[ Top – CS Homepage – Instructions – Download – Buy ]
How do I change CornerStore's styling?
To customize the styling (look and feel), just add your own CSS to the $PREF{css} setting. To include an external CSS file, use a CSS @import statement:
\@import url("/mystylesheet.css");
[rest of CornerStore's CSS here]
`;
Notice that the @-symbol on the @import statement must be escaped with a backslash, otherwise Perl will treat it as a variable, which will result in an error.
[ Top – CS Homepage – Instructions – Download – Buy ]
How do I use the /store shortcut URL?
On most servers, you can use www.yoursite.com/store instead of www.yoursite.com/cgi-bin/cornerstore.cgi to access CornerStore. But first, you must get the full cornerstore.cgi URL working. Once that's working, you can try these shortcut URLs:
www.yoursite.com/store/index.shtml
If one or both of those works, then delete the index file that doesn't work (if any), and then you should be able to use this shorter URL:
If neither index page works, then try www.yoursite.com/store/call_cs.php instead. If that works, then edit the index.php file, remove the "#" from the front of the call_cs line, and add a "#" to the front of the virtual line. Now www.yoursite.com/store/index.php should work, and if you delete the index.shtml file, then www.yoursite.com/store should work too.
If your server runs IIS rather than Apache, you can also use the Default Content Page feature to enable the shortcut URL. Open your IIS manager, find the /store/ directory, right-click on it and choose Properties. Go to the Documents tab, check the "Enable default content page" box, and add "cornerstore.cgi" to the top of the list.
If the short /store URL works on your server using one of the above methods, then set $PREF{here} to '/store/' in your prefs file.
If your server doesn't support any of the above methods, and you don't want to upgrade to a better hosting company, then you can use the not-quite-as-nice META Refresh method. Copy the /store/index-redirect.html file to /store/index.html and then edit the index.html file. In it, replace "mysite.com" with your domain name. Now yoursite.com/store will auto-redirect your visitors to yoursite.com/cgi-bin/cornerstore.cgi.
[ Top – CS Homepage – Instructions – Download – Buy ]
How do I embed CornerStore in another page, or within my site's existing layout?
Embedding Method A: call cornerstore.cgi from your PHP or SSI/shtml page:
- First make sure CornerStore is installed and working: visit yoursite.com/cgi-bin/cornerstore.cgi and you should see the store. If not, you need to fix that before trying to embed it. Important note: if you install CornerStore in a non-standard location (somewhere other than yoursite.com/cgi-bin/cornerstore.cgi), then you'll need to adjust the "/cgi-bin/cornerstore.cgi" throughout these instructions, to match wherever you've actually installed it.
-
Within the <head> section of the PHP or SSI/shtml page where you want to embed
CornerStore, add the following two lines:
<script type="text/javascript" src="/cgi-bin/cornerstore.cgi?js"></script>
<link rel="stylesheet" type="text/css" media="all" href="/cgi-bin/cornerstore.cgi?css" /> -
If your page is a PHP page, then add the following line to it wherever
you want CornerStore's output to appear:
<?PHP virtual("/cgi-bin/cornerstore.cgi?encembed=yes&" . $_SERVER['QUERY_STRING']); ?>
If your server doesn't support the PHP virtual() function, use this line instead:
<?PHP require($_SERVER['DOCUMENT_ROOT'] . "/store/call_cs_embed.php"); ?>
Or, if your page is a plain HTML page with an extension of .htm or .html, rename its extension to .shtml and then add the following line to it wherever you want CornerStore's output to appear:
<!--#include virtual="/cgi-bin/cornerstore.cgi?encembed=yes&$QUERY_STRING" --> -
In your cornerstore_prefs.cgi file, set $PREF{here} = '/mypage.php' or
'/mypage.shtml', where the value is the URL (starting with a slash) to the
page within your website where you've embedded CornerStore.
Now visit www.yoursite.com/mypage.php (or shtml) and you'll see CornerStore in the page.
Embedding Method B: call cornerstore.cgi directly, and let it display your HTML template file:
If your server doesn't support the PHP/SSI/shtml that's necessary for Embedding Method A (above), then you can use an HTML template file instead. Your page will look exactly the same as with Method A; the difference is that Method B requires you to use the full URL to the CGI script itself, and not use the /store shortcut URL, since your server doesn't support any way to use that.
First you create an HTML file in whatever way you normally create web pages. Name this file encodable_app_template.html. In the <body> section of the file, wherever you want CornerStore's output to go, put the string %%encodable_app_output%%. Now upload this HTML file onto your website in its top level (i.e. not in a subfolder).
Now open your cornerstore_prefs.cgi file and find the $PREF{encodable_app_template_file} setting; set that to "%PREF{DOCROOT}/encodable_app_template.html";
Now visit www.yoursite.com/cgi-bin/cornerstore.cgi and it'll use your template file.
I get an Internal Server Error!
If this happens after you edit your cornerstore.cgi file, then the simple solution is: don't change cornerstore.cgi at all. Instead, only edit cornerstore_prefs.cgi, as explained above.
But if you haven't edited your cornerstore.cgi file and you still get an Internal Server Error, or if you absolutely need to edit cornerstore.cgi, then see the Internal Server Error page for solutions to this problem, which is most likely caused by an installation issue and not a problem with CornerStore itself.
[ Top – CS Homepage – Instructions – Download – Buy ]
I get an error saying "undefined function virtual" or "request execution failed."
The "undefined function virtual" error means your server doesn't support PHP's virtual() function. This is only a minor issue, and it is not a problem with CornerStore itself. It just means you need to use a different method for calling CornerStore from a shortcut URL. (See the shortcut FAQ item for more details and alternatives to the virtual() function, but read the rest of this FAQ item first.)
The "request execution failed" error most likely means that your cornerstore.cgi isn't installed quite right.
Either way, the first thing to do is get CornerStore itself installed and working: visit www.yoursite.com/cgi-bin/cornerstore.cgi and make sure that works. Only after that works properly should you try to get the shortcut URLs working (www.yoursite.com/store/ or www.yoursite.com/store/index.php or www.yoursite.com/store/index.shtml). If your cornerstore.cgi gives you an Internal Server Error, it's most likely a chmod/permissions problem, but see this page for full details on how to fix it.
[ Top – CS Homepage – Instructions – Download – Buy ]
Can you add feature XYZ to CornerStore?
Yes, we can usually add custom features to CornerStore; just contact us and ask.
[ Top – CS Homepage – Instructions – Download – Buy ]
How do I enable the image features (product thumbnails)?
First, you need to have at least ImageMagick or GD installed on your server. Then you need to try enabling the various $PREF{try_to_use_*} settings.
If you have ImageMagick installed, then perhaps the easiest way to get CornerStore's image features working is via the $PREF{try_to_use_convert_*} settings. Enable those, and that might be all it takes. Or, you might need to specify the full path to the "convert" command on your server, via the $PREF{convert_command} setting. If you're running a Windows server, you may run into a problem because Windows includes a built-in convert command which is a disk utility. So you'll either need to specify the full path to the convert.exe that's within the ImageMagick Program Files folder, or else rename that convert.exe to something else like imgconv.exe, then set $PREF{convert_command} = 'imgconv.exe'.
If you can't get the image features to work using ImageMagick's convert command, then you can try the more traditional method of using either the ImageMagick Perl module or the GD Perl module. These Perl modules must be explicitly installed on your server; they are NOT automatically installed just because you have ImageMagick itself or GD itself installed. They are also unrelated to whether you have ImageMagick or GD support in your PHP installation; CornerStore is not a PHP application so anything loaded into PHP is irrelevant. If you think that you have these Perl modules installed -- or your web host / server admin tells you that they are -- but CornerStore tells you that they aren't, then that means they really aren't. CornerStore gets its information directly from Perl itself, and if Perl tells CornerStore that the module is not installed, then it's not installed. The most common sources of confusion here are 1) incorrectly assuming that you automatically have the IM or GD Perl module just because you have IM or GD itself installed, and 2) having multiple Perl installations on the server and having some modules installed under one version of Perl but the script accessing the other, in which case you need to get your Perl situation straightened out and then direct CornerStore to use the correct one (by adjusting the first line in the script).
See also:
Test ImageMagick and GD Perl Modules (and the Convert Command)
Install ImageMagick On Mac OS X
[ Top – CS Homepage – Instructions – Download – Buy ]
How do I enable email notifications, or fix email-sending errors?
The short answer: once you specify a recipient address via the $PREF{webmaster_email_address} setting, mail-sending just works, on the vast majority of servers.
The long answer: for multiple Encodable web applications including CornerStore, the app will automatically try both SMTP and sendmail in order to send email. On most servers, one or both of those will work by default, so no further configuration is needed.
The default configuration is to use SMTP with the server set to "localhost" because that works on most servers. However, you may need to change that to the address of the SMTP server provided by your hosting company, or the address of the SMTP server provided by your ISP. As mentioned, if SMTP doesn't work, the local sendmail process will be tried. If you're having email problems, you may want to try setting the SMTP server to null (i.e. "") to force the use of sendmail, or setting the sendmail path to null to force the use of SMTP.
If you get an error like "Can't locate MIME/Lite.pm", this means your server is missing the MIME::Lite Perl module. Fortunately you can usually install this yourself on your website. Download the module (the latest version is probably fine, or v3.01_05 is known to work) and unzip it, then go into the directory lib/MIME/ and you'll see a file called Lite.pm. On your server, create the directory cgi-bin/perlmodules/MIME/ and upload the Lite.pm file into it. That's it!
If your SMTP server requires authentication, which it might if you get "relay" errors, then you'll also need to set the SMTP auth preferences. You'll need to specify the username and password for an email account on the server in question. On some servers, this requires installing an updated version of the MIME::Lite Perl module. MIME::Lite version 3.01_05 is known to handle SMTP auth correctly; see the previous paragraph for instrutions on how to install it.
To test whether email-sending is working properly, add the following lines to your prefs file:
$PREF{enable_email_test} = 'yes';
$PREF{email_test_recipient} = 'you@wherever.com';
$PREF{email_test_sender} = 'you@wherever.com';
Then open your browser and visit your installation of the application, and add "?do_email_test" on the end of the URL -- for example www.yoursite.com/cgi-bin/cornerstore.cgi?do_email_test. This will cause the script to send an email using your current email settings, and it'll include those settings in the email, so if and when you manage to get an email to go through, you'll be able to see which settings worked. For the email_test_recipient and sender addresses, you should use a known-good email account, like your personal email address.
Finally, in some cases you may need to check your spam folder, in case your email system uses overly-aggressive spam filtering which causes good emails to be flagged.
[ Top – CS Homepage – Instructions – Download – Buy ]
How do I set or reset my password?
How can I hide or password-protect certain features?
By default there is no password. And if you're using a login system like UserBase, then you won't need to set CornerStore's internal password. But if you aren't using a separate login system, then to create a password, you must generate a new hash for it, by going to http://yoursite.com/cgi-bin/cornerstore.cgi?newpw and entering your new password. Then take the resulting hash and enter it into one of the $PREF{admin_password_hash} or $PREF{member_password_hash} settings.
Whether you're using an external login system or CornerStore's own passwords, most features are admin-only by default (except of course browsing the store and viewing the shopping cart); to change that, find the list of groups_allowed_to PREFs and adjust them from 'admin' to whatever you wish, typically 'public', 'member', or some combination of those.
[ Top – CS Homepage – Instructions – Download – Buy ]
How do I integrate CornerStore with UserBase?
First install UserBase, then in your cornerstore_prefs.cgi file, enable $PREF{integrate_with_userbase}.
[ Top – CS Homepage – Instructions – Download – Buy ]
How do I integrate CornerStore with FileChucker?
You can integrate CornerStore with FileChucker, to sell products and services to your visitors based on the files they upload into FileChucker (or files that you yourself upload into FileChucker).
First install both apps onto your website. Then edit your filechucker_prefs.cgi file, and in PREFs Section 11, enable the $PREF{integrate_with_cornerstore} and $PREF{show_buy_column_in_filelist} options.
Now in your web browser, you just need to create an item in CornerStore, and then create a corresponding Buy Link in FileChucker.
For example, if you're a print shop and you sell prints of your customers' digital photos, you would go to CornerStore's Manage Items page, and create a new item named Photo Prints. On that page, in addition to setting the item name, description, etc, you would set these options:
Option 1 Type: custom text - long
Option 1 Required: yes
Option 1 Read-only: yes
You can also set additional options, but "Filename" must be Option 1.
Now go to your FileChucker Download page, and find the folder or file that you want to sell, and click its "options" link, then click the "Add A Buy Link" option. Enter your link text, for example "Buy Prints", and choose the Photo Prints item that you created; then click Save. You'll automatically be sent back to your FileChucker Download page, and you'll see the new "Buy Prints" link next to the folder/file you chose.
Note that you can create as many Buy Links as you wish, and when creating a Buy Link for a folder, you can choose whether the link is displayed for that folder itself, or for each file within that folder, so a single Buy Link can be used for a large number of items.
[ Top – CS Homepage – Instructions – Download – Buy ]
How do I change the currency in CornerStore?
First you'll need to log in to your PayPal account and specify your desired currency there. Then in your cornerstore_prefs.cgi file, adjust these two settings:
$PREF{currency_symbol_for_shopping_cart} = '$';
$PREF{currency_symbol_for_saleslog_pages} = '$';
Finally, search your prefs file for the string "\$" (without the quotes); you'll see it in a few different places. Replace that with your desired currency symbol (remove the backslash as well as the dollar sign).
[ Top – CS Homepage – Instructions – Download – Buy ]
How do I sell digital goods in CornerStore?
Set $PREF{hide_deliverable_file_links_and_fields} to 'no'. Then on your Manage Items page, when adding/editing an item, you'll see a field called "Deliverable file with path". Set this to the full server path to the file (image, song, ebook, etc) for the digital good that this item represents. When a customer buys the item, he'll receive a confirmation email containing a link to view his Order Details page within CornerStore, and that page will contain the link to download the file. The download link is not a direct file URL, but a special link containing the buyer's unique proof-of-purchase code; it looks like this:
And if you want to further protect your download links, you can set them to members-only access by installing UserBase or another login system, and then changing the $PREF{groups_allowed_to_view_their_own_orders} and $PREF{groups_allowed_to_view_download_page} settings from 'public' to 'member'. Then downloads will require not only the special URL with a valid proof-of-purchase code, but also that the buyer log in first.
[ Top – CS Homepage – Instructions – Download – Buy ]
Can I make CornerStore work with my existing login system?
UserBase is generally the best login system to use with CornerStore. However, as long as your server's PHP configuration is not too crippled, you can usually make CornerStore work with an existing PHP login system.
First you need to figure out how to make your PHP login system tell you the username of the logged-in user. This will be different for each different login system, but for the purposes of this guide let's assume that the following PHP code will get the username from your login system:
<?php
$username = get_the_username();
?>
Joomla users: according to the Joomla documentation, the following should work for you:
<?php
$username = '';
$user =& JFactory::getUser();
if(!$user->guest)
{
$username = $user->username;
}
?>
Once you've got the username, the next requirement is that you call the cornerstore.cgi script from your PHP page using the call_cs.php method as explained in the shortcut FAQ item. That will work on most servers, but unfortunately some hosting companies cripple their servers by disabling PHP's exec() function. If you're stuck on a server like that, you'll need to either use UserBase, or switch to a better hosting company.
The next step is to set some environment variables from your PHP $username variable; CornerStore will then be able to read those env vars. So your full PHP code should now look like this:
<?php
$username = get_the_username();
putenv("PHP_ENC_USERNAME=$username");
require($_SERVER['DOCUMENT_ROOT'] . "/call_cs.php");
?>
The last step is to configure CornerStore to use those environment variables. To do that, edit your cornerstore_prefs.cgi file and enable the following settings:
$PREF{integrate_with_existing_login_system} = 'yes';
$PREF{enable_username_from_php_session} = 'yes';
[ Top – CS Homepage – Instructions – Download – Buy ]
Does CornerStore work with iWeb, or other 3rd-party website editors?
CornerStore works fine on websites created with 3rd-party tools like iWeb, as long as the server itself is a standard kind of server supporting standard features (namely Perl CGI scripts and MySQL databases). Because CornerStore is a web application, not simply a web page, it's not created nor edited via iWeb, but it can be embedded into any of your iWeb pages, so that it appears within your own layout, and thus matches the style of the rest of your site. Similarly, you would not need to use iWeb to configure CornerStore, because all configuration is handled by simply editing the cornerstore_prefs.cgi file, which is a plain text file that can be edited in any text editor.
[ Top – CS Homepage – Instructions – Download – Buy ]
Does CornerStore work with Drupal?
Yes, CornerStore works fine on sites running Drupal. Just install CornerStore according to the normal installation instructions. You can then either use CornerStore directly, without going through your Drupal theme/layout, by using its /cgi-bin/cornerstore.cgi and/or /store/ URLs; or, you can embed CornerStore within one of your Drupal pages, by using the "PHP code" option in the "Text format" drop-down in Drupal's page editor, and inserting the PHP embed code into your page. (For the ?js and ?css lines, ideally you'd insert those into the <head> section of your page, but the Drupal editor doesn't appear to support that currently, so you can just include those lines within the page body/content area, just before the PHP code.)
[ Top – CS Homepage – Instructions – Download – Buy ]