*********************************************************************************************************************
Related Products for Phoenix Cart 1.0.7.12.+
*********************************************************************************************************************

Version Phoenix 7.4.0 
by @raiwa 
info@sarplataygemas.com
www.oscaddons.com

PRO version available:
www.oscaddons.com/en/commercial-add-ons/related-products-pro-p-43.html
	Additional options for PRO version:
	- Category selection menus added in Admin Page
	- Added optional display of Product Id, Name, Model in Admin Page
	- Sort order options added for Admin Page

*********************************************************************************************************************
Compatibility:
Phoenix Cart 1.0.7.12+
PHP: 7.0-7.4
*********************************************************************************************************************
Installation Instructions
******************************************************************************************************************


PreInstallation Instructions:

1) Backup all files to be changed, listed above, to somewhere safe. If you
   need to remove this contribution, it will be easiest to simply reload
   the saved files.

2) Backup your database.

3) Did I mention to backup all files you'll be changing, including your
   database? Yes? Well, it bears repeating.


************************************************************************************

STEP 1 Upload the following files, maintaining the directory structure.

        [catalog/]admin/optional_related_products.php
        [catalog/]admin/includes/languages/english/optional_related_products.php
        [catalog/]admin/includes/languages/espanol/optional_related_products.php
        [catalog/]admin/includes/languages/german/optional_related_products.php
        [catalog/]includes/hooks/admin/categories/relatedProducts.php
        [catalog/]includes/languages/english/hooks/admin/categories/relatedProducts.php
        [catalog/]includes/languages/english/modules/content/product_info/cm_pi_related_products.php
        [catalog/]includes/languages/english/modules/content/shopping_cart/cm_sc_related_products.php
        [catalog/]includes/languages/espanol/hooks/admin/categories/relatedProducts.php
        [catalog/]includes/languages/espanol/modules/content/product_info/cm_pi_related_products.php
        [catalog/]includes/languages/espanol/modules/content/shopping_cart/cm_sc_related_products.php
        [catalog/]includes/languages/german/hooks/admin/categories/relatedProducts.php
        [catalog/]includes/languages/german/modules/content/product_info/cm_pi_related_products.php
        [catalog/]includes/languages/german/modules/content/shopping_cart/cm_sc_related_products.php
        [catalog/]includes/modules/content/product_info/cm_pi_related_products.php
        [catalog/]includes/modules/content/product_info/templates/tpl_cm_pi_related_products.php
        [catalog/]includes/modules/content/shopping_cart/cm_sc_related_products.php
        [catalog/]includes/modules/content/shopping_cart/templates/tpl_cm_sc_related_products.php


************************************************************************************
OPTIONAL if you are using Multiple_Products_Manager: http://addons.oscommerce.com/info/8034

STEP 2 Add code to [catalog/]admin/products_multi.php:
   		 to remove all Related Product entries containing the removed product.
   
   Find, on or around line 28:

                      //If we have this product in other categories we just remove from TABLE_PRODUCTS_TO_CATEGORIES.
                      if ($duplicate_check['total']>0)     tep_db_query("delete from ".TABLE_PRODUCTS_TO_CATEGORIES.
                             " where products_id='". $products_id."' and categories_id='".$current_category_id."'");
                      else    tep_remove_product($products_id);
                  }
                  if (USE_CACHE=='true') {tep_reset_cache_block('categories'); tep_reset_cache_block('also_purchased');}

   Replace with:
   
                      //If we have this product in other categories we just remove from TABLE_PRODUCTS_TO_CATEGORIES.
                      if ($duplicate_check['total']>0)     tep_db_query("delete from ".TABLE_PRODUCTS_TO_CATEGORIES.
                             " where products_id='". $products_id."' and categories_id='".$current_category_id."'");
                      else    tep_remove_product($products_id);
                      
                      /* Optional Related Products (ORP) */
                      tep_db_query("delete from products_related_products where pop_products_id_master = '" . (int)$products_id . "'");
                      tep_db_query("delete from products_related_products where pop_products_id_slave = '" . (int)$products_id . "'");
                      //ORP: end

                  }
                  if (USE_CACHE=='true') {tep_reset_cache_block('categories'); tep_reset_cache_block('also_purchased');}


******************************************************************************************************************

STEP 3 In Admin, go to Catalog->Modules
**********
A.  Required Module!
		Admin > Modules > Content:
    Install Content Module: Related Products (product_info)
Shows the Related Products module on the product info page and includes the configuration settings for the Admin Related Products Page.
    
NOTE: Installation of this Content Module is required for the Admin Page to work.
      You can switch off the module so it will not show on the Stores product info page, but it needs to be installed.
      It also will add the required database table or update it if  a previous version is found.
***********
B.  Optional Module
		Admin > Modules > Content:
    Install Content Module: Related Products (shopping_cart)
Shows the Related Products module on the shopping cart page

************************************************************************************



Have fun!


