Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Create New Products Header Link

Create New Products Header Link

Locked

Views: 1,092

Results 1 to 2 of 2
This thread is locked. New replies are disabled.
24 Aug 2009, 6:34 PM
#1
maineiac13 avatar

maineiac13

New Zenner

Join Date:
Sep 2008
Posts:
98
Plugin Contributions:
0

Create New Products Header Link

Rather than have the new products header on the home page simply say "New Products for the month...etc." I wanted to create a link in the header that would say something to the effect of "New Products...Click Here for Complete List."

The good news...is that I was able to figure out how to do it...but the bad news is that given my limited knowledge of php, etc....I made the change by hard coding the changes into the new_products.php file. So I am wondering if someone could help me modify this so that I accomplish the same thing...but without the hard coding.

First....here is the original portion of new_products.php that I addressed:

$title = '<h2 class="centerBoxHeading">' . sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')) . ($category_title != '' ? ' - ' . $category_title : '' ) . '</h2>';
    } else {
      $title = '<h2 class="centerBoxHeading">' . sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')) . '</h2>';
    }

Then here is what I did to accomplish the change for the header to make it a link.

$title = '<h2 class="centerBoxHeading">' . '<a href="http://www.mywebsite.com/index.php?main_page=products_new" >Featured New Listings...Click Here for Complete List</a>' . ($category_title != '' ? ' - ' . $category_title : '' ) . '</h2>';
    } else {
      $title = '<h2 class="centerBoxHeading">' . '<a href="http://www.mywebsite.com/index.php?main_page=products_new" >Featured New Listings...Click Here for Complete List</a>' . '</h2>';
    }

While this does what I want...it eliminates the reference to TABLE_HEADING_NEW_PRODUCTS and hard codes in the actual link to the new products page...things that I would like to avoid of course in case of future changes that I might want to make.

24 Aug 2009, 11:17 PM
#2
maineiac13 avatar

maineiac13

New Zenner

Join Date:
Sep 2008
Posts:
98
Plugin Contributions:
0

Re: Create New Products Header Link

Well...after working on it some more...I figured out how to do it....

I substituted the following text for the original version:

$title = '<h2 class="centerBoxHeading">' . '<a href="' . zen_href_link(FILENAME_PRODUCTS_NEW) . '">' . TABLE_HEADING_NEW_PRODUCTS . '</a>' . ($category_title != '' ? ' - ' . $category_title : '' ) . '</h2>';
    } else {
      $title = '<h2 class="centerBoxHeading">' . '<a href="' . zen_href_link(FILENAME_PRODUCTS_NEW) . '">' . TABLE_HEADING_NEW_PRODUCTS . '</a>' . ($category_title != '' ? ' - ' . $category_title : '' ) . '</h2>';
    }

This creates a linkable header for the New Products center box that appears on the home page...and elsewhere...but does so without hard-coding the header link or the header title.

Hope this helps others who may want to create such a link.