Gallery2:Modules:zencart - Gallery Codex
Personal tools

Gallery2:Modules:zencart

From Gallery Codex

Zencart Integration Module
Integrates Gallery2 and Zencart 1.3.9
Author: Dayo Akanji
Download the module files here.
Visit the Support Site for enquiries and support requests.


Requirements

  • Gallery 2.3.1
  • Zencart 1.3.9
  • Both must use the same database
  • Zencart must be installed as a subdirectory of Gallery2

Description

The module allows users to organise their photographs and other multimedia files in Gallery2, a web-based photo album organiser, while offering them for sale through Zencart, a fully featured commercial grade e-commerce application. With this module in place, users can leverage both the most powerful, most flexible and most fully featured gallery application available in Gallery 2 and the most powerful, most flexible and most fully featured e-commerce application available in Zencart. This potent combination brings together the best of both worlds in which the imagination of the user is the only limit.

The module was originally developed for Zencart 1.2.7 as part of Google's 2005 Summer of Code by Michael Rodriguez-Torrent. Additional work by Chuck Redman to update it for Zencart 1.3.7. Updates for Zencart 1.3.7 finalised by Dayo Akanji (24/10/2007). Updated for Zencart 1.3.8 (11/01/2008) and then for 1.3.9 (16/06/2010) by Dayo Akanji. Further updates to address changes introduced with Zencart 1.3.9g (22/10/10) by Dayo Akanji. Updated for Zencart 1.3.9h (07/01/2011) by Dayo Akanji.

Features

  • Easy, painless, installation.
  • Return to previous Gallery2 page from any Zencart page
  • Items and albums from Gallery are automatically synchronised as products and categories in Zencart.
  • Set default options and pricing of Gallery products and use Zencart to customise individual items.
  • Comes with Gallery2 templates (Based on PGTheme Color Packs) that will also match most Gallery2 Themes or serve as a basis for customisation.

General Information

  • This module is designed for a situation where Zencart serves as a commerce backend to a Gallery2 installation. All browsing and interaction with images is done via Gallery2 and Zencart is there only to handle sales in the background. If you are looking for a situation where Gallery2 acts as a display tool for a Zencart store, this module is not for you.
  • To add Gallery items to Zencart, simply add items to your Gallery.
  • To change default pricing and options, click on "Zencart" in your Site Administration menu.
  • The Product Category specified as the 'root' category for Gallery2 images should NOT be the top 'Main' category in the Zencart store.
  • All Gallery2 items are automatically given an item type of "Product-Gallery". If this is changed to a different category, the Gallery2 connection will be broken.

Installation

Notes

  • Uninstall any versions of this module predating Version 3.0.0 first if you have one installed.
    (NOTE: You will lose your Zencart configuration for Gallery2 items after you do this.)
  • It is helpful to have the Rewrite Module active before installing this module.
  • Only actual data items (photos, movies etc) can be added to Zencart through this module and albums cannot be added.
    (NOTE: Default permissions have been structured so that visitors can only view Zencart from album pages. If you change this to show a link to add items, nothing will happen if the link is clicked.)

Step 1: Download Files

  1. Download the ZCG2 Module Files.
  2. Download the prepared Zencart package. (RECOMMENDED) or get the official version from the Zencart Site

Step 2: Install Zencart

  1. Upload and unpack the Zencart files (prepared or official) into your Gallery2 folder and rename it as you wish to call your online store (e.g. mynewstore).
    (NOTE: This is not the module and is just Zencart with the ZCG2 files needed on the Zencart side integrated. I.E. the actions from the "Step 4: Configure Zencart" section below have been done for you. You still need to download and place the ZCG2 files into Gallery2.)
  2. Launch your browser and navigate to the Zencart folder and follow the instructions to install it.
    (NOTE: Use the same database as Gallery2, but different a table prefix for the Zencart database.)
  3. Remove or rename the zc_install folder after installation for security.
    (NOTE: Zencart will not function until you do this.)

Step 3: Secure Zencart

  1. Edit all instances of "admin" in "gallery/mynewstore/admin/includes/configure.php" to a new admin folder name.
    You may wish to consider using numbers and a combination of upper and lower case letters.
    Change this section:
    define('DIR_WS_ADMIN', '/admin/');
    define('DIR_WS_CATALOG', '/');
    define('DIR_WS_HTTPS_ADMIN', '/admin/');
    define('DIR_WS_HTTPS_CATALOG', '/');
    And this section:
    define('DIR_FS_ADMIN', '/home/example.com/www/public/gallery/admin/');
    define('DIR_FS_CATALOG', '/home/example.com/www/public/gallery/mynewstore/');
    You will end up with something that looks like this:
    define('DIR_WS_ADMIN', '/mySecret99admin53area/');
    define('DIR_WS_CATALOG', '/');
    define('DIR_WS_HTTPS_ADMIN', '/mySecret99admin53area/');
    define('DIR_WS_HTTPS_CATALOG', '/');
    And:
    define('DIR_FS_ADMIN', '/home/example.com/www/public/gallery/mynewstore/mySecret99admin53area/');
    define('DIR_FS_CATALOG', '/home/example.com/www/public/gallery/mynewstore');
  2. Rename the actual "gallery2/mynewstore/admin/" directory on the server to match the settings made above.
    (NOTE: Keep the new folder name a closely guarded secret.)
  3. Read and apply the Zencart Tutorial on securing Zencart.

Step 4: Configure Zencart

Skip this Section if using the prepared Zencart fileset provided

  1. Upload the contents of the "zencart" folder from the ZCG2 Module Files package downloaded earlier to the mynewstore folder.
  2. Log in to Zencart as Admin at "example.com/gallery/mynewstore/mySecret99admin53area".
  3. Select "Tools" >> "Template Selection" and choose one of the Gallery2 Integration Templates provided. Default G2 integrated Templates are PGCharcoal or PGSnow
  4. Select "Catalog >> Categories/Items >> New Category" and create a new category called "ZCG2".

Step 5: Configure Gallery2

  1. Upload the "gallery2/modules/zencart" folder from the ZCG2 Module Files package downloaded earlier to your Gallery2 modules directory.
  2. In your Gallery2 Site Administration, click on "Plugins," find "Zencart" under the "Commerce" heading, and click "Install"
  3. After Installation, click "Configure"
  4. Enter the full server path to your Zencart installation. E.G. "/home/example.com/www/public/gallery/mynewstore/".
    (NOTE: You must enter the full server path and not a relative path. Some features will fail if a relative path is used)
  5. Click "Save"
  6. Enter the name of your Zencart admin folder.
    (NOTE: The module cannot be configured if you have not renamed the folder. You are also required to have deleted the Zencart installation folder)
  7. Click "Save"
  8. Select "ZCG2" from the drop down menu after the page refreashes.
  9. Click "Save"
  10. Activate the module.
  11. Refresh the page and click on the Zencart link under "Admin Options" to edit product details
  12. Edit permissions for the individual items as you wish. The module will have assigned permissions to non album items on activation.
    (NOTE: To prevent items being bought, you will have to disable them in Zencart as the module adds all data items in your gallery to Zencart. You can also add password protection as described under "Access Control" below)

Step 6: Adjust Zencart

  1. Replace "/mynewstore/includes/templates/pgxxx/images/logo.gif" with one for your site.
  2. Replace the line "Designed by Dayo Akanji" (and similar) with a suitable taglines for your site
  3. You can take a copy of the template folder (/mynewstore/includes/templates/pgxxx) and modify stylesheet.css to taste. If you do this, also create copies of "/mynewstore/includes/languages/pgxxx" and "/mynewstore/includes/languages/english/pgxxx" with the same name and case structure as the copy. Also edit "/mynewstore/includes/templates/pgxxx/template_info.php".
    (NOTE: Creating a custom template in this manner may result in updates to the module not being applied to your insallation. Similarly, if you edit in situ, updates may overwrite your changes)


Access Control

Password Protect Albums

  • To password protect an album...
  1. Open /mynewstore/includes/templates/pgxxx/common/tpl_check_albums.php.
  2. Edit "#_01" etc in 'case "#_01"' etc to reflect the cPath name of albums to be restricted.
  3. The cPath value can be found in the address bar after navigating to the album within Zencart eg "...&cPath=1_23".
  4. Edit each instance of $myusername, $mypassword, $areaname & $access_details as required.

Password Protect Individual Items

  • To password protect an item...
  1. Open /mynewstore/includes/templates/pgxxx/common/tpl_check_items.php.
  2. Edit "#_01" etc in 'case "#_01"' etc to reflect the products_id name of items to be restricted.
  3. The products_id value can be found in the address bar iafter navigating to the item within Zencart eg "...&products_id=123".
  4. Edit each instance of $myusername, $mypassword, $areaname & $access_details as required.


Troubleshooting

Uninstall

  1. In your Gallery2 Site Administration, click on "Modules," find "Zencart" under the "Commerce" heading, and click "deactivate."
  2. Click "uninstall" next to "Zencart" in the module list.
  3. Optionally, delete the module files that you uploaded when installing.