Results 1 to 9 of 9
  1. #1
    Join Date
    Nov 2014
    Location
    Paignton
    Posts
    39
    Plugin Contributions
    0

    Default Would like to edit tpl_product_info_display.php to create hyperlink to URL

    I am trying to change my product display template so that each product will show the $products_url as a hyperlink

    My site is an affiliate site so there are no products on this site
    http://hols.club/butlins/index.php?m...&products_id=7

    At the moment I have each product showing as:
    For more information and to make a booking for this holiday Visit: Butlins | What's On and Special Offers

    using a generic url link, however I would like to use the url I have populated in the catalog.

    However when I use href for $products_url it is adding hols.club/Butlins before the redirect and I can't work out how to just to get href to use only the $products_url which I know when I echo the variable is just the www address I need?

    I have been searching the last few days through help and forums and tested a number of options but can't quite get it to work.
    All help very much appreciated
    Kind Regards
    Thomas

  2. #2
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Would like to edit tpl_product_info_display.php to create hyperlink to URL

    There's a couple of things that come to mind, one of which is a post that lat9 put out there a while back about templates and ZC version 1.5.3 and using the product url that you are trying to access/use. I can't seem to find it at the moment, but it does relate. Also without my looking deeper, I was thinking that there is/was a selection that can be made to make a zen_href_link call as a static uri. (Not sure that's considered a solution, but thought it bypassed adding the server info when set true.)

    At the moment though this is something of an educated guess, I haven't tried it or looked at the associated code today to validate.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Would like to edit tpl_product_info_display.php to create hyperlink to URL

    Ahh, went and searched one of my saved folders of subscriptions and found this: not sure if it will help you.

    http://www.zen-cart.com/showthread.p...s-URL-handling!
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #4
    Join Date
    Nov 2014
    Location
    Paignton
    Posts
    39
    Plugin Contributions
    0

    Default Re: Would like to edit tpl_product_info_display.php to create hyperlink to URL

    Hi, sorry for the delay in replying as my hosting servers went down. Many thanks for the response, I will go and try that out right now :) I did see the post earlier but was concerned it might not be what I want, but an educated guess is good and will look at it carefully, if you happened remember selection that can be made to make a zen_href_link call as a static uri that would be great as well.
    Last edited by hols.club; 24 Nov 2014 at 06:22 PM.

  5. #5
    Join Date
    Nov 2014
    Location
    Paignton
    Posts
    39
    Plugin Contributions
    0

    Default Re: Would like to edit tpl_product_info_display.php to create hyperlink to URL

    Many thanks mc12345678 for giving me the confidence to try that out (as it needed a few files to be replaced) but worked through the instructions and voila I now have a url pointing to the address which is in the product url.

    All I have to do now is fiddle around with the formatting to get the word "webpage" in blue. Problem solved though to get redirection working.

  6. #6
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Would like to edit tpl_product_info_display.php to create hyperlink to URL

    Quote Originally Posted by hols.club View Post
    Hi, sorry for the delay in replying as my hosting servers went down. Many thanks for the response, I will go and try that out right now :) I did see the post earlier but was concerned it might not be what I want, but an educated guess is good and will look at it carefully, if you happened remember selection that can be made to make a zen_href_link call as a static uri that would be great as well.
    Btw, I see that you were able to solve your problem, though for the benefit of others if you could post your solution that would help.

    In regards to the above question of a static uri, I've looked at the function as provided in 1.5.0 through www.zen-cart.com/docs and found the following:
    The call to the function as published there takes the following parameters: $page='', $parameters='', $connection='NONSSL', $add_session_id=true, $search_engine_safe = true, $static=false, $use_dir_ws_catalog=true where if a value is not provided or the call is shortened then the variable takes on the above default value(s).

    As for the function, it always returns with at least a server string related to your site as the first part of the returned uri, so even a static page is in reference to your site... But it is possible to serve up any page that is hosted on your site, whether it be specifically in the ZC store, or elsewhere in the path. What is also noticed though through the above thread that was provided it is possible to redirect to somewhere else, so as discovered can make things work to use the zen_href_link function to redirect away from the site, even a static page...

    Anyways, the applicable code is found in includes/functions/html_output.php to understand how the function zen_href_link works based on the input of the above variables... Just remember that generally speaking you are trying to get things purchased from your site, not someone else's. :)
    Last edited by mc12345678; 24 Nov 2014 at 07:58 PM. Reason: remove hash symbols added by my editor.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  7. #7
    Join Date
    Nov 2014
    Location
    Paignton
    Posts
    39
    Plugin Contributions
    0

    Default Re: Would like to edit tpl_product_info_display.php to create hyperlink to URL

    Ah, although I think I have messed it up as now it is not doing it! I am sure once I updated the site it did redirect but now it is just going back to the index directory?

    Any thoughts?

  8. #8
    Join Date
    Nov 2014
    Location
    Paignton
    Posts
    39
    Plugin Contributions
    0

    Default Re: Would like to edit tpl_product_info_display.php to create hyperlink to URL

    Apologies, my fault, in a rush and placed back my old non working file onto the new one before taking a copy and editing that one. All working again now. Will update what I have done and will also look at your other post as that also seems excellent.

    Many thanks again

  9. #9
    Join Date
    Nov 2014
    Location
    Paignton
    Posts
    39
    Plugin Contributions
    0

    Default Re: Would like to edit tpl_product_info_display.php to create hyperlink to URL

    The Following steps will hopefully detail how I resolved the problem.

    Problem:
    For my store I wished to reproduce the $products_url directly under the Product Name and Price to reinforce to the customer that by clicking on the link it will take them to the product.

    However my URLs are external to the site so did not follow sitename/websitefolder but directly to a www page
    and as such just using $products_url meant the redirection failed.

    Solution
    User lat9 developed compatible_redirects.zip http://www.zen-cart.com/attachment.p...6&d=1405686000

    I downloaded the zip file
    Backed up my site
    And extracted the files in the correct directories

    Once uploaded I found <!--eof free ship icon --> within tpl_product_info_display.php and moved the section from the end of the file to this point <!--bof Product URL -->
    <?php
    if (zen_not_null($products_url)) {
    if ($flag_show_product_info_url == 1) {
    //-bof-compatible_redirects-lat9 *** 1 of 1 ***
    /*
    ?>
    <p id="productInfoLink" class="productGeneral centeredContent"><?php echo sprintf(TEXT_MORE_INFORMATION, zen_href_link(FILENAME_REDIRECT, 'action=product&products_id=' . zen_output_string_protected($_GET['products_id']), 'NONSSL', true, false)); ?></p>
    <?php
    */
    ?>
    <p id="productInfoLink" class="productGeneral centeredContent"><?php echo sprintf(TEXT_MORE_INFORMATION, $product_redirect->products_url_link ($_GET['products_id'])); ?></p>
    <?php
    //-eof-compatible_redirects-lat9 *** 1 of 1 ***
    } // $flag_show_product_info_url
    }
    ?>
    <!--eof Product URL -->

    This then put the link where I wanted it to be.

 

 

Similar Threads

  1. v151 Product URL on tpl_product_info_display.php to display only when user is logged in?
    By Matt Staines in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 24 Oct 2013, 09:39 AM
  2. v150 Would like to create a customer header/side navigation
    By nitrous_oxide_cowboy in forum Templates, Stylesheets, Page Layout
    Replies: 10
    Last Post: 30 Apr 2012, 12:51 AM
  3. I would like to edit what my model display says
    By lizar5- in forum Setting Up Categories, Products, Attributes
    Replies: 4
    Last Post: 2 Jun 2008, 02:27 AM
  4. Would Like to Edit Orders
    By JS1scuba in forum Managing Customers and Orders
    Replies: 1
    Last Post: 14 Mar 2008, 06:49 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