Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2008
    Location
    Cleethorpes
    Posts
    1,229
    Plugin Contributions
    6

    red flag Display product price in product listing titles

    I need to move the price in the product listing so it sits just under the title.

    I can do this by adding . $listing->fields['products_price'] . like this . $listing->fields['products_name'] . $listing->fields['products_price'] .

    But it adds two extra zero's on the end so the price displays like this 72.0000

    I did it before but can't remember how to strip the extra zero's.
    Nick Smith - Venture Design and Print
    https://venturedesignandprint.co.uk

  2. #2
    Join Date
    Jan 2007
    Posts
    1,483
    Plugin Contributions
    10

    Default Re: Display product price in product listing titles

    You can permanently change it to 2 decimals in includes/functions/functions_prices, I think there are 4 places to change from 4 to 2. Or you can do round($listing->fields['products_price'], 2) to apply 2 decimal rounding just for that part.

    Zen Cart and it's community are the best!!

  3. #3
    Join Date
    Dec 2007
    Location
    Payson, AZ
    Posts
    1,076
    Plugin Contributions
    15

    Default Re: Display product price in product listing titles

    Quote Originally Posted by Nick1973 View Post
    $listing->fields['products_name'] . $listing->fields['products_price'] .
    .
    try
    Code:
    $currencies->format($listing->fields['products_price']);
    Which should match whatever currencies the user selected.
    Dave
    Always forward thinking... Lost my mind!

  4. #4
    Join Date
    Sep 2008
    Location
    Cleethorpes
    Posts
    1,229
    Plugin Contributions
    6

    red flag Re: Display product price in product listing titles

    Quote Originally Posted by davewest View Post
    try
    Code:
    $currencies->format($listing->fields['products_price']);
    Which should match whatever currencies the user selected.
    That seems to work without any need to edit includes/functions/functions_prices

    Thanks to both of you for these suggestions, davewest - yours is the one I will use as its more simple.
    Nick Smith - Venture Design and Print
    https://venturedesignandprint.co.uk

  5. #5
    Join Date
    Sep 2008
    Location
    Cleethorpes
    Posts
    1,229
    Plugin Contributions
    6

    Default Re: Display product price in product listing titles

    Even better - I realised after implementing davewest's solution, which works, what happens if I apply a special offer? That solution doesn't pick up the offer.

    So I just moved from roughly line 106 just below case 'PRODUCT_LIST_PRICE':

    $lc_price = zen_get_products_display_price($listing->fields['products_id'])

    So now my Product Listing Title in modules/TEMPLATENAME/product_listing.php looks like this:

    $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'] . '<br /><h2>' . $lc_price = zen_get_products_display_price($listing->fields['products_id']) . '</h2>' . '</a></h3><div class="listingDescription">' . zen_trunc_string((stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '</div>';


    Then on line 108 I just commented out $lc_text = $lc_price; - this is to stop the price from displaying twice on the product listing.

    Like this:

    /*$lc_text = $lc_price;*/
    Nick Smith - Venture Design and Print
    https://venturedesignandprint.co.uk

 

 

Similar Threads

  1. v151 Display Product Attribute Price on Product LISTING Page
    By y0ul053 in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 23 Aug 2013, 07:46 PM
  2. Display highest price product listing
    By buns1525 in forum Basic Configuration
    Replies: 2
    Last Post: 20 Sep 2011, 12:02 AM
  3. display product listing by price, color..
    By fcegarra in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 19 Sep 2007, 01:48 AM
  4. Display Lowest Price in Product listing
    By gairneybank in forum Basic Configuration
    Replies: 6
    Last Post: 10 Sep 2006, 07:23 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