Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    Nov 2008
    Posts
    40
    Plugin Contributions
    0

    Default Need manufacturers name as link on front page new products and new products listing

    I tried asking this in an old thread, but maybe no one reads old ones, so I am going to ask on my own thread.

    I need to turn the manufacturers name into a link to the manufacturers page. I have the names, but I need them to be links.

    On the new_products.php I have this:

    Code:
      while (!$new_products->EOF) {
    $products_manufacturer ='<a href="' . zen_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $new_products->fields['manufacturers_id']) . '">' . zen_get_products_manufacturers_name($new_products->fields['products_id']) . '</a>';
        $products_price = zen_get_products_display_price($new_products->fields['products_id']);
        if (!isset($productsInCategory[$new_products->fields['products_id']])) $productsInCategory[$new_products->fields['products_id']] = zen_get_generated_category_path_rev($new_products->fields['master_categories_id']);
    
        if (zen_has_product_attributes($new_products->fields['products_id'])) {
          // show a more link for attributes
          $lc_button = '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . ( ($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ? zen_get_generated_category_path_rev($_GET['filter_id']) : $_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id'])) . '&products_id=' . $new_products->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_DESIGN, BUTTONS_IMAGE_DESIGN_ALT) . '</a>';
    
        } else {
          // show an add to cart choose one or the other
          $lc_button = '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $new_products->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT, 'class="listingBuyNowButton"') . '</a>&nbsp;&nbsp;'.'<a href="'. zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">' .zen_image_button(BUTTON_IMAGE_DETAILS, BUTTON_DETAILS_ALT).'</a>';
    
        }
    
        $list_box_contents[$row][$col] = array('params' =>'class="centerBoxContentsFeatured centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"',
        'text' => (($new_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $new_products->fields['products_image'], $new_products->fields['products_name'], IMAGE_PRODUCT_NEW_LISTING_WIDTH, IMAGE_PRODUCT_NEW_LISTING_HEIGHT) . '</a><br />'). $products_manufacturer .'<br/><a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">' . $lc_button); 	
    
      }
    The code in red is what I have tried to do to make this a link, but it does not work it just refreshes the home page.

    I would also like the same thing on the tpl_new_products_listing.php , the manufactures name as a link. The name is there, but as much as I try, I can't make it a link.

    Code:
    	  if (PRODUCT_NEW_LIST_MANUFACTURER != '0' and zen_get_show_product_switch($products_new->fields['products_id'], 'manufacturer')) {
            $display_products_manufacturers_name = ($products_new->fields['manufacturers_name'] != '' ? TEXT_MANUFACTURER . ' ' . $products_new->fields['manufacturers_name'] . str_repeat('<br clear="all" />', substr(PRODUCT_NEW_LIST_MANUFACTURER, 3, 1)) : '');
          } else {
            $display_products_manufacturers_name = ''
    		
    		
    		;
          }
    If anyone could give any help on this it would be greatly appreciated. Please, Please, Please. Even if you can't, please let me know so I can move on with my life.

    Thank you for reading this,
    Ladybugmom
    http://www.bumblebeebuttons.com

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Need manufacturers name as link on front page new products and new products listi

    Sounds like you did not add to the SELECT statements the field:
    p.manufacturers_id

    so your manufacturers_id is blank ...
    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: v1.5.5]
    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!

  3. #3
    Join Date
    Nov 2008
    Posts
    40
    Plugin Contributions
    0

    Default Re: Need manufacturers name as link on front page new products and new products listi

    Quote Originally Posted by Ajeh View Post
    Sounds like you did not add to the SELECT statements the field:
    p.manufacturers_id

    so your manufacturers_id is blank ...
    You are now my best friend. Thank you so much!!! I was missing the statement.

    Can you give any other hint on the tpl_new_product_listing.php??

    Thank you again for your help!!

    Ladybugmom

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Need manufacturers name as link on front page new products and new products listi

    Did you peek in the file:
    /includes/modules/pages/products_new/header_php.php

    and adjust the SELECT statements to get the field you need?

    Then, you should be able to reference it in the template with:
    $products_new->fields['manufacturers_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: v1.5.5]
    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!

  5. #5
    Join Date
    Nov 2008
    Posts
    40
    Plugin Contributions
    0

    Default Re: Need manufacturers name as link on front page new products and new products listi

    You are indeed awesome I was able to make it work!!!

    For anyone else wanting this same thing, my solution, with the help of my new best friend was this:

    add the statement 'p.manufacturers_id' to the /includes/modules/pages/products_new/header_php.php at the top.

    Then change this section of code
    Code:
    if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_NEW_LIST_MANUFACTURER') {
              echo $display_products_manufacturers_name ;
    to this

    Code:
    if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_NEW_LIST_MANUFACTURER') {
                        echo '<a href="' . zen_href_link(zen_get_products_manufacturers_id($product_id). FILENAME_DEFAULT,'manufacturers_id=' . $products_new->fields['manufacturers_id']). '">' .  $display_products_manufacturers_name . '</a>';
    and now your manufacturers name is now a link to the manufacturers page.

    This can easily be added to featured product listing and all product listing by changing the $products_new part of the code.


    Thank you again for your help you don't know how much I appreciate it.

    Have a great day,
    Ladybugmom

  6. #6

    Default Re: Need manufacturers name as link on front page new products and new products listi

    Quote Originally Posted by ladybugmom View Post
    You are indeed awesome I was able to make it work!!!

    For anyone else wanting this same thing, my solution, with the help of my new best friend was this:

    add the statement 'p.manufacturers_id' to the /includes/modules/pages/products_new/header_php.php at the top.

    Then change this section of code
    Code:
    if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_NEW_LIST_MANUFACTURER') {
              echo $display_products_manufacturers_name ;
    to this

    Code:
    if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_NEW_LIST_MANUFACTURER') {
                        echo '<a href="' . zen_href_link(zen_get_products_manufacturers_id($product_id). FILENAME_DEFAULT,'manufacturers_id=' . $products_new->fields['manufacturers_id']). '">' .  $display_products_manufacturers_name . '</a>';
    and now your manufacturers name is now a link to the manufacturers page.

    This can easily be added to featured product listing and all product listing by changing the $products_new part of the code.


    Thank you again for your help you don't know how much I appreciate it.

    Have a great day,
    Ladybugmom
    Can this be done for product_info_dispay page?
    And how?

    Thanks
    My most recent work: magprom.net

  7. #7
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Need manufacturers name as link on front page new products and new products listi

    Around line 122, you will see:
    Code:
      <?php echo (($flag_show_product_info_quantity == 1) ? '<li>' . $products_quantity . TEXT_PRODUCT_QUANTITY . '</li>'  : '') . "\n"; ?>
    and can change to:
    Code:
      <?php echo (($flag_show_product_info_manufacturer == 1 and !empty($manufacturers_name)) ? '<li>' . TEXT_PRODUCT_MANUFACTURER . '<a href="' . zen_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $product_info->fields['manufacturers_id']) . '">' . $manufacturers_name . '</a>' . '</li>' : '') . "\n"; ?>
    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: v1.5.5]
    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!

  8. #8
    Join Date
    Sep 2012
    Location
    West Jefferson, NC
    Posts
    383
    Plugin Contributions
    0

    Default Re: Need manufacturers name as link on front page new products and new products listi

    It can be done on the Products All Listing as well...this was tested on ZenCart v. 1.5.3 so test it on your version before going live.

    Open /includes/modules/pages/products_all/header.php and add
    PHP Code:
    p.manufacturers_id 
    to the SELECT statement at the top of the page.

    PHP Code:
    $products_all_query_raw "SELECT p.products_type, p.products_id, pd.products_name,
    p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, p.manufacturers_id,
    m.manufacturers_name, p.products_model, p.products_quantity,
    p.products_weight, p.product_is_call, p.product_is_always_free_shipping,
    p.products_qty_box_status, p.master_categories_id
    FROM " 
    TABLE_PRODUCTS " p
    LEFT JOIN " 
    TABLE_MANUFACTURERS " m ON (p.manufacturers_id = m.manufacturers_id), " .
    TABLE_PRODUCTS_DESCRIPTION " pd
    WHERE p.products_status = 1
    AND p.products_id = pd.products_id
    AND pd.language_id = :languageID " 
    $order_by
    Then open /includes/templates/YOUR CUSTOM FOLDER/templates/tpl_modules_product_listing.php and add this
    PHP Code:
     .  '<a href="' zen_href_link(FILENAME_DEFAULT,'manufacturers_id=' zen_get_products_manufacturers_id($products_all->fields['products_id'])). '">' 
    and this
    PHP Code:
     '</a>' 
    as I did in the code below (around line 71):

    PHP Code:
    if (PRODUCT_ALL_LIST_MANUFACTURER != '0' and zen_get_show_product_switch($products_all->fields['products_id'], 'manufacturer')) {
    $display_products_manufacturers_name = ($products_all->fields['manufacturers_name'] != '' ?
    TEXT_MANUFACTURER ' ' .  '<a href="' zen_href_link(FILENAME_DEFAULT,'manufacturers_id=' .
    zen_get_products_manufacturers_id($products_all->fields['products_id'])). '">' $products_all
    ->fields['manufacturers_name'] . '</a>' str_repeat('<br clear="all" />',
    substr(PRODUCT_ALL_LIST_MANUFACTURER31)) : ''); //MIKE IS WORKING ON MAKING THE
    ANCHOR WORK
    } else {
    $display_products_manufacturers_name '';

    Web spiders may pick up on this and index your manufacturers id pages...you can disable that in Google and Bing Webmaster Tools if you like.

    I hope this saves someone time.

  9. #9
    Join Date
    Sep 2012
    Location
    West Jefferson, NC
    Posts
    383
    Plugin Contributions
    0

    Default Re: Need manufacturers name as link on front page new products and new products listi

    Update: There is no need to modify the header.php file...the code works fine without it.

    This works for featured products listing as well! New products listing yet to be tested.
    Last edited by mikeel100; 26 Nov 2014 at 03:19 AM. Reason: Update

  10. #10
    Join Date
    Sep 2012
    Location
    West Jefferson, NC
    Posts
    383
    Plugin Contributions
    0

    Default Re: Need manufacturers name as link on front page new products and new products listi

    It works on the new products listing too!

    . '<a href="' . zen_href_link(FILENAME_DEFAULT,'manufacturers_id=' . zen_get_products_manufacturers_id($featured_products->fields['products_id'])). '">'

    You have to change what I have in bold above to $products_new for the new products listing or if you are modifying the featured listing, just leave it as I have it above (featured_products).

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v139h Main Page: "New" Products - turn off clickable link and DISPLAY new products
    By lissa in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 28 Sep 2014, 02:20 AM
  2. Replies: 4
    Last Post: 3 Jun 2010, 11:44 PM
  3. Changing the front page from Featured Products to New Products
    By philip56 in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 17 Oct 2009, 05:50 PM
  4. Remove New Products Under Manufacturers Listing
    By DiZZ in forum General Questions
    Replies: 3
    Last Post: 12 Dec 2006, 04:36 PM
  5. New Products on front page...
    By mooncavecrystals in forum General Questions
    Replies: 4
    Last Post: 14 Sep 2006, 02:33 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR