/********************************************************************************* * Copyright (c) 2009, Darrell F Dieringer * www.electricdarrell.com * * This file is part of dfdZazzleStore. * * dfdZazzleStore is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * dfdZazzleStore is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with dfdZazzleStore. If not, see . * * dfdZazzleStore is based on code released in * Zazzle Store Builder 1.0.2 - a Zazzle.com product publishing tool */ README_WORDPRESS.txt For a working production example (as a Wordpress plugin), see... http://www.artofdancemadison.com/shop/ HOW TO INSTALL "dfdZazzleStore" AS A WORDPRESS PLUGIN... - Download the dfdZazzleStore-xxxx.zip release - Extract contents of the zip archive to a temporary location on your computer - change directories to that temporary location - CHANGE IMPORTANT SETTINGS IN "dfdZazzleStore/include/_defaultconfig.php" - PRESERVE YOUR EXISTING STYLE SHEET FROM ANY PREVIOUS "dfdZazzleStore" INSTALLATION. - upload the folder "dfdZazzleStore" to your the Wordpress plugins directory (most likely in "/wp-content/plugins") on your web server - if using caching, see "CACHING" in README.txt - Login to your Wordpress admin control panel and activate the "DFD Zazzle Store" plugin - You will ALMOST CERTAINLY need to edit the stylesheet, found in "/css/z_zazzlestore.css" See "STYLE SHEET" in "/README.txt". HOW TO USE THE "dfdZazzleStore" WORDPRESS PLUGIN... You can use the "dfdZazzleStore" Wordpress plugin in ONE of THREE possible ways. (1) INLINE METHOD (2) TEMPLATE FUNCTION METHOD (3) PSEUDO STAND ALONE METHOD The first TWO make use of specific Wordpress functionality, including custom content filters to expand configured ZSTORE_GRID sections (keep reading) into Zazzle Store Grids. The THIRD essentially amounts to a regular stand alone installation (see "/README_STANDALONE.txt") while still using the Wordpress directory hierarchy for storing the scripts needed by the plugin, AND using one (or more) Wordpress template file for your theme as the calling script. Keep reading for a description of each method, how to configure it, its advantages, and its disadvantages. (1) INLINE METHOD... Display store grid(s) - potentially multiple - in the same area that page/post content on your site would normally display (henceforth, "inline") From any page/post on your blog (or a newly-created page/post), you must include a section similar to the following example (henceforth a ZSTORE_GRID section) in the page/post content anywhere you would like a Zazzle Store Grid to appear. It will appear relative to other content you write for that page/post. Comment lines start with the characters "//" Copy and paste everything between the "START COPYING" and "END COPYING" lines... --START COPYING ON THE NEXT LINE-- GRID_HIDE_STORE = false GRID_EXPAND_INLINE = true GRID_CSS_ID = an_OPTIONAL_id_to_uniquely_identify_this_store_grid_for_css_purposes GRID_HEADING = Your OPTIONAL Heading Goes Here GRID_DESCRIPTION_START Your OPTIONAL description goes here. It can contain multiple lines and some simple html formatting. It could contain more advanced html, nested div's, etc, as well, though this has not been thoroughly tested. It can be as long as you would like. This content WILL pass through the blog's auto formatting mechanism, which changes text surrounded by whitespace into paragraph sections, translates quote characters, and other nice things. GRID_DESCRIPTION_END GRID_CONFIGURATION_VARS_START fCacheEnabled = false // username (on zazzle.com) of store you want to display (probably yours) szContributorHandle = artofdance // your associate/referral ID provided by Zazzle (leave blank to use the author's) // the AssociateID determines to whom any referrals are credited. szAssociateID = '' // if true, about %5 of the time your store will use the author's AssociateID // Thank you for supporting my development efforts! // if false, your store will only include your AssociateID (configured above or in include/_defaultconfig.php) fSupportAuthor = true //default is false // if true, clicking on item in store will open item in a new window (target="_blank") fOpenLinksInNewWindow = true fShowByLine = false fShowPagination = true fShowSorting = true fShowProductTitle = true fShowProductPrice = false fShowProductDescription = false fShowZazzleLogo = true // if true, system honors "nGridDescriptionWidth", "nGridWidth", "nGridCellSpacing", and "nGridLeftPadding" // if false, those layout parameters are controlled by the stylesheet // "nGridDescriptionWidth", "nGridWidth" support precise pixel measurements, -1 (for // "use all available width"), and percentages. (Be advised, percentages may be problematic // for browser compatibility.) The others require pixel measurements. fEnableGridWidthStyles = true //nGridDescriptionWidth = 550 //width of description above store grid (in pixels) nGridDescriptionWidth = 80% //width of description above store grid (as a percentage) nGridWidth = -1 //width of store grid nGridCellSpacing = 10 //space between images in store grid nGridLeftPadding = 20 //padding space on left side of entire grid of images nGridCellSize = 113 //size of images in store grid nShowHowMany = 12 //number of items to show on one page of store grid szGridCellBgColor = ffffff //background color of images in this store grid (hex color code w/o #-sign) // id number for a category in store belonging to "szContributorHandle" (optional) szProductLineID = 196390417564125825 GRID_CONFIGURATION_VARS_END --END COPYING ON THE PREVIOUS LINE-- Advantages - very little work on your part to display a store grid - easy to edit (via Wordpress editing facilities for pages/posts) - easy to add additional store grids (just copy and paste, then change the description and configuration vars for each new ZSTORE_GRID section). - if using multiple grids, additional text, descriptions, and other page/post content can be displayed between each grid just by writing in the normal fashion. - displaying a Zazzle Store Grid can be disabled by setting GRID_HIDE_STORE=true in the desired ZSTORE_GRID section. Disadvantages - The page/post display area on your blog may be limited by left-side, right-side, or both-side columns. This means less available width for displaying store grids. (2) TEMPLATE FUNCTION METHOD... Edit a Wordpress theme template file (the file that will be responsible for displaying the page/post containing the ZSTORE_GRID sections) to call the template function (see "Example Function Calls", below). SUGGESTIONS: The exact template file to edit MAY BE DIFFERENT depending on the Wordpress theme you are using. The following are likely candidates: - If you want your store to appear on a PAGE, you MAY need to edit the file "page.php" for the theme you are using. - If you want your store to appear on a POST, you MAY need to edit the file "single.php" for the theme you are using. - If you want your store to appear on the home page of your blog, you MAY need to edit "home.php" or "index.php" or perhaps even "page.php" or "archive.php" all depending on how your theme is designed. In the working production example (see very top of this readme under the license), I placed the template function-call after the Wordpress Loop, above potential comments (which are disabled for the page on which my Zazzle Store Grids appear) and above the footer. The Wordpress Loop is the part of the code in Wordpress template files responsible for displaying page/post content retrieved from the blog's underlying database. The beginning of the Wordpress Loop can be identified (in many templates I have seen) with the following line of code... if ( have_posts() ): while ( have_posts() ): the_post() Determine where the Wordpress Loop ends (look for an "endif" that corresponds to the nesting level of the "if" that starts the loop). You should place the function call to the template function (see examples below) SOME PLACE AFTER the Wordpress Loop (taking into account open
tags and other content that will be generated by that template file). IT MAY BE EASIER FOR YOU TO LOOK FOR "get_footer()" (which template files MAY use for displaying a footer for your theme). Then, place the function call to the template function at some point above that line. You will need to take care in doing this, as YOU ARE CHANGING THE LAYOUT OF YOUR SITE. Make certain your Zazzle Store Grid will appear properly nested inside of any appropriate
sections, or outside all
sections (if that makes sense for your Wordpress theme). (see "LIMITATIONS" in "/README.txt") Create ZSTORE_GRID sections as you would for the INLINE METHOD (described above). YOU MUST SET "GRID_EXPAND_INLINE=false" IN EACH "ZSTORE_GRID" SECTION. Advantages - use of any part of your site layout for displaying store grid(s) (does not need to be restricted to the part of the layout in which page/post content is displayed). - include absolutely anything else along with, above, below, floating over, etc your store grid(s). You are limited by your creativity and skills. - still uses the same mechanism for storing ZSTORE_GRID information (directly in page/post) so it is still easy to edit or add more ZSTORE_GRID sections. - the examples (below) show how you might restrict access to only logged-in users (perhaps useful for editing ZSTORE_GRID sections on a production system w/o worrying about non-logged-in users being able to see the Zazzle Store yet). - the examples (below) show how you would be able to conditionally enable or disable store visibility based on a flag (the first parameter). To fully implement this conditional enabling/disabling, YOU MUST PASS EITHER true OR false AS DETERMINED BY SOME OTHER MECHANISM THAT YOU DESIGN YOURSELF. The underlying code simply supports being told whether to be "on" or "off" Disadvantages - with more flexibility comes more room for confusion and error - requires being brave enough to edit your template files (it is not that difficult) - does not display inline with other content that you may write between your ZSTORE_GRID sections, but instead is displayed with only the relative order of the ZSTORE_GRID sections intact (most likely after the Wordpress loop). - content written between ZSTORE_GRID sections will appear separate from the resulting Zazzle Store Grids. Example function calls... In these examples, the function "is_user_logged_in()" is a Wordpress- provided function that returns true/false based on whether the person visiting the site is a logged-in user. FEEL FREE TO USE ANY OTHER CRITERIA YOU WANT (or none at all). ... or ... //allow only logged-in users to see the store //(also displays default warning message about store being hidden) DFDzstore_ShowZazzleGrids( false ); //store is NOT visible to all visitors is_user_logged_in() ); //if true, current site visitor CAN see the store anyway ... or ... //allow only logged-in users to see the store //(also displays a CUSTOM warning message about store being hidden) DFDzstore_ShowZazzleGrids( false ); //store is NOT visible to all visitors is_user_logged_in(), //if true, current site visitor CAN see the store anyway true, //show custom warning message to visitors who CAN see the store "Only logged-in visitors can see the store" ); //custom message ... or ... //allow only logged-in users to see the store //(does NOT display any warning message about store being hidden) DFDzstore_ShowZazzleGrids( false ); //store is NOT visible to all visitors is_user_logged_in(), //if true, current site visitor CAN see the store anyway false ); //do NOT show warning message to visitors who CAN see the store Make sure you wrap the function call (and comments) between "" if necessary (see the first example above). Those "tags" tell the web server to execute the PHP code in those lines (vs returning those lines as text). See "/sample_index.php" for a small example. It is wise to verify that the function exists - "if( function_exists(...))" - since disabling the "dfdZazzleStore" plugin in your Wordpress admin control panel would make the function no longer exist as far as Wordpress is concerned. See "LIMITATIONS" in "README.txt" for other issues regarding disabling the "dfdZazzleStore" plugin. In the above examples, when a warning message is displayed, it appears ALONG WITH THE STORE, visible to the person ACTUALLY VIEWING THE STORE. Absolutely no store information is visible to people who CANNOT see the store, including the warning message. In such a case, the warning message may be useful as a reminder to the person editing the ZSTORE_GRID sections to re-activate the store for everyone when he/she is done.. Read comments above the function "DFDzstore_ShowZazzleGrids()" in "/_zazzlestore.php" for additional information. (3) PSEUDO STAND ALONE METHOD... If the above two methods sound too complicated, and if you are comfortable copying/pasting/modifying existing code to meet your needs... - INSTALL "dfdZazzleStore" AS DESCRIBED ABOVE (for Wordpress installations) - read "/README_STANDALONE.txt" - see "/include/_standalone.php" - MAKE SURE YOU READ ALL OF THE CODE COMMENTS IN "_standalone.php". - YOU WILL STILL NEED TO EDIT A TEMPLATE FILE FOR YOUR WORDPRESS THEME, but you will NOT need to define any ZSTORE_GRID sections in any page/post on your site. That is the primary difference between Method 2 (above) and Method 3 (here). Advantages - use of any part of your site layout for displaying store grid(s) (does not need to be restricted to the part of the layout in which page/post content is displayed). Disadvantages - you still must edit a template file - see "(2) TEMPLATE FUNCTION METHOD" above - store configuration will appear in a separate file that must must be edited in order to change anything. - less easy to edit store configuration. WHAT OTHER "GRID_CONIGURATION_VARS" ARE AVAILABLE... See "GRID_CONFIGURATION_VARS" in /README.txt CONTACT THE AUTHOR http://www.electricdarrell.com/