Featured Products CE v3.1 (Phoenix Cart)
--------------------------------------

Compatibility: Phoenix Cart 1.1.0.0+
Reviewed against Phoenix Cart 1.1.0.7. Syntax and isolated regression checks performed with PHP 8.5.1; these checks do not constitute full storefront and database testing.
For earlier Phoenix Cart versions, use the corresponding Featured Products release from versions 2.0.0-2.3.11.

Adapted and maintained for Phoenix Cart by @raiwa.
Original addon by DunWeb Designs.

INSTALLATION INSTRUCTIONS
=========================

WHAT IS IT?

Featured Products lets you select products in the administration area and display them on your store's home page, category pages and in an optional sidebar box.

The home-page module displays a random selection of active featured products, up to the configured limit. The category module displays featured products from the current category and, optionally, its subcategories. The sidebar box displays one featured product.

Modules remain hidden when no matching products are available. You can optionally set an expiry date for each featured entry.

FRESH INSTALLATION

Installation normally takes about 5-10 minutes and involves copying the addon files and configuring the modules. No manual changes to core files are required.

If Featured Products is already installed, follow the separately supplied upgrade instructions instead. Upgrading replaces existing addon files, so preserve any customizations before copying them.

Database changes
----------------

No manual database changes are required for a fresh installation. Installing any one of the three modules creates the featured table, the expiry hook and a unique index that prevents multiple featured entries for the same product.

All three modules share the same featured table. Before removing a module, leave its "Delete auto created tables on module Remove" setting at "False" to preserve your entries. Setting it to "True" deletes the shared table and the expiry hook, affecting all Featured Products modules. Only use this setting when you intend to remove all featured data.

For existing installations, copying files alone does not add the unique index: a module's install() function must run. Follow the separate upgrade instructions. If installation reports duplicate product entries, review and resolve those entries before retrying. The installer does not delete duplicates automatically.

Step 1: Back up your store
-------------------------

Back up both your store files and database before installation.

Step 2: Copy the files
---------------------

Upload the contents of the supplied catalog folder to your store's root directory, preserving the directory structure. If your administration directory has been renamed, copy the contents of the supplied admin folder into that directory.

For a fresh installation, these are new addon files and do not replace core files. If files with the same names already exist, check whether you have an earlier installation or customizations before overwriting them.

Step 3: Install the modules
--------------------------

In the administration area's module management, install at least one of these Featured Products modules:

 - Home-page content: content/index (cm_i_featured_products)
 - Category-page content: content/index_nested (cm_in_featured_products)
 - Sidebar box: boxes (bm_featured)

You may install any combination of these modules. Configure their display settings and enable or disable them as needed.

Step 4: Check your template
--------------------------

Check your selected template under:

Admin > Configuration > My Store > Template Selection

The addon supplies its featured-products page template under "override". If you use another template, copy:

  templates/override/includes/pages/featured_products.php

to:

  templates/YOUR_SELECTED_TEMPLATE/includes/pages/featured_products.php

Replace YOUR_SELECTED_TEMPLATE with the actual directory name of your selected template. No separate featuredProducts.php siteWide hook needs to be copied.

Step 5: Add featured products
-----------------------------

 - Go to Admin > Catalog > Featured Products.
 - Click "New featured product".
 - Optionally enter a product name or model and click "Search" to filter the product selection list.
 - Select a product.
 - Optionally enter an expiry date. Leave it empty for no expiry.
 - Click "Save" to return to the Featured Products list.

You can activate or deactivate entries from the list. Products that are already featured are excluded from the selection list. If no eligible products match your search, a warning is displayed.

Expired entries are automatically set to inactive when the storefront next processes a request after the expiry time. An expiry date is stored at the start of that day (00:00:00).

CHANGELOG
=========

Version 3.1
 - Matched core Specials action validation for inserting and updating featured entries.
 - Fixed the "Specials Only" setting in both content modules.
 - Prevented product descriptions from carrying over to subsequent cards and corrected link markup.
 - Removed duplicated expiry-date processing in the admin update action.
 - Added duplicate-entry protection that preserves existing settings.
 - Added a unique products_id index and checks to upgrade existing indexes in all three module installers.
 - Fixed empty search results and added warning messages in English, German and Spanish.
 - Reviewed against Phoenix Cart 1.1.0.7; syntax and isolated regression checks performed with PHP 8.5.1.

Version 3.0
 - Updated for Phoenix 1.1.0.0+ and Bootstrap 5
 - Tested with Phoenix 1.1.0.1 and PHP 8.3
 
Version 2.3.11
 - Removed SMALL_IMAGE_WIDTH and SMALL_IMAGE_HEIGHT in admin infobox for Phoenix 1.0.9.8+ compatibility
 - Tested with Phoenix 1.0.9.9 and PHP 8.3
 
Version 2.3.10
 - Updated $card['extra'] to array in templates for Phoenix 1.0.9.5 compatibility
 - Tested with Phoenix 1.0.9.7 and PHP 8.3
 
Version 2.3.9
 - Updated template width class to match Phoenix 1.0.9.4 core
 - Tested with Phoenix 1.0.9.4 and PHP 8.3
 
Version 2.3.8
 - Fixed search query for special characters in Product Title or Model. Thanks to @14Steve14 for the report
 - Tested with Phoenix 1.0.9.3 and PHP 8.3
 
Version 2.3.7
 - Updated legacy oscTemplate functions to Template functions.
 - Tested with Phoenix 1.0.9.1 and PHP 8.2
 
Version 2.3.6
 - Updated expiry date input to HTML date field and selector.
 - Fixed index nested module to show only featured products.
 - Tested with Phoenix 1.0.8.21 and PHP 8.2
 
Version 2.3.5
 - Removed obsolete search_featured.php link in search button. Thanks to @mhsuffolk for the report.
 - Changed min Phoenix version to 1.0.8.7. Thanks to @mhsuffolk for the report.

Version 2.3.4
 - Updated queries in index module and featured page to match core coding and support not showing buy button for products with attributes.

Version 2.3.3
 - Updated deprecated tep_cfg_ functions
 - Renamed admin box module to catalog_featured.php

Version 2.3.2
 - Fixed wrong configuration constants of the index nested module.

Version 2.3.1
 - Fixed error in SQL query of the index nested module. Thanks to @artfulweb for the report.

Version 2.3.0
 - Rebuilt and modularized the admin Featured Products page to match the current core.
 - Merged search function into main page.
 - Converted featured products functions to class.
 - Removed siteWide hook.
 - Changed the default expiry date value to NULL. Thanks to @BrockleyJohn for the report
 - Updated all shop modules to use products class

Version 2.2.5
 - Fixed index module queries that did not retrieve the final price. Thanks to @plamastus for the report.
 
Version 2.2.4
 - Fixed error for PHP versions lower than 7.3.

Version 2.2.3
 - Updated for Phoenix 1.0.7.12+.
 - Updated Box Module to use Products Class.
 - Moved shop hook and page template to override template.
 - Modernized code to match current core standards.
 - Updated Copyright Info to Phoenix Cart

Version 2.2.2
 - Updated for Phoenix 1.0.7.11+.
 - Removed include currencies class in admin/featured.php and admin/select_featured.php.
 - Added Search Button language definition to admin/featured.php language file.
 - Updated all language files to const
 - Removed unused category support in index module.
 
Version 2.2.1
 - Fixed error in admin/featured_products.php with search option. Thanks to @rupruprup for the report
 - Fixed missing $PHP_SELF global in content modules. Thanks to @rupruprup, @Omar_one and @kgtee

Version 2.2.0
 - Updated featured_products.php to templateable page for OSCOM CE Phoenix 1.0.7.4.+
 - Updated content and box modules to abstract executable modules for OSCOM CE Phoenix 1.0.7.4.+
 - Updated content and box modules templates to match core coding
 - Updated admin/featured_products.php buttons to bootstrap buttons
 
Version 2.1.1
 - Updated featured_products.php OSCOM CE Phoenix 1.0.4.x

Version 2.1.0
 - Updated for OSCOM CE Phoenix 1.0.4.x
 - Updated index content module template files to match Phoenix 1.0.2.x-1.0.4.x product modules
 - Removed word length settings
 - Bootstrapped Admin/featured.php and Admin/select_featured.php
 - Removed Catalan and French admin language files
 - Translated Spanish and German admin/select_featured.php language files
 - Added Spanish and German store language files
 - Updated instructions
 
Version 2.0.0
 - Updated for OSCOM CE Phoenix
 - Moved expire featured products function call from application_top.php into a sitewide hook.
 - Moved all html output into template files

Version 1.6.1
 - Added missing "Delete" button in admin/featured.php

Version 1.6
 - PHP 7.2 notice error fix in application_top.php
 - Added admin/box module language file to avoid modifying main language file

Version 1.5.1
 - Fix in cm_in_featured_products.php

Version 1.5
 - Updated for 2.3.4.1. CE Frozen
 - Updated template naming and auto inclusion in content modules
 - Updated deprecated each function in featured_products.php
 - Fixed undefined messages in admin/featured.php and admin/select_featured.php
 - Sanitized search input in admin/select_featured.php
 - Added  "is-product" class and  "data-is-special"  in content modules and featured products page
 - Added "data-has-attributes", "data-in-stock" and "data-product-id" to "buy" buttons in content modules and featured products page.

