If this is your first visit, check our documentation. To post, register or login.
Forums / Setting Up Categories, Products, Attributes / showing "Starting at:" in Product listing

showing "Starting at:" in Product listing

Started by mattyzee on 1 Feb 2009, 10:51 AM · Views: 4,568

Results 21 to 28 of 28
24 Apr 2009, 3:57 PM
#21
jymontoya avatar

jymontoya

New Zenner

Join Date:
Apr 2009
Posts:
54
Plugin Contributions:
0

showing "Starting at:" in Product listing

Close now...

Added in RED to product_listing.php

break;
case 'PRODUCT_LIST_PRICE':
$lc_price = zen_get_products_display_price($listing->fields['products_id']) . '<br />';
$lc_align = 'right';
$lc_text = 'Starting At: ' . $lc_price;

But that's going to do it for all products, even if they don't have attributes... not cool.

Does that products_display_price need to be something else, like products_attributes_price

?

24 Apr 2009, 4:24 PM
#22
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,903
Plugin Contributions:
23

Re: showing "Starting at:" in Product listing

You're falling into the TM abyss by putting literals where variables should go. Put THE_VARIABLE where it should go and define it properly at the source.

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com

24 Apr 2009, 5:05 PM
#23
jymontoya avatar

jymontoya

New Zenner

Join Date:
Apr 2009
Posts:
54
Plugin Contributions:
0

Re: showing "Starting at:" in Product listing

Yep. But I only know enough about programming theory to be dangerous at the actual programming. I try to stick to modifing / emulating other code to get my desired solution.

AND! I GOT IT!

http://greenleafexhibits.com/index.php?main_page=index&cPath=1

Now only products with attributes show the Starting At: text before the price.

I used a contrib from: http://www.zen-cart.com/forum/showthread.php?t=55185&page=2

but modified their product_listing.php to:

//bof Starting At: price//
case 'PRODUCT_LIST_PRICE':

        $lc_price = zen_get_products_actual_price((int)$listing->fields['products_id'],20000);
        $lc_price = '$'.number_format($lc_price, 2);
        $lc_align = 'right';
        if (zen_has_product_attributes($listing->fields['products_id']) != zen_get_products_actual_price((int)$listing->fields['products_id'])){
            $lc_text =  $lc_price.'<br />';
            }else{
			//Change the next line to your own text/formatting requirements
            $lc_text='Starting At:  ' . $lc_price . '<br />';
            }

//eof Starting At: price//

Yay! I should quit my job and start fixing TM templates! Oh wait, that is my job right now! DOH! hehehe.

Thanks for all your help.

24 Apr 2009, 8:13 PM
#24
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,903
Plugin Contributions:
23

Re: showing "Starting at:" in Product listing

Glad you got it going.:clap:

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com

27 Oct 2009, 11:43 PM
#25
robert_morgan04 avatar

robert_morgan04

New Zenner

Join Date:
Aug 2009
Posts:
2
Plugin Contributions:
0

Re: showing "Starting at:" in Product listing

jymontoya:

Yep. But I only know enough about programming theory to be dangerous at the actual programming. I try to stick to modifing / emulating other code to get my desired solution.

AND! I GOT IT!

http://greenleafexhibits.com/index.php?main_page=index&cPath=1

Now only products with attributes show the Starting At: text before the price.

I used a contrib from: http://www.zen-cart.com/forum/showthread.php?t=55185&page=2

but modified their product_listing.php to:

//bof Starting At: price//
case 'PRODUCT_LIST_PRICE':

        $lc_price = zen_get_products_actual_price((int)$listing->fields['products_id'],20000);
        $lc_price = '$'.number_format($lc_price, 2);
        $lc_align = 'right';
        if (zen_has_product_attributes($listing->fields['products_id']) != zen_get_products_actual_price((int)$listing->fields['products_id'])){
            $lc_text =  $lc_price.'<br />';
            }else{
  		//Change the next line to your own text/formatting requirements
            $lc_text='Starting At:  ' . $lc_price . '<br />';
            }

//eof Starting At: price//

Yay! I should quit my job and start fixing TM templates! Oh wait, that is my job right now! DOH! hehehe.

Thanks for all your help.

I had the same problem and found this which nearly worked for me, but this is better

//bof Starting At: price//
case 'PRODUCT_LIST_PRICE':

        $lc_price = zen_get_products_actual_price((int)$listing->fields['products_id'],20000);
        $lc_price = zen_get_products_actual_price((int)$listing->fields['products_id'],20000);
		$lc_price = '<br/><strong>£'.number_format($lc_price, 2).'</strong>';
		$lc_align = 'right';
		if (zen_has_product_attributes($listing->fields['products_id']) != zen_get_products_actual_price((int)$listing->fields['products_id'])){
		$lc_text = '<br/>'.$lc_price.'<br />';
		}else{
		//Change the next line to your own text and formatting requirements//
		$lc_text='<br/><i>'.TEXT_BASE_PRICE.'</i>' . $lc_price . '<br />';
		}

//eof Starting At: price//

The //Change the next line.... comment was not terminated with // so it didn't work (I think). Also I have added in some line breaks which gives a slightly more open look to the display, set the price display to strong and I have substituted the variable TEXT_BASE_PRICE in place of the fixed text "Starting At". This means that you will have the same text at the top of the Product Info Page and in the right column of the Product Listing Page, although presumably if you needed 2 different wordings you could set up another variable in the language file. This way this bit will work for other languages.

What would be very helpful now, although I have no idea how to do it, would be to insert code so that instead of the fixed currency delimiter (in my case £) and price, the price displayed is that set by the currency selection. The code that creates the price on the product info page must use a very similar logic, but I haven't been able to figure it out.

Any clues, anyone?

Robert

https://www.earthswisdom.co.uk

18 Apr 2011, 11:52 PM
#26
mypctechs avatar

mypctechs

New Zenner

Join Date:
Aug 2009
Location:
Phoenix, Arizona
Posts:
6
Plugin Contributions:
0

Re: showing "Starting at:" in Product listing

After scouring the net and forums for a better piece of code than the one shown here, I developed my own. This code is based on the same that displays the product info page and is much more condensed, plus modified just one line in product_listing.php:

//bof Starting At: price//
case 'PRODUCT_LIST_PRICE':
$lc_price = zen_get_products_display_price($listing->fields['products_id']) . '<br />';
$lc_align = 'right';
$lc_text = ((zen_has_product_attributes_values($listing->fields['products_id']) and zen_get_show_product_switch($listing->fields['products_id'], 'starting_at')) ? TEXT_BASE_PRICE : '') . $lc_price;
//eof Starting At: price//

Andre Morris
seenBEST Web Design

26 May 2011, 10:15 PM
#27
djbelize avatar

djbelize

New Zenner

Join Date:
Mar 2010
Posts:
32
Plugin Contributions:
0

Re: showing "Starting at:" in Product listing

mypctechs:

After scouring the net and forums for a better piece of code than the one shown here, I developed my own. This code is based on the same that displays the product info page and is much more condensed, plus modified just one line in product_listing.php:

//bof Starting At: price//
case 'PRODUCT_LIST_PRICE':
$lc_price = zen_get_products_display_price($listing->fields['products_id']) . '<br />';
$lc_align = 'right';
$lc_text = ((zen_has_product_attributes_values($listing->fields['products_id']) and zen_get_show_product_switch($listing->fields['products_id'], 'starting_at')) ? TEXT_BASE_PRICE : '') . $lc_price;
//eof Starting At: price//


Hello mypctechs ... that code work amazing !!!! i just want to know if there's a way to make it look more appealing ... like change the font size and color of just the "starting at:" ... any help on that would eb great but i'm happy already with just your code ... thnx !
14 Jun 2011, 2:25 AM
#28
thomaswhiteeagle avatar

thomaswhiteeagle

New Zenner

Join Date:
May 2007
Posts:
93
Plugin Contributions:
0

Re: showing "Starting at:" in Product listing

My question is slightly related to this thread albeit slightly so I figured good a place as any to put this rather than making a new thread altogether. I know how to change the "Starting at" text (english.php) What I would like to figure out is how to add some text "AFTER" the price, eg. "Starting at: 1.99 each"

I find a few files with this text (a call to Text_Base_Price) such as tpl_product_info_display.php which looks like it might be the place but unsure and if so not sure how to do what I want:

Line #70 : echo $one_time . ((zen_has_product_attributes_values((int)$_GET['products_id']) and $flag_show_product_info_starting_at == 1) ? TEXT_BASE_PRICE : '') . zen_get_products_display_price((int)$_GET['products_id']);