Gallery:Modules:zencart

来自站长百科
跳转至: 导航、​ 搜索

Zen Cart Integration Module[ ]

Integrates Gallery2 and Zen Cart
Author: Dayo Akanji
Current version: 3.2.1c for Gallery2.1 to Gallery2.2.x
Download the full module files here.
Download the upgrade from 3.x.x here.
Download ZenCart 1.3.8a from zencart.com.
Visit the Discussion Forum for support.


Requirements[ ]

  • Gallery2.2.x
  • Zen Cart 1.3.8a
  • Both must use the same database (Zen limitation, see ZenCartAbstraction.class:138 for details).


Description[ ]

The Gallery2/Zen Cart integration module allows users to organize their photos and other multimedia files in Gallery2, a web-based photo album organizer, while simultaneously offering them for sale through Zen Cart, a powerful open source e-commerce application. This module was developed as for Zen Cart 1.2.7 as part of Google's 2005 Summer of Code by Michael Rodriguez-Torrent <mike@themikecam.com>. Additional work by Chuck Redman to update it for Zen Cart 1.3.7.


Features[ ]

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


Installation[ ]

Notes[ ]

  • Download the module files.
  • Uninstall any versions of the module predating Version 3.0.0 in Gallery2 Admin first if you have one installed.
    • You will lose your Zen Cart configuration 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 the ZC cart through this module. Albums cannot be added.

First, Install ZenCart Software[ ]

  1. Download ZenCart 1.3.8a from zencart.com.
  2. Unpack the file into your Gallery2 folder and rename it as you wish to call your online store. This will allow you to have a directory structure such as wwww.yoursite.com/gallery/store.
  3. Launch your browser and navigate to the zencart folder and follow the instructions to install it. It appears most convenient to use the same database as Gallery2.
  4. Log into your new Zen Cart installation as Admin and create a new category in Zen Cart in which you would like your Gallery items to be put. (e.g "Pictures") by selecting Catalog >> Categories/Product >> New Category.

Then, Install Module Files in ZenCart[ ]

  1. Upload the files in zencart/ from this module to your Zen Cart directory.
  2. Log in to Zen Cart as Admin (www.yoursite.com/gallery/store/admin)
  3. Select "Tools" >> "Template Selection" and choose one of the Gallery2 Integration Templates provided. You can take a copy of the template folder (/store/includes/templates/pgxxx) and modify stylesheet.css to taste. If you do this, also create copies of "/store/includes/languages/pgxxx" and "/store/includes/languages/english/pgxxx" with the same name and case structure as the copy. Also edit "/store/includes/templates/pgxxx/template_info.php". Note that 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. To minimise the possible effect of updates on in situ customisations, use the update patches provided.
  4. Replace "/store/includes/templates/pgxxx/images/logo.gif" with one for your site.
  5. Open the files in "/store/includes/languages/pgxxx" and "/store/includes/languages/english/pgxxx" as well as "/store/includes/languages/english.php" and change references such as "Photography by Dayo Akanji" to ones applicable to your site.

Then, In Gallery2[ ]

  1. Upload the module files in gallery2/ to your Gallery2 modules directory.
  2. In your Gallery2 Site Administration, click on "Plugins," find "Zen Cart" under the "Commerce" heading, and click "Install"
  3. After Installation, click "Configure."
  4. Enter the full server path to your Zen Cart installation (E.G. /home/you/public_html/Gallery2/zencart/). If you installed under Gallery2 as advised, just enter "./FolderName" (without quote marks)
  5. Select the Category you created in Zen Cart earlier (e.g "Pictures") from the drop down menu.
  6. Click "activate" next to the Zen Cart listing on the module page.
  7. Refresh the page and click on the Zen Cart link under "Admin Options" to edit product details
  8. Edit permissions for the individual items as you wish. The module will have assigned permissions to non album items on activation. Note though that to prevent items being bought, you will have to disable them in Zen Cart as the module adds all data items in your gallery to Zen Cart.

Finally[ ]

  1. Tweak the site settings in Zen Cart.
  2. Read and apply the Zencart Tutorial on securing your Zen Cart installation.


General Notes[ ]

  • To add Gallery items to Zen Cart, simply add items to your Gallery.
  • To change default pricing and options, click on "Zen Cart" 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. No, I don't know why; feel free to experiment.
  • All Gallery2 items are automatically given a product type of "Product-Gallery". If this is changed to a different category e.g. Product-Free or Product-Free Shipping, the Gallery connection will be broken.
  • The Gallery2 Bridge will coexist happily with the Zen Cart Image Handler and Lightbox Add On, but does NOT interact with them. i.e. they work with products added in the normal way in Zen Cart while the Gallery2 addon works with the images added in Gallery2.


Access Control[ ]

Password Protect Albums[ ]

  • To password protect an album...
  1. Open /store/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 /store/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[ ]

Known issues:[ ]

  • I get a host of errors after trying to add images to my gallery with the module activated.
    • Solution: 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 Zen Cart in some instances.
    • Solution: This may be caused by a limitation in Zen Cart which restricts the length of the thumbnail URL. As a result, if you are not using URL rewrite or if your Zen Cart 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:
  1. Run this query on your Zen Cart database (where "PREFIX_" is your Zen Cart table prefix, generally "zen_"): ALTER TABLE `PREFIX_products` CHANGE `products_image` `products_image` VARCHAR (255)
  2. Check the "Enable long thumbnail URLs" box in the Zen Cart module options in Gallery2.
  3. Deactivate and reactivate the module to update the thumbnails in Zen Cart.
  4. The above ALTER may also be needed for the categories_image column of categories table.
  • Category thumbnails in Zen Cart are squashed or not the right size.
    • Solution: Set your album thumbnails and your Zen Cart subcategory images to the same dimensions.
  • Products are added with a set quantity (999999999) -- I would like to offer an unlimited quantity (or a more limited quantity).
    • Solution: Unfortunately, Zen Cart has no facility to set an unlimited quantity. To reset the quantity of all Gallery products to this number, simply deactivate and reactivate the module in Gallery2. If you wish to set a more limited quantity for a particular item, edit the item in Zen Cart (see below). If you deactivate and reactivate the module, however, the quantity will be reset.
  • 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.
    • Solution: 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 Zen Cart though.
  • I tried to change my integration category from Top to a subcategory and it moved all my categories, even non-Gallery ones.
    • Solution: 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 Zen Cart and now I can't reactivate the module to change it.
    • Solution: 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.
    • Solution: Go to your Zen Cart 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
    • Solution: Deactivating and reactivating the module in Gallery will resynchronize your entire Gallery with their Zen Cart Items and should cure any synchronization problems that have occurred for any reason (please report bugs!).
  • Things are getting really ugly
    • Solution:
  1. unistall the module in Gallery2
  2. delete the Zen Cart category that held the Gallery2 products
  3. using your favourite database management software such as phpMyAdmin, delete all entries beginning with "zc_" (or whatever your Zen Cart Table Prefix is) in your Gallery2 ExternalIdMap table.
  4. Finally, reinstall the module in Gallery2.


Uninstall[ ]

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