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

Download the prepared Zencart package. (RECOMMENDED) or get the official version from the Zencart Site

Step 2: Install Zencart

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.)

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.)

Remove or rename the zc_install folder after installation for security.(NOTE: Zencart will not function until you do this.)

Step 3: Secure Zencart

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:

Step 5: Configure Gallery2

In your Gallery2 Site Administration, click on "Plugins," find "Zencart" under the "Commerce" heading, and click "Install"

After Installation, click "Configure"

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)

Click "Save"

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)

Click "Save"

Select "ZCG2" from the drop down menu after the page refreashes.

Click "Save"

Activate the module.

Refresh the page and click on the Zencart link under "Admin Options" to edit product details

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

Replace "/mynewstore/includes/templates/pgxxx/images/logo.gif" with one for your site.

Replace the line "Designed by Dayo Akanji" (and similar) with a suitable taglines for your site

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...

Open /mynewstore/includes/templates/pgxxx/common/tpl_check_albums.php.

Edit "#_01" etc in 'case "#_01"' etc to reflect the cPath name of albums to be restricted.

The cPath value can be found in the address bar after navigating to the album within Zencart eg "...&cPath=1_23".

Troubleshooting

Problem

Solution

I get a host of errors after trying to add images to my gallery with the module activated.

If this is happening with an empty gallery and those are the first images being added, you are probably using a version before Version 3.1.0. If this is the case, upgrade to current version and try again. If the problem persists, deactivate or uninstall the module in Site Admin, add a couple of images to the gallery and then reactivate the module.

Thumbnails for Gallery products are not displayed in Zencart in some instances.

This may be caused by a limitation in Zencart which restricts the length of the thumbnail URL. As a result, if you are not using URL rewrite or if your Zencart and Gallery2 directories are particularly far away, the URLs may be too long and thumbnails will not be displayed. To correct this, try activating URL rewrite. Alternatively, or if URL rewrite does not solve the problem, do the following:

Deactivate and reactivate the module to update the thumbnails in Zencart.

Category thumbnails in Zencart are squashed or not the right size.

Set your album thumbnails and your Zencart subcategory images to the same dimensions.

I would like to offer an limited quantity of items.

Go to Gallery->Modules->Classes->GalleryZenCart.class and edit this line: "$data = array('products_quantity' => '99999.0',". Any new items you add should be imported into Zencart with the new quantity you set. To change existing items, run this query on your Zencart database (where "PREFIX_" is your Zencart table prefix, generally "zen_" & MY_QTY is the quantity you wish to assign as default): UPDATE `PREFIX_products` SET products_quantity = 'MY_QTY' where products_id = '*'.

The order list only shows me the item title. Some of my items have the same title and I'd like to know where to find the right one.

Please give your items unique titles. Every store has to have unique id numbers for items and since you are running a store, you have to do the same or things will descend into chaos. Note that a unque ID is appended to the item in Zencart though.

I tried to change my integration category from Top to a subcategory and it moved all my categories, even non-Gallery ones.

Change back to Top, deactivate, uninstall, and reinstall the module. Configure with your new category and reactivate the module.

I deactivated the module and deleted the integration category in Zencart and now I can't reactivate the module to change it.

Uninstall the module, reinstall, and configure with your new category choice. Delete the integration category only after you have selected a new one or have uninstalled the module.

I want to set pricing per-item, offer a sale on a item, remove an option from an item etc.

Go to your Zencart administration and edit the item as you would any other product. All custom pricing, options, and values you apply will remain until you uninstall the module. Please note that any custom quantities will be reset if the module is deactivated and reactivated.

I have general or synchronization problems.

Deactivating and reactivating the module in Gallery will resynchronise your entire Gallery with their Zencart Items and should cure any synchronization problems that may have occurred.