Results 1 to 3 of 3

Hybrid View

  1. #1
    Join Date
    May 2007
    Posts
    471
    Plugin Contributions
    0

    Default New Field In Product Listing Page

    In an effort to try and automate my site a bit more with inventory I added a new field called products_stock that encases my manufacturers api code for product inventory.

    I have it working on the products just fine, but I would also like to offer the stock amount on the product listing page......since I do allow people to purchase out of stock items I want to let them see before they go to the product page whether it is on stock or not so they do not waste their time!

    You can see it in action here right above the cart icon:

    http://outdoorplaytoys.com/big-wheels-12v-go-kart

    But I would also like to add it to this page for all the products right above the details box:

    http://outdoorplaytoys.com/injusa

    I just used php on the product info page - but am lost on the product listing page on how to add this in?!?!?!

    Any help would be GREATLY appreciated......
    Jill || I Love Zen Cart Templates || 2 Dogs Design
    I Love To Help But Let's Keep It Public Please To Help Others!

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: New Field In Product Listing Page

    I just used php on the product info page - but am lost on the product listing page on how to add this in
    In the file and the additional required files tpl_modules_product_listing.php
    Somewhere in those files an array is built
    Sorry I don't know php well enough to tutor on the array but this may assist you
    Zen-Venom Get Bitten

  3. #3
    Join Date
    May 2007
    Posts
    471
    Plugin Contributions
    0

    Default Re: New Field In Product Listing Page

    Ok after a BUNCH of tweaking I think I got this!

    In your product_listing.php file (in your CUSTOM folder of course)

    Add you new field to this code by going from this:

    PHP Code:
    $lc_text '<h3 class="itemTitle"><a href="' zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > and $_GET['filter_id']) > ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 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) . '</div>' 
    to this:

    PHP Code:
    $lc_text '<h3 class="itemTitle"><a href="' zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > and $_GET['filter_id']) > ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 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) . '</div>' $listing->fields['products_stock']; 
    You can see I added . $listing->fields['products_stock']; at the end.

    Then you need to go to your includes/index_filters/default_filter.php and add in your new query just by following along with what is already there....

    Easier than I thought it would be!

    You can see what was done by visiting here:

    http://outdoorplaytoys.com/feber-toys

    below the product name is a field for the inventory which is an API to my manufacturers website.....
    Jill || I Love Zen Cart Templates || 2 Dogs Design
    I Love To Help But Let's Keep It Public Please To Help Others!

 

 

Similar Threads

  1. How do I add a custom field to my Product Listing Page?
    By rbarbour in forum Templates, Stylesheets, Page Layout
    Replies: 11
    Last Post: 31 Aug 2010, 02:46 PM
  2. Display new product field in product listing
    By yakbuttertea in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 13 Mar 2009, 10:42 PM
  3. add one more field on product listing page.
    By vr4indian in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 17 Oct 2006, 01:49 PM
  4. Problem adding new field to product listing
    By rwoody in forum General Questions
    Replies: 1
    Last Post: 9 Oct 2006, 08:04 AM
  5. product listing page to look like new listing page
    By christienicole in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 28 Jun 2006, 03:19 PM

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