Results 1 to 9 of 9
  1. #1
    Join Date
    Nov 2007
    Posts
    16
    Plugin Contributions
    0

    Default Can I add products_url into product_listing.php?

    I would like to display the product URL field in the product_listing.php page. This way it would show up in the product description.

    The reason I would like to do this is because I am using this to link to the MSDS for the product, and the store is just a showcase, not for purchasing, so there isn't a need to go all the way into the product info page if you didn't need to.

    Normally the text says "For more information, please view this product's website."

    I have changed it to say "For more information, please view this product's MSDS."

    I just need it to show up in the other page. I have tried using the code from the tpl_product_info.php page with very slight modifications to the quotes to get it to function without breaking the description, and I have gotten the description to draw out, but without the URL even though the code is there. I believe that the issue is that I never get the URL field from the database into this file, but I am at a loss of how to do that.

    I started with the else statement because that is the type of description that shows up on my store. Basically I added the <!--bof Product URL--> to the <!--eof Product URL-->

    Here is the code that I have added @ line 150:

    else {
    $lc_text = '<h3 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->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=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '</a></h3><div class="listingDescription">' . zen_trunc_string(/*zen_clean_html*/(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '


    <!--bof Product URL -->
    <?php
    if (zen_not_null($products_url)) {
    if ($flag_show_product_info_url == 1) {
    ?>

    <p id="productInfoLink" class="productGeneral centeredContent">

    <?php echo sprintf(TEXT_MORE_INFORMATION, zen_href_link(FILENAME_REDIRECT, "action=url&goto=" . urlencode($products_url), "NONSSL", true, false)); ?>

    </p>

    <?php
    } // $flag_show_product_info_url
    }
    ?>
    <!--eof Product URL -->
    </div>';

  2. #2
    Join Date
    Nov 2007
    Posts
    16
    Plugin Contributions
    0

    Default Re: Can I add products_url into product_listing.php?

    Please excuse me for not mentioning that this is NOT the original product_listing.php file, but the one for the column_layout_grid_2_3_1

  3. #3
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: Can I add products_url into product_listing.php?

    Why not try and place the url as the first thing in the description
    Zen-Venom Get Bitten

  4. #4
    Join Date
    Nov 2007
    Posts
    16
    Plugin Contributions
    0

    Default Re: Can I add products_url into product_listing.php?

    I am not the one managing the store. I want to keep it consistent, so I would like to use the already provided easy button for them to click so I can have a consistent style to everything. I am already having to add the code into the description for the Tech Sheet because some products have an MSDS and a tech sheet, but most all products will require the MSDS. Trying to go the simplest route for the client.

  5. #5
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Can I add products_url into product_listing.php?

    Quote Originally Posted by littlepunk29 View Post
    Please excuse me for not mentioning that this is NOT the original product_listing.php file, but the one for the column_layout_grid_2_3_1
    Please also post your ZC version number.


    You'll need to add the products_url field to the SELECT statement in your /includes/index_filters/default_filter.php file if you want it to be available in the $listing_sql query and the $listing->fields array as $listing->fields['products_url']
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  6. #6
    Join Date
    Nov 2007
    Posts
    16
    Plugin Contributions
    0

    Default Re: Can I add products_url into product_listing.php?

    So sorry, v1.5.0


    In my default_filter.php file,

    I found a ton of "$listing_sql"

    not sure which one to put it in.

    I searched but cannot find "$listing->fields"

  7. #7
    Join Date
    Feb 2010
    Location
    Syracuse, NY
    Posts
    2,159
    Plugin Contributions
    17

    Default Re: Can I add products_url into product_listing.php?


  8. #8
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Can I add products_url into product_listing.php?

    Great concentrated info there!

    You also need to change the way you are writing your code. You are trying to output the link immediately instead of putting it into $lc_text for later output.
    PHP Code:
    PRODUCT_LIST_DESCRIPTION) . '


    <!--bof Product URL -->
    <?php
    if (zen_not_null($products_url)) {
    if (
    $flag_show_product_info_url == 1) {
    ?>

    <p id="productInfoLink" class="productGeneral centeredContent">

    <?php echo sprintf(TEXT_MORE_INFORMATIONzen_href_link(FILENAME_REDIRECT"action=url&goto=" urlencode($products_url), "NONSSL"truefalse)); ?>

    </p>

    <?php
    // $flag_show_product_info_url
    }
    ?>
    <!--eof Product URL -->
    </div>';
    needs to become something like
    PHP Code:
    PRODUCT_LIST_DESCRIPTION) . $product_url_link '
    </div>'

    and before the $lc_text = line, add this
    PHP Code:
    $product_url_link '';
    if (
    zen_not_null($products_url)) {
      if (
    $flag_show_product_info_url == 1) {
        
    $product_url_link '
    <!--bof Product URL -->
    <p class="productInfoLink productGeneral centeredContent">
    sprintf(TEXT_MORE_INFORMATIONzen_href_link(FILENAME_REDIRECT"action=url&goto=" urlencode($products_url), "NONSSL"truefalse)) . '
    </p>
    <!--eof Product URL -->
    '
    ;
      } 
    // $flag_show_product_info_url

    I don't know if $flag_show_product_info_url is set in the product listing page, or only in the product info page. If this doesn't work, that would be something to look at.
    Last edited by gjh42; 23 Mar 2013 at 02:12 AM.

  9. #9
    Join Date
    Nov 2007
    Posts
    16
    Plugin Contributions
    0

    Default Re: Can I add products_url into product_listing.php?

    I have edited my 2 files to no avail. I have read the other forum topic, and tried to get the
    pd.products_url
    in my default_filter.php file.
    I have added it in 4 places like it said. Line 31, 46, 61, and 76. Please let me know if this is correct.
    default_filter.zip

    Here is my product_listing.php
    I have edited at line 152 and the end of 167.
    product_listing.zip

    Nothing changes, but at the same time, it doesn't break anything either.

    Thanks for the help!

 

 

Similar Threads

  1. php files called when accessing product_listing.php page
    By Tonyy in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 4 Dec 2011, 12:46 AM
  2. product_listing.php
    By niccol in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 8 Jun 2009, 11:12 PM
  3. Add a line between products in product_listing.php
    By gibsonshop in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 5 Sep 2007, 10:14 PM
  4. add manufacturer link to product_listing.php
    By winky3d in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 9 Aug 2007, 01:31 AM
  5. Can I point products_url to /media directory?
    By hrm in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 15 Mar 2007, 03:57 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