Hi,
I am in need of some professional help (or so my friends say...)

While fixing a problem with the Single Listing Template , I am modifying \includes\modules\TEMPLATE\product_listing.php so it functions correctly with new, featured and special products listings.
Although it needs similar changes in various places, I am using this code for illustration.

The original code is this:

PHP Code:
        $products_link '<a href="' zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . ( ($_GET['manufacturers_id'] > and $_GET['filter_id']) > zen_get_generated_category_path_rev($_GET['filter_id']) : $_GET['cPath'] > zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id'])) . '&products_id=' $listing->fields['products_id']) . '">' MORE_INFO_TEXT '</a>'
and to get the new, featured and specials products to have the correct cpath links, this code works:

PHP Code:
if (!$is_index_listing) {//test for new, featured or specials product listing, do this original code if variable not set
        
$products_link '<a href="' zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . ( ($_GET['manufacturers_id'] > and $_GET['filter_id']) > zen_get_generated_category_path_rev($_GET['filter_id']) : $_GET['cPath'] > zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id'])) . '&products_id=' $listing->fields['products_id']) . '">' MORE_INFO_TEXT '</a>';

        } else {
//bof Single Listing Template, 
$products_link '<a href="' zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' zen_get_generated_category_path_rev($listing->fields['master_categories_id']) . '&products_id=' $listing->fields['products_id']) . '">' MORE_INFO_TEXT '</a>';

It works ok but it seems an ugly solution.
As it has been a real effort for me to figure out the problem I would like to solve it as neatly as possible
Since I don’t really understand what is being tested for nor why in the concatenated (I think) ternary operators in the original code, I can’t improve on my hack effort, so I would appreciate it if someone could explain what is going on in the original code and maybe show me a better way to do this,

Thanks
Steve