Page 1 of 2 12 LastLast
Results 1 to 10 of 15
  1. #1
    Join Date
    Jul 2010
    Location
    Australia
    Posts
    131
    Plugin Contributions
    0

    Default Direct Links to Product Manufacturer & Category

    Hello all

    I'm trying to incorporate a direct link to a product's manufacturer on the product info page, much like the manufacturer's sidebox.

    I've found varying threads trying the same thing, however I can't seem to get it to work. So far what I've done is add the following line of code to product_info/main_template_vars.php:

    PHP Code:
    $manufacturers_idzen_get_products_manufacturers_id((int)$_GET['products_id']); 
    And I'm using the following code to display the manufacturer's name and link:

    PHP Code:
    <a href="' . zen_href_link('manufacturers_id=' . $product_info->fields['manufacturers_id']) . '"><?php echo (($flag_show_product_info_manufacturer == and !empty($manufacturers_name)) ? $manufacturers_name ''); ?></a>
    Unfortunately, the link is just returning the code (' . zen_href_link('manufacturers_id=' . $product_info->fields['manufacturers_id']) . ') rather than the link to the manufacturer.

    The other thing I'm trying to do is incorporate a link to a product's category when viewing all/featured/new/special products. This is the code I'm using to pull the link and category name:

    PHP Code:
    <a href="' . zen_href_link(FILENAME_DEFAULT, 'cPath=' . $new_cpath) . '"><h4 class="product-cat">' . zen_get_categories_name_from_product($products_all->fields['products_id']) . '</h4></a
    Unfortunately, the link returns without the category id.

    Any ideas as to how I might get these two to work?

    Thanks.

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,521
    Plugin Contributions
    88

    Default Re: Direct Links to Product Manufacturer & Category

    The output of zen_href_link (a string) needs to be echoed via PHP since your code is within an HTML block:
    Code:
    <a href="'<?php echo zen_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $product_info->fields['manufacturers_id']); ?>'"><?php echo (($flag_show_product_info_manufacturer == 1 and !empty($manufacturers_name)) ? $manufacturers_name : ''); ?></a>

  3. #3
    Join Date
    Jul 2010
    Location
    Australia
    Posts
    131
    Plugin Contributions
    0

    Default Re: Direct Links to Product Manufacturer & Category

    Quote Originally Posted by lat9 View Post
    The output of zen_href_link (a string) needs to be echoed via PHP since your code is within an HTML block:
    Code:
    <a href="'<?php echo zen_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $product_info->fields['manufacturers_id']); ?>'"><?php echo (($flag_show_product_info_manufacturer == 1 and !empty($manufacturers_name)) ? $manufacturers_name : ''); ?></a>
    Of course, of course -- I knew that

    One alteration I had to make to the code you supplied was removing the extra apostrophes before and after the PHP tags, as below:

    PHP Code:
    <a href="<?php echo zen_href_link(FILENAME_DEFAULT'manufacturers_id=' $product_info->fields['manufacturers_id']); ?>"><?php echo (($flag_show_product_info_manufacturer == and !empty($manufacturers_name)) ? $manufacturers_name ''); ?></a>
    Thank you so much for pointing this out!

    Still working on the categories link -- I just can't seem to get the link to input the category ID

  4. #4
    Join Date
    Jul 2010
    Location
    Australia
    Posts
    131
    Plugin Contributions
    0

    Default Re: Direct Links to Product Manufacturer & Category

    No luck so far with the categories link... Anyone have any suggestions as to what I can do?

  5. #5
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,521
    Plugin Contributions
    88

    Default Re: Direct Links to Product Manufacturer & Category

    Unless your template has somehow removed them, that's what the breadcrumbs on the product details pages (like product_info) provide. What do you have for your code to display the categories link so far?

  6. #6
    Join Date
    Jul 2010
    Location
    Australia
    Posts
    131
    Plugin Contributions
    0

    Default Re: Direct Links to Product Manufacturer & Category

    Quote Originally Posted by lat9 View Post
    Unless your template has somehow removed them, that's what the breadcrumbs on the product details pages (like product_info) provide. What do you have for your code to display the categories link so far?
    I can't see any breadcrumbs using hyperlinks on product details pages... Care to point me in the right direction?

    What I'm working with:

    PHP Code:
    $display_category_name '<h4 class="product-cat"><a href="' zen_href_link(FILENAME_DEFAULT'cPath=' $new_cpath) . '">' zen_get_categories_name_from_product($products_all->fields['products_id']) . '</a></h4>'
    This results in a link with everything in it but the category ID:

    .../index.php?main_page=index&cPath=

  7. #7
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,521
    Plugin Contributions
    88

    Default Re: Direct Links to Product Manufacturer & Category

    Quote Originally Posted by MortalWombat View Post
    I can't see any breadcrumbs using hyperlinks on product details pages... Care to point me in the right direction?

    What I'm working with:

    PHP Code:
    $display_category_name '<h4 class="product-cat"><a href="' zen_href_link(FILENAME_DEFAULT'cPath=' $new_cpath) . '">' zen_get_categories_name_from_product($products_all->fields['products_id']) . '</a></h4>'
    This results in a link with everything in it but the category ID:

    .../index.php?main_page=index&cPath=
    Without a link to your site, I can't see if your template or configuration (Configuration->Layout Settings->Define Breadcrumb Status) has disabled the breadcrumbs' display (they're on by default).

    For the display of the categories' link, Zen Cart has already built up the cPath value as part of the default processing for a product-details page, so you could modify your code to read:
    Code:
    $display_category_name = '<h4 class="product-cat"><a href="' . zen_href_link(FILENAME_DEFAULT, 'cPath=' . $cPath) . '">' . zen_get_category_name ($current_category_id) . '</a></h4>';

  8. #8
    Join Date
    Jul 2010
    Location
    Australia
    Posts
    131
    Plugin Contributions
    0

    Default Re: Direct Links to Product Manufacturer & Category

    Quote Originally Posted by lat9 View Post
    Without a link to your site, I can't see if your template or configuration (Configuration->Layout Settings->Define Breadcrumb Status) has disabled the breadcrumbs' display (they're on by default).

    For the display of the categories' link, Zen Cart has already built up the cPath value as part of the default processing for a product-details page, so you could modify your code to read:
    Code:
    $display_category_name = '<h4 class="product-cat"><a href="' . zen_href_link(FILENAME_DEFAULT, 'cPath=' . $cPath) . '">' . zen_get_category_name ($current_category_id) . '</a></h4>';
    Thanks for that -- unfortunately, altering $new_cpath to $cPath changes nothing...

    I feel I should elaborate on what I'm doing, because I can't include a link to the site, since I'm currently working on a localhost.

    The link I'm trying to incorporate is not on the product listing, but on the all/featured/new/special products listing pages (i.e. ...index.php?main_page=products_all). The breadcrumbs are in place and working fine -- I just would like to include a link to the product category for clarity. For example, a customer is browsing special products and sees a product they like. They want to take a look at the other products in that category to compare what's available, but rather than having to find the category, they can just use the link to take them there directly.

    Hope that's clear -- I've gone and attached a screenshot as well anyway.
    Attached Images Attached Images  

  9. #9
    Join Date
    Jul 2010
    Location
    Australia
    Posts
    131
    Plugin Contributions
    0

    Default Re: Direct Links to Product Manufacturer & Category

    Sorry, forgot to mention in the above post -- the wording 'GIFT CERTIFICATES' in the link to the category.

  10. #10
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,521
    Plugin Contributions
    88

    Default Re: Direct Links to Product Manufacturer & Category

    Well, that's a bit more complicated, since (unless you're using the most-excellent SNAF plugin) the Specials, New, Advanced Search and Featured pages each have their own formatting scripts.

    The basic construct that you'll use on each of the pages is to gather each product's product_id and master_categories_id (present in the SQL data returned, in a page-specific database object variable) into variables of the same name and then:
    Code:
    $display_category_name = '<h4 class="product-cat"><a href="' . zen_href_link(FILENAME_DEFAULT, 'cPath=' . zen_get_product_path ($product_id)) . '">' . zen_get_category_name ($master_categories_id) . '</a></h4>';
    You'll then need to echo the $display_category_name variable where you want it in the output.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Manufacturer image on product category page
    By bobdog in forum Templates, Stylesheets, Page Layout
    Replies: 18
    Last Post: 25 Jan 2010, 02:22 AM
  2. Have a problem with blank pages from product & category links
    By GoldBuckle in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 22 Jul 2009, 12:44 AM
  3. Need help with code for direct product links for iDevAffiliate
    By rlfreshwater in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 20 Jan 2009, 02:22 PM
  4. Sorting by Manufacturer and Product Category
    By youderian in forum General Questions
    Replies: 1
    Last Post: 16 May 2008, 10:46 PM

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