Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Optional Related Products, Version 4.0


Skittles

Recommended Posts

Added this quickly and just wanted to say thanks.

Was wondering if there is a way to have multiple products listed inline

With something like

#orp li { 
display: inline; 
list-style-type: none; 
padding-right: 20px; 
}
<ul id="orp">
  <li>product 1</li>
  <li>product 2</li>
</ul>

Doug

 

Link to comment
Share on other sites

5 hours ago, Dnj1964 said:

Was wondering if there is a way to have multiple products listed inline

Hello Doug @Dnj1964,

I have no idea and I do not understand what exact you wish to achieve.

But, just try.

Best regards
Rainer

Link to comment
Share on other sites

  • 4 weeks later...

I think he means that in the related products are no longer in Grid mode but as a long vertical list as would be displayed on a phone.

Some how this is broken for PC browsers as it used to work like this (I am now using Frozen BS4 CE downloaded from Chilled Displays). Also the version number still shows as 6.40 not 6.60

The admin sidet might not be compatible with the new BS4 admin, but i'm still testing that out as it might be my setup.

Mark

Link to comment
Share on other sites

Link to comment
Share on other sites

  • 1 month later...

Hello @raiwa

installed the Related_Products_234_BS_6.6.

google structured data test gives all related products as separated products and not related to any product

w3c validatation gives the following errors:

Error: The itemprop attribute was specified, but the element is not a property of any item. ( isRelatedTo, url, name,  offers, pricecurrency,  price)

i have installed the HT product_schema.php wich works correctly for the main product.

is there something missing in the HT product_schema.php, some code for related products?

 

i am Using Frozen v2.3.4.1 CE

 

 

 

Link to comment
Share on other sites

Hello @Rwe,

ht_product_schema is a core module and can't therefor take in consideration the related products add.

Schema tags are constantly updated. I'll have a look and try to address this for the next update. Anyway I would say it's not really very important.

Thank's for the report anyway.

Link to comment
Share on other sites

  • 1 month later...

Hello @Rwe,

I've updated this to BS4. Can you please look at this code to see if it is valid? I'm still learning how to convert BS3 to BS4. Thanks!

<?php
/*
  $Id: cm_pi_related_products.php
  $Loc: catalog/includes/modules/content/product_info/

  Related Products 6.3 BS
  by @raiwa 
  [email protected]
  www.oscaddons.com

  Copyright (c) 2016
  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Released under the GNU General Public License
*/

  class cm_pi_related_products {
    var $code;
    var $group;
    var $title;
    var $description;
    var $sort_order;
    var $enabled = false;

    function __construct() {
      $this->code = get_class($this);
      $this->group = basename(dirname(__FILE__));

      $this->title = MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_TITLE;
      $this->description = MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_DESCRIPTION;

      if ( defined('MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_STATUS') ) {
        $this->sort_order = MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_SORT_ORDER;
        $this->enabled = (MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_STATUS == 'True');
      }
    }

    function execute() {
      global $oscTemplate, $languages_id, $currencies, $currency, $PHP_SELF, $product_info;
      
      $content_width = MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_CONTENT_WIDTH;
      $product_width = MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_DISPLAY_EACH;

      $optional_rel_prods_content = NULL;
      
      $orderBy = 'order by ';
      $orderBy .= (MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_RANDOMIZE == 'True')?'rand()':'pop_order_id, pop_id';
      $orderBy .= (MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_MAX_DISP > 0)?' limit ' . MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_MAX_DISP:'';

      $optional_rel_prods = "SELECT ";
      $specials_query = '';

      if (MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_SHOW_QUANTITY == 'True')
      	$optional_rel_prods .= "products_quantity, ";

      if (MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_SHOW_MODEL == 'True')
      	$optional_rel_prods .= "products_model, ";

      if (MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_SHOW_THUMBS == 'True')
      	$optional_rel_prods .= "products_image, ";
                                       
      if (MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_SHOW_PRICE == 'True') {
      	$optional_rel_prods .= "products_tax_class_id, products_price, IF(s.status, s.specials_new_products_price, NULL) as specials_products_price, ";
      	$specials_query = " left join specials s on s.products_id = pb.products_id ";
      }

      if (MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_SHOW_NAME == 'True')
      	$optional_rel_prods .= "products_name, ";        

      if (MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_SHOW_DESCRIPTION == 'True')
        $optional_rel_prods .= "substring_index(pa.products_description, ' ', " . MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_DESCRIPTION_LENGTH . ") as products_description, ";
        
      $optional_rel_prods .= "pop_products_id_slave ";
      
      $optional_rel_prods .= "from 
         											products_related_products, 
         											products pb
                              left join products_description pa on pa.products_id = pb.products_id 
         											" . $specials_query . "
         											where pop_products_id_slave = pa.products_id
         											and pa.products_id = pb.products_id
         											and language_id = '" . (int)$languages_id . "'
         											and pop_products_id_master = '" . (int)$_GET['products_id'] . "'
         											and products_status='1' " . $orderBy;
		///echo $optional_rel_prods;

      $optional_rel_prods_query = tep_db_query($optional_rel_prods);

			if (tep_db_num_rows($optional_rel_prods_query) > 0) {
  
				$optional_rel_prods_content .= '<h3>' . MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_TITLE . '</h3>';
				$optional_rel_prods_content .= '<div class="row"><div class="card-deck mx-auto">';
        
				while ($optional_rel_prods_values = tep_db_fetch_array($optional_rel_prods_query)) {
											
					if (MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_SHOW_QUANTITY == 'True')
						$products_qty_slave = '<span itemprop="inventoryLevel">' . $optional_rel_prods_values['products_quantity'] . '</span>';
					
        	$optional_rel_prods_content .= '  <div class="card" itemprop="isRelatedTo" itemscope itemtype="http://schema.org/Product">';
          $optional_rel_prods_content .= '    <meta itemprop="url" content="' . tep_href_link('product_info.php', 'products_id=' . $optional_rel_prods_values['pop_products_id_slave']) . '" />';

					switch (MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_HEIGHT_MODE) {
					case 'Equal Height':
						$optional_rel_prods_content .= '    <div class="card-body text-center">';
						break;
					case 'Fixed Height':
						$optional_rel_prods_content .= '    <div class="card" style = "height:' . MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_HEIGHT_VALUE . 'em;">';
						break;
					case 'None':
						$optional_rel_prods_content .= '    <div class="card">';
						break;
					}

					// show thumb image if Enabled
					if (MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_SHOW_THUMBS == 'True') {
						$optional_rel_prods_content .= '<a href="' . tep_href_link('product_info.php', 'products_id=' . $optional_rel_prods_values['pop_products_id_slave']) . '">' . tep_image('images/' . $optional_rel_prods_values['products_image'], $optional_rel_prods_values['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
					}
      
					$optional_rel_prods_content .= '      <div class="caption">';

					if (MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_SHOW_NAME == 'True') {
						$optional_rel_prods_content .= '<p class="text-center"><a href="' . tep_href_link('product_info.php', 'products_id=' . $optional_rel_prods_values['pop_products_id_slave']) . '"><span itemprop="name">' . $this->tep_truncate_text_rel_prod($optional_rel_prods_values['products_name'], MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_NAME_LENGTH, MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_MAX_WORD_LENGTH) . '</span></a></p>';
					}
					
					if (MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_SHOW_MODEL == 'True') {
						$optional_rel_prods_content .=  '<p class="text-center small" itemprop="model">' . $optional_rel_prods_values['products_model'] . '</p>';
					}
	        		
					//$optional_rel_prods_content .= '<hr>';
				
        	if (MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_SHOW_DESCRIPTION == 'True') {
						$optional_rel_prods_content .= '<p class="text-center"><a href="' . tep_href_link('product_info.php', 'products_id=' . $optional_rel_prods_values['pop_products_id_slave']) . '"><span itemprop="description">' . $this->tep_truncate_text_rel_prod(strip_tags($optional_rel_prods_values['products_description']), MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_DESCRIPTION_LENGTH, MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_MAX_WORD_LENGTH) . '</span></a><br>';
        	}

        	if (MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_SHOW_PRICE == 'True') {
        		$optional_rel_prods_content .= '<p class="text-center" itemprop="offers" itemscope itemtype="http://schema.org/Offer"><meta itemprop="priceCurrency" content="' . tep_output_string($currency) . '">';
        		if (tep_not_null($optional_rel_prods_values['specials_products_price'])) {
        			$optional_rel_prods_content .= '<del>' . $currencies->display_price($optional_rel_prods_values['products_price'], tep_get_tax_rate($optional_rel_prods_values['products_tax_class_id'])) . '</del>&nbsp;';
        			$optional_rel_prods_content .= '<span class="productSpecialPrice" itemprop="price" content="' . $currencies->display_raw($optional_rel_prods_values['specials_products_price'], tep_get_tax_rate($optional_rel_prods_values['products_tax_class_id'])) . '">' . $currencies->display_price($optional_rel_prods_values['specials_products_price'], tep_get_tax_rate($optional_rel_prods_values['products_tax_class_id'])) . '</span><br>';
        		} else {
        			$optional_rel_prods_content .= '<span itemprop="price" content="' . $currencies->display_raw($optional_rel_prods_values['products_price'], tep_get_tax_rate($optional_rel_prods_values['products_tax_class_id'])) . '">' . $currencies->display_price($optional_rel_prods_values['products_price'], tep_get_tax_rate($optional_rel_prods_values['products_tax_class_id'])) . '</span><br>';
        		}
        		$optional_rel_prods_content .= '</p>';
        	}
					
					if (MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_SHOW_QUANTITY == 'True') {
						$optional_rel_prods_content .= '<p class="text-center" itemprop="offers" itemscope itemtype="http://schema.org/Offer">' . sprintf(MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_QUANTITY_TEXT, $products_qty_slave) . '</p>';
					}
      
					$optional_rel_prods_content .= '      </div>'; // caption
					$optional_rel_prods_content .= '    </div>'; // card
					$optional_rel_prods_content .= '  </div>'; // col' .  $product_width . '" 
					
				}
				$optional_rel_prods_content .= '  </div></div>';
			}
        //only output template html if related poducts are found
		if (!empty($optional_rel_prods_content)) {
		ob_start();
        include('includes/modules/content/' . $this->group . '/templates/related_products.php');
        $template = ob_get_clean();

        $oscTemplate->addContent($template, $this->group);
		}
    }

    function isEnabled() {
      return $this->enabled;
    }

    function check() {
      return defined('MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_STATUS');
    }

    function install() {
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Current Version', 'MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_VERSION_INSTALLED', '6.3 BS', 'Read only.', '6', '1', 'tep_version_readonly(', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Related Products Module', 'MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_STATUS', 'True', 'Should the optional_related_products block be shown on the product info page?', '6', '2', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Uninstall Removes Database entries', 'MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_REMOVE_DATA', 'False', 'Do you want to remove the related products database table when uninstall the module? All your existing product relations will be lost, use this option only it you are sure that you will not use related products any more.', '6', '3', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Width', 'MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_CONTENT_WIDTH', '12', 'What width container should the content be shown in?', '6', '4', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Product Width', 'MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_DISPLAY_EACH', '3', 'What width container should each product be shown in? (12 = full width, 6 = half width).', '6', '5', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_SORT_ORDER', '1100', 'Sort order of display. Lowest is displayed first.', '6', '6', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display card Image', 'MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_SHOW_THUMBS', 'True', 'Show Product Image', '6', '7', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display Product Name', 'MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_SHOW_NAME', 'True', 'Show Product Name', '6', '8', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Maximum of characters', 'MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_NAME_LENGTH', '36', 'Maximum number of characters of the product name to display', '6', '14', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display Product Model', 'MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_SHOW_MODEL', 'False', 'Show Product Model', '6', '9', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display Product Description', 'MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_SHOW_DESCRIPTION', 'False', 'Show Product Description', '6', '9', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Maximum Description length', 'MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_DESCRIPTION_LENGTH', '250', 'The number of characters (to the nearest word) of the Name to display.', '6', '1', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display Product Price', 'MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_SHOW_PRICE', 'True', 'Show Product Price', '6', '10', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display Quantity Available', 'MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_SHOW_QUANTITY', 'False', 'Show Product Quantity', '6', '11', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Define Number of Items to Display', 'MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_MAX_DISP', '0', 'Maximum number of Related Products to display. 0 is unlimited.', '6', '12', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Maximum word length', 'MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_MAX_WORD_LENGTH', '40', 'Maximum number of characters in a single word in Product Name', '6', '13', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Height mode', 'MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_HEIGHT_MODE', 'Equal Height', 'How should the height of each product box be adjusted. \'Equal Height\' uses the Equal Height jquery script. \Fixed Height\ uses the Height specified in the next field. \'None\' adjusts the height depending on the content', '6', '15', 'tep_cfg_select_option(array(\'Equal Height\', \'Fixed Height\', \'None\'), ', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Fixed height value', 'MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_HEIGHT_VALUE', '11', 'Fixed height for the product box in em. Has no effect for \'Equal Height\' and \'None\' mode.', '6', '16', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Use Random Display Order', 'MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_RANDOMIZE', 'False', 'Adds random sort order to products displayed. Recommended if maximum number of products is set.', '6', '17', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Admin Display: Maximum Rows', 'MODULE_CONTENT_PRODUCT_INFO_ADMIN_RELATED_PRODUCTS_MAX_ROW_LISTS_OPTIONS', '10', 'Sets the maximum number of rows to display per page.', '6', '18', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Admin Display: Drop-Down List Maximum Length', 'MODULE_CONTENT_PRODUCT_INFO_ADMIN_RELATED_PRODUCTS_MAX_NAME_LENGTH', '50', 'Sets the maximum length (in characters) of product name displayed in drop-down lists. Enter \'0\' to set this option to false.', '6', '19', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Admin Display: Display List Maximum Length', 'MODULE_CONTENT_PRODUCT_INFO_ADMIN_RELATED_PRODUCTS_MAX_DISPLAY_LENGTH', '50', 'Sets the maximum length (in characters) of product name displayed in list. Enter \'0\' to set this option to false.', '6', '20', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Admin Display: Use Product Id (PRO only)', 'MODULE_CONTENT_PRODUCT_INFO_ADMIN_RELATED_PRODUCTS_USE_ID', 'False', 'Uses Product Id in lists. When Product Model or Name is also selected, Product Id is displayed first.', '6', '210', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Admin Display: Use Product Model', 'MODULE_CONTENT_PRODUCT_INFO_ADMIN_RELATED_PRODUCTS_USE_MODEL', 'False', 'Uses Product Model in lists. When Product Name or Id is also selected, Product Id is displayed first.', '6', '22', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Admin Display: Use Product Name', 'MODULE_CONTENT_PRODUCT_INFO_ADMIN_RELATED_PRODUCTS_USE_NAME', 'True', 'Uses Product Name in lists. When Product Model or Id is also selected, Product Id or Model is displayed first.', '6', '23', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Admin Display: Combine Model and Name separator', 'MODULE_CONTENT_PRODUCT_INFO_ADMIN_RELATED_PRODUCTS_MODEL_SEPARATOR', ': ', 'Enter the characters you would like to separate ID, Model and Name, when using 2 or 3. Leave empty if only using one.', '6', '24', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Admin Display: Sort Order in Menus (PRO only)', 'MODULE_CONTENT_PRODUCT_INFO_ADMIN_RELATED_PRODUCTS_MENU_SORT_ORDER', 'Name', 'How should the Products be sorted in the Drop Down Menus.', '6', '25', 'tep_cfg_select_option(array(\'Name\', \'Model\', \'Id\'), ', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Admin Display: Show Out of Stock Products (PRO only)', 'MODULE_CONTENT_PRODUCT_INFO_ADMIN_RELATED_PRODUCTS_INACTIVE_PRODUCTS', 'True', 'Show Out of Stock Products in the Products Drop Down Menus.', '6', '26', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Admin Function: Use Delete Confirmation', 'MODULE_CONTENT_PRODUCT_INFO_ADMIN_RELATED_PRODUCTS_CONFIRM_DELETE', 'True', 'When set to True, a confirmation box will pop-up when deleting an association. Set to False to Delete without confirmation.', '6', '27', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Admin Function: Combine Insert with Inherit', 'MODULE_CONTENT_PRODUCT_INFO_ADMIN_RELATED_PRODUCTS_INSERT_AND_INHERIT', 'False', 'When set to True, clicking on Inherit will also Insert the product association. When False, Inherit works as before.', '6', '28', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");

      $old_table_name = tep_db_fetch_array(tep_db_query("SHOW TABLES LIKE 'products_options_products'"));
      if (tep_not_null($old_table_name)) {
      	tep_db_query("RENAME TABLE products_options_products TO products_related_products");
      }
      tep_db_query( "create table if not exists `products_related_products` (`pop_id` int(11) not null auto_increment, `pop_products_id_master` int(11) not null default '0', `pop_products_id_slave` int(11) not null default '0', `pop_order_id` smallint(6) not null default '0', primary key  (`pop_id`))");
    }

    function remove() {
      if ( defined('MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_REMOVE_DATA') && MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_REMOVE_DATA == 'True' ) {
      tep_db_query("drop table if exists `products_related_products`");
      }
      tep_db_query("delete from configuration where configuration_key in ('" . implode("', '", $this->keys()) . "')");
    }
    
    function keys() {
      return array('MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_VERSION_INSTALLED', 'MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_STATUS', 'MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_REMOVE_DATA', 'MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_SORT_ORDER', 'MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_CONTENT_WIDTH', 'MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_DISPLAY_EACH', 'MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_SHOW_THUMBS', 'MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_SHOW_NAME', 'MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_SHOW_MODEL', 'MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_SHOW_DESCRIPTION', 'MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_DESCRIPTION_LENGTH', 
                   'MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_SHOW_PRICE', 'MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_SHOW_QUANTITY', 'MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_MAX_DISP', 'MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_MAX_WORD_LENGTH', 'MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_NAME_LENGTH', 'MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_HEIGHT_MODE', 'MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_HEIGHT_VALUE', 'MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_RANDOMIZE', 'MODULE_CONTENT_PRODUCT_INFO_ADMIN_RELATED_PRODUCTS_MAX_ROW_LISTS_OPTIONS', 'MODULE_CONTENT_PRODUCT_INFO_ADMIN_RELATED_PRODUCTS_MAX_NAME_LENGTH', 
                   'MODULE_CONTENT_PRODUCT_INFO_ADMIN_RELATED_PRODUCTS_MAX_DISPLAY_LENGTH', 'MODULE_CONTENT_PRODUCT_INFO_ADMIN_RELATED_PRODUCTS_USE_ID', 'MODULE_CONTENT_PRODUCT_INFO_ADMIN_RELATED_PRODUCTS_USE_MODEL', 'MODULE_CONTENT_PRODUCT_INFO_ADMIN_RELATED_PRODUCTS_USE_NAME', 'MODULE_CONTENT_PRODUCT_INFO_ADMIN_RELATED_PRODUCTS_MODEL_SEPARATOR', 'MODULE_CONTENT_PRODUCT_INFO_ADMIN_RELATED_PRODUCTS_MENU_SORT_ORDER', 'MODULE_CONTENT_PRODUCT_INFO_ADMIN_RELATED_PRODUCTS_INACTIVE_PRODUCTS', 'MODULE_CONTENT_PRODUCT_INFO_ADMIN_RELATED_PRODUCTS_CONFIRM_DELETE', 'MODULE_CONTENT_PRODUCT_INFO_ADMIN_RELATED_PRODUCTS_INSERT_AND_INHERIT' );
    }
    
    protected function tep_limit_text_rel_prod ($text, $maxchar, $wordlength = 40) {
    	$text = str_replace ("\n", ' ', $text);
    	$text = str_replace ("\r", ' ', $text);
    	$text = str_replace ('<br>', ' ', $text);
    	$text = wordwrap ($text, $wordlength, ' ', true);
    	$text = preg_replace ("/[ ]+/", ' ', $text);
    	$text_length = strlen ($text);
    	$text_array = explode (" ", $text);

    	$newtext = '';
    	for ($array_key = 0, $length = 0; $length <= $text_length; $array_key++) {
    		$length = strlen ($newtext) + strlen ($text_array[$array_key]) + 1;
    		if ($length > $maxchar) break;
    		$newtext = $newtext . ' ' . $text_array[$array_key];
    	}

    	return $newtext;
    }
    
    protected function tep_truncate_text_rel_prod ($products_text, $maxchar, $wordlength = 40) {
    	$products_text = ($products_text);
			if ($maxchar > 0) {
				$products_text_length = strlen ($products_text);
				if ($products_text_length > $maxchar) {
					$products_text = $this->tep_limit_text_rel_prod ($products_text, $maxchar, $wordlength);
					$products_text .= '&nbsp;...';
				}
			}
				
			return $products_text;
   } 
    
  }  // End class

// function show the version read only  
  if(!function_exists('tep_version_readonly')) {
  	function tep_version_readonly($value){
  		$version_text = '<br>Version ' . $value;
      return $version_text;
    }
  }

 

The water in a vessel is sparkling; the water in the sea is dark. The small truth has words which are clear; the great truth has great silence.

- Rabindranath Tagore

Link to comment
Share on other sites

Looks good, but I can't now check details. I'm upgrading my add-ons  one by one. This one is one of the next on the list. Please be patient.

Link to comment
Share on other sites

        	$optional_rel_prods_content .= '  <div class="card" itemprop="isRelatedTo" itemscope itemtype="http://schema.org/Product">';
          $optional_rel_prods_content .= '    <meta itemprop="url" content="' . tep_href_link('product_info.php', 'products_id=' . $optional_rel_prods_values['pop_products_id_slave']) . '" />';

					switch (MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_HEIGHT_MODE) {
					case 'Equal Height':
						$optional_rel_prods_content .= '    <div class="card-body text-center">';
						break;
					case 'Fixed Height':
						$optional_rel_prods_content .= '    <div class="card" style = "height:' . MODULE_CONTENT_PRODUCT_INFO_RELATED_PRODUCTS_HEIGHT_VALUE . 'em;">';
						break;
					case 'None':
						$optional_rel_prods_content .= '    <div class="card">';
						break;
					}

Can't be right.

You already have:

        	$optional_rel_prods_content .= '  <div class="card" itemprop="isRelatedTo" itemscope itemtype="http://schema.org/Product">';

then you have a case where;

					case 'None':
						$optional_rel_prods_content .= '    <div class="card">';
						break;

which means somewhere in your output you could end up with 

<div class="card" itemprop="isRelatedTo" itemscope itemtype="http://schema.org/Product"><div class="card">

Link to comment
Share on other sites

Uloaded update for Phoenix 1.0.1.x:

Related Products Phoenix 7.0

Update Version Phoenix 7.0:
- Updated for CE Phoenix 1.0.1.x
- fixed undefined warning in admin/optional_related_products.php if product info module is not installed.
- updated template class in product info module to core naming convention "cm-pi-related_product"
- update structured database
- added config entries for columns/viewport like also purchased products module.
- removed obsolete height control config entries.
- moved html to template
- general file cleaning (tabs/spaces, UNIX new line)

Link to comment
Share on other sites

  • 4 weeks later...

Uploaded Version Phoenix 7.1 for Phoenix 1.0.2.x:

Related Products Phoenix 7.1

- Updated for CE Phoenix 1.0.2.x
- updated coding to match Phoenix 1.0.2.0 product listings and config entries
- simplified modules and removed config entries to show always product name, image and price
- simplified description length limit


Phoenix 1.0.1.x, please use Related Products 7.0
2.3.4.1 FROZEN and older BS3 versions, please use Related Products 6.6

Link to comment
Share on other sites

  • 3 weeks later...

I have installed this module and activated both for products_info page and the shopping_cart page, however on the installation instructions steps I didn't see any reference to adding a code within product_info.php or shopping_cart.php pages to show the related products and it doesn't show nowhere within product info or the shopping cart pages.

My osC version is v.2.3.4.

Am I missing something?

Thanks in advance.

Link to comment
Share on other sites

Which Optional Related Products version are you trying to install?

Link to comment
Share on other sites

8 minutes ago, raiwa said:

Which Optional Related Products version are you trying to install?

I installed the Version Phoenix 7.1, which I now see says for osCommerce CE Phoenix 1.0.2.x. :)

Which version is for 2.3.4? Well I guess I can look within the versions and find the right version. Right?

Or maybe I should upgrade to the latest version of osC.

Edited by edoscript
Link to comment
Share on other sites

  • 4 weeks later...

Hello Rainer,

I installed your last version Phoenix 7.1 for Phoenix 1.0.2.x on Phoenix 1.0.2.5 and all works in the admin section but the related products do not show shop wide. I have used your past versions with no problem and just can not figure out what could be wrong this time. Your "Recently Viewed" module shows fine and I put the sort order for Related Products to show before but it but it doesn't. Do not know where else to look.

Link to comment
Share on other sites

1 hour ago, artfulweb said:

I installed your last version Phoenix 7.1 for Phoenix 1.0.2.x on Phoenix 1.0.2.5 and all works in the admin section but the related products do not show shop wide. I have used your past versions with no problem and just can not figure out what could be wrong this time. Your "Recently Viewed" module shows fine and I put the sort order for Related Products to show before but it but it doesn't. Do not know where else to look.

Hello,

Just updated my test store to 1.0.2.5 and all works and shows like expected.

- make sure you have the product info module installed and switched on

- make sure you have at least one related product defined for the product you are viewing

For debugging:

Comment out the condition which checks if related products exist like follows:

//      if ($num_related_products > 0) {

        ob_start();
        include('includes/modules/content/' . $this->group . '/templates/tpl_' . basename(__FILE__));
        $template = ob_get_clean();

        $oscTemplate->addContent($template, $this->group);
//      }

Then you should see at least the module title "Related Products you might like".

If you see it but no products, then you have no related product defined.

Edited by raiwa
Link to comment
Share on other sites

Thank you Rainer. Even though the uninstall has Uninstall Removes Database entries set to false it DID uninstall my database table so there are no longer any related products! I should have looked there first but thought the setting on false was safe. Back to square 1, silly me. 

Link to comment
Share on other sites

1 hour ago, artfulweb said:

Thank you Rainer. Even though the uninstall has Uninstall Removes Database entries set to false it DID uninstall my database table so there are no longer any related products! I should have looked there first but thought the setting on false was safe. Back to square 1, silly me. 

I tried to replicate this, but even the constant names have been shortened, I didn't succeed to remove or empty the featured products table with the Uninstall Removes Database entries set to false. I tried uninstalling first the old module then installing the new module and also replacing the module without uninstall/ install, no way. I never lost data.

Anyway the phoenix version is intended for a new installation not for an update of the previous 5 or 6 series. It's supposed for Phoenix you always start over from scratch. That's why no update instructions from 6.x versions are included.

It's suposed for a new installation from scratch, you have to import the related products table from your old database, sure you did this?

Edited by raiwa
Link to comment
Share on other sites

Link to comment
Share on other sites

15 hours ago, artfulweb said:

Even though the uninstall has Uninstall Removes Database entries set to false it DID uninstall my database table so there are no longer any related products! I should have looked there first but thought the setting on false was safe.

The setting IS safe. Please see the code, it can only trigger the drop table command if the constant is defined AND the constant is set to "True":

      if ( defined('MODULE_CONTENT_PI_RELATED_PRODUCTS_REMOVE_DATA') && MODULE_CONTENT_PI_RELATED_PRODUCTS_REMOVE_DATA == 'True' ) {
        tep_db_query("drop table if exists `products_related_products`");
      }

 

Link to comment
Share on other sites

  • 3 months later...

Uploaded Version Phoenix 7.2 for Phoenix 1.0.4.x:

Related Products Phoenix 7.2

Update Version Phoenix 7.2:
- Updated for CE Phoenix 1.0.4.x
- hooked the changes for admin/categories.php. No more core code changes!


Phoenix 1.0.2.x -1.0.3.x, please use Related Products 7.0
Phoenix 1.0.1.x, please use Related Products 7.1
2.3.4.1 FROZEN and older BS3 versions, please use Related Products 6.6

Link to comment
Share on other sites

  • 3 weeks later...
On 1/21/2020 at 1:24 PM, raiwa said:

Uploaded Version Phoenix 7.2 for Phoenix 1.0.4.x:

Related Products Phoenix 7.2

Update Version Phoenix 7.2:
- Updated for CE Phoenix 1.0.4.x
- hooked the changes for admin/categories.php. No more core code changes!


Phoenix 1.0.2.x -1.0.3.x, please use Related Products 7.0
Phoenix 1.0.1.x, please use Related Products 7.1
2.3.4.1 FROZEN and older BS3 versions, please use Related Products 6.6

Just installed and then created a Product Tabs version of it.

image.thumb.png.a83a39568ea15a8ff81c1f58014da588.png

Link to comment
Share on other sites

Lee

Received your post, Went to the link on your post and it takes me the page with last updated 20 August 2019.  I have install that one and if this was a new one I would like to update the one I installed.  

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...