Site maintenance: Sun 15 Nov, from 12:00 UTC, about 4–6 hours. Details

This cutover relies on some testing that is still incomplete so may be cancelled at short notice

Forums / Customization from the Admin / View a product/category in the catalog from a link in admin product/category listing

View a product/category in the catalog from a link in admin product/category listing

Started by torvista on 15 Jan 2013, 6:30 PM · Views: 35,151

Results 1 to 5 of 5
15 Jan 2013, 6:30 PM
#1
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,880
Plugin Contributions:
7

View a product/category in the catalog from a link in admin product/category listing

I wanted an quick way to get to the catalog page of the category or product I was editing in the Admin, so this is what I did...this may be of interest to others

Both edits are in admin/includes/modules/category_product_listing.php

  1. Category Link
    In the admin category listing I made the category title a link to the shop category:
    line 24
    from
<td class="pageHeading"><?php echo HEADING_TITLE; ?> - <?php echo zen_output_generated_category_path($current_category_id); ?></td>

to

td class="pageHeading"><?php echo HEADING_TITLE; ?> - <?php //ORIGINAL echo zen_output_generated_category_path($current_category_id); 
            echo '<a href="' . zen_catalog_href_link('index', zen_get_path($current_category_id)) . '" target="_blank" title="View in shop">' . zen_output_generated_category_path($current_category_id) . '</a>'; ?>
            </td>

and a bit of extra css to make it look consistent:

h1,.pageHeading, .pageHeading a{
color:#003D00; /727272/
font-size:16px;
font-variant:small-caps;
font-weight:bold;
}

  1. Product Link
    In admin product listing I made the product id a link for me to drag and drop which opens a new window in my browser configuration. I found that having the link open a new window with "_blank" would work but the admin product-edit page would open too, maybe someone knows how to stop the jscript row select from firing in this case.

line 328
from

<td class="dataTableContent" width="20" align="right"><?php echo $products->fields['products_id']; ?></td>

to

<td class="dataTableContent" align="right" valign="middle"><?php //original echo $products->fields['products_id']; 
                echo '<a href="' . zen_catalog_href_link('product_info','cPath='.zen_get_product_path($products->fields['products_id']).'&products_id='.$products->fields['products_id']) . '" title="View in shop">' .  $products->fields['products_id'] . '</a>'; ?></td>

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

24 Jan 2013, 5:46 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: View a product/category in the catalog from a link in admin product/category listing

I have not tested this, but peeking at the Products Price Manager for the View Details, I grabbed this and added the products_id that I think you need:

'<a href="' . zen_href_link(FILENAME_CATEGORIES, 'cPath=' . zen_get_product_path($products->fields['products_id']) . '&pID=' . $products->fields['products_id'] . '&product_type=' . zen_get_products_type($products->fields['products_id'])) . '">'

See if that helps you out ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

24 Jan 2013, 10:16 PM
#3
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,880
Plugin Contributions:
7

Re: View a product/category in the catalog from a link in admin product/category listing

See if that helps you out ..

Thanks but, that link construct goes to the admin category page for that product whereas I am talking about a link from the admin poruct listing to that product info page in the catalog. The example I posted works...just 2) does not open a new tab/window automatically.

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

24 Jan 2013, 11:52 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: View a product/category in the catalog from a link in admin product/category listing

On the TR take out the mouse over ...

I just comment out the two TR and beneath the IF put in:

        echo '<tr class="dataTableRow" >';

Then on the TD put in:

                <td class="dataTableContent" width="20" align="right"><?php echo '<a href="' . zen_catalog_href_link('product_info', 'cPath=' . zen_get_product_path($products->fields['products_id']) . '&products_id=' . $products->fields['products_id']) . '" title="View in shop" target="_blank">' . $products->fields['products_id'] . '</a>'; ?></td>

You lose the mouse over but your still have the E for EDIT and now you don't get the Preview when you click the link ...

If you want the mouse over, add another icon for Preview instead of using the products_id ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

25 Jan 2013, 5:13 PM
#5
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,880
Plugin Contributions:
7

Re: View a product/category in the catalog from a link in admin product/category listing

I decided to keep the highlighting but remove the mouseover href as it is a bit pointless really, the number of times I've gone into Edit when I wanted to enable/disable....
Thanks

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...