Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Marking Products as Sold..does this code look right?


arc

Recommended Posts

Posted

hi,

 

in a nutshell, i wouldl like to leave sold products still on the site. only problem i am encountering is that instead of displaying the price below my image, i want it to say sold out.

 

i located the block of code in product_listings.php

 

here is the original block of code:

else {

             $lc_text = ' ' . $currencies->display_price($listing_values['products_price'], tep_get_tax_rate($listing_values['products_tax_class_id'])) . ' ';

           }

 

i tried to insert an "if" statement like this:

 

else {

   if ($listing_values['products_quantity'] == '0') { 

   $lc_text = 'SOLD';

   } else { 

             $lc_text = ' ' . $currencies->display_price($listing_values['products_price'], tep_get_tax_rate($listing_values['products_tax_class_id'])) . ' ';

          	 }

	 }

 

Thanks!

 

Johnny

Posted

Remove your code - it's not necessary!!! Just go to the admin panel - click configuration -> Stock- and where it says Mark Products out of stock - click this line and just edit the stars (***) to say SOLD. One little tip is to put a space before SOLD otherwise it ends up too close.

Posted

lysander,

 

thanks but that only shows up when they add it to their basket right? i have that setup and it doesn't do what i need it to do.

 

i need it to say SOLD on the category page.

 

thanks! =)

Posted

OOOppss - Sorry I didn't quite read your post properly.

 

I'm not able to test your code - but it looks like there may be a small syntax error - I think that if you are on an 'else...if' statement the if has to be with it not the other side or the curly braces.

 

(http://uk2.php.net/manual/en/control-structures.elseif.php)

 

 

if ($a > $B) {

print "a is bigger than b";

} elseif ($a == $B) {

print "a is equal to b";

} else {

print "a is smaller than b";

}

 

 

So yours should look like

 

elseif ($listing_values['products_quantity'] == '0') {

$lc_text = 'SOLD';

}

else {

$lc_text = ' ' . $currencies->display_price($listing_values['products_price'], tep_get_tax_rate($listing_values['products_tax_class_id'])) . ' ';

}

}

 

 

But I'm no programmer!!! So I hope this helps.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...