Zen Cart custom software development, Zen Cart modules, Zen Cart Expert eCommerce with Zen Cart!

Zen Cart Define Page Anywhere

Define Page Anywhere


A Zen Cart™ mod which allows you to easily insert define pages in a variety of places, and thus reuse common blocks of text.

Donate: This is free software. Show your appreciation by supporting my efforts. Donate

Relevance: Zen Cart™ 1.5.5 and above

Current Version: 1.0 (version history)

Support Thread: Define Page Anywhere Support Thread

Cost: Free, but donation appreciated

Installed Cost: $200.00 Buy Professional Installation by That Software Guy

Installation Difficulty: Easy-Moderate

Installation Instructions: click here

Location: Zen Cart Plugins, under Template Alterations

Download: Define Page Anywhere in Zen Cart Plugins

Related: Adding Boilerplate Text to the Product Description

Overview:

This plugin addresses the following issues:
  • Define pages are not available for all Zen Cart pages
  • While it is possible to edit a category in admin and add text to display on that category's page, this text is not shown automatically on subcategories of that category.
  • Per-manufacturer page content cannot easily be added.
  • While it is possible to programmatically alter the product_info page to show various messages, making code changes for messages that may be short-lived is inefficient.

After installing this plugin, you can create define files and have them automatically displayed in cases like the following:
  • Display on pages which do not have a define_page by default in Zen Cart, such as the checkout_shipping page.
  • Display per-manufacturer text when the manufacturer index page is displayed (e.g. index.php?main_page=index&manufacturers_id=4).
  • Display per category messaging on all subcategories of a specified category (e.g. create define_category_3.php and have it display on index.php?main_page=index&cPath=3 and index.php?main_page=index&cPath=3_12).
  • Display specific messages on all subcategories of a specified category (e.g. create define_category_3.php and have it display on index.php?main_page=index&cPath=3 and index.php?main_page=index&cPath=3_12).
  • Display field-dependent information on the product info page (e.g. display a particular message when the quantity in stock is less than 5).


Installation Instructions:

  1. Back up everything! Try this in a test environment prior to installing it on a live shop.
  2. Go to the folder "catalog" and change the directory name "YOUR_TEMPLATE" to the name of your template.
  3. Upload the files in "catalog" to your cart's root directory.
  4. Edit includes/templates/YOUR_TEMPLATE/common/tpl_main_page.php Right before the template code is pulled in
    require($body_pre);
    
    add
     include 'define_page_anywhere.php';
    
    So now this block looks something like:
     include 'define_page_anywhere.php';
     require($body_code); ?> 
    
  5. Add define pages for any page you wish, by creating a file in the folder includes/languages/english/html_includes using the naming convention define_NAME-OF-PAGE.php For example:
    define_checkout_shipping.php
    define_checkout_payment.php
    define_checkout_confirmation.php
    define_advanced_search_result.php
    define_unsubscribe.php 
    define_account.php 
    define_account_newsletters.php 
    define_account_edit.php 
    define_address_book.php 
    
    Note: Follow the same pattern for any custom pages you have created that don't have their own define pages.
  6. Add define pages for specific categories and any subcategories they contain: If someone is on your site viewing a listing page like
    index.php?main_page=index&cPath=3_12_27
    then the following define pages will be displayed if they exist:
    define_category_3.php
    define_category_12.php
    define_category_27.php
    
  7. You may add define pages for the product_info page based on any variable retrieved in the product_info query, such as manufacturers_id or products_quantity. See the commented out examples in define_page_anywhere.php.

Installation Issues:

  1. This plugin assumes you are running 1.5.7, which has a built-in shopping cart page define file. If you are running a lower version, remove 'shopping_cart' from the list at the top of define_page_anywhere.php.
  2. It is unknown whether this plugin is interoperable with SEO rewriting.

Major Versions

  • 1.0 01/01/2022 - First Release