Administration: Related Products: Display only Published products when adding?

  • Posts: 228
  • Thank you received: 21
  • Hikashop Business Hikashop Essential
7 months 1 week ago #353620

-- HikaShop version -- : 4.7.4
-- Joomla version -- : 3.10.12
-- PHP version -- : 8.0.29
-- Browser(s) name and version -- : n/a
-- Error-message(debug-mod must be tuned on) -- : None

There appears to be no way to tell if a product is published when adding Related Products in the Administration area while editing a product.

Is there any way to filter unpublished or color-code them?

Otherwise, staff users cannot tell without manually checking the related products' status in another window.

When there are over 1000 products that have accumulated over the years, it becomes a problem.

It would be nice to have filter options at this level or, at the very least, color-coding them (red/green).

Please Log in or Create an account to join the conversation.

  • Posts: 81182
  • Thank you received: 12995
  • MODERATOR
7 months 1 week ago #353622

Hi,

There is no option to filter them. But color coding can be added quite easily.

To do that, you first need to edit the product / form view file via the menu Display>Views. There, you can find this block of code which displays the related products option:

if(hikashop_acl('product/edit/related')) { ?>
			<dt class="hikashop_product_related"><label for="data_product_related_text"><?php echo JText::_('RELATED_PRODUCTS'); ?></label></dt>
			<dd class="hikashop_product_related"><?php
				echo $this->nameboxType->display(
					'data[product][related]',
					@$this->product->related,
					hikashopNameboxType::NAMEBOX_MULTIPLE,
					'product',
					array(
						'delete' => true,
						'sort' => true,
						'default_text' => '<em>'.JText::_('HIKA_NONE').'</em>',
					)
				);
			?></dd>
<?php
	}
There, below the line:
'default_text' => '<em>'.JText::_('HIKA_NONE').'</em>',
you can add the line:
'displayFormat' => '<span class="product_published_{product_published}">[{product_id}] {product_name}</span>',
That way, in the selector tree, each product name will be surrounded by a span with either the class product_published_0 or the class product_published_1
Then, you can add a piece of CSS to your backend template ( joomlaforever.com/overrides/override-the...e-cache-admin-module ) for these classes. For example:
.product_published_0{ background-color: #ffdddd; }
will display a light red background for unpublished products.

Please Log in or Create an account to join the conversation.

Time to create page: 0.058 seconds
Powered by Kunena Forum