Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Displaying author for books, artists for CD, none for neither


Guest

Recommended Posts

Posted

Hi,

 

I've gone through all of the steps for adding a new field (author), but now my client has decided that they want to sell music as well as books!

 

What file do I need to edit, and what code is needed, to say "If this is a book, show author; it if is music, show artist?" Does that make sense? I presume I only need to edit one line, add an IF command and change the display of "author" or "artist" depending on the category?

 

Also, at the moment, my pages show "Author: " when I haven't entered an author. How do I get it to not show that, if there is no author (e.g. the Bible, or a Koran)?

Posted

you could add another column in the manufacturers table like manufacturer_type and some control code in the admin side to edit it. Then instead of displaying the hard-coded manufacturer (or author in your case) you use the manufacturer_type to display.

 

And for the 2nd if the manufacturers_id is null for a product you do not display anything. I thought that's the default for osc.

Posted

Hi Enigma,

 

I'm not using the manufacturers table for author. I've added another entry to products, so I now have:

 

products_author varchar(45) Yes NULL

 

The problem with the display is a mistake in my php. I currently have:

 

 <p><?php echo TEXT_PRODUCTS_AUTHOR; ?>: <?php echo $product_info['products_author']; ?></p>

 

Clearly, that first echo needs to be surrounded by an "if there is an author" command. How would I do that in Osc?

Archived

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

×
×
  • Create New...