arc Posted July 2, 2003 Posted July 2, 2003 hi everyone, i tried doing a search but was unable to find anything. my question is this: as of right now, everytime a product is sold (all my products are unique so there is only one inventory), it is removed from the site. i would like to be able to leave sold-out products on the site. instead of showing the price, i would like to have it say SOLD OUT. that way my customers know what i had but now is sold. thanks in advance, Johnny
Guest Posted July 3, 2003 Posted July 3, 2003 you can set it to check stock and if stock is 0 is shows the sold_out image instead of the cart button
arc Posted July 4, 2003 Author Posted July 4, 2003 how about this? my products are displayed 3 to a row thanks to a contribution i found. I found the following code that makes it display it in 3 columns (so it shows the image, then shows the product name below it and then below that..the price). // Class modified by Denis class tableBox2 { var $table_border = '0'; var $table_width = '100%'; var $table_cellspacing = '0'; var $table_cellpadding = '2'; var $table_parameters = ''; var $table_row_parameters = ''; var $table_data_parameters = ''; var $denis_counter = 0; // class constructor function tableBox2($contents, $direct_output = false) { $tableBox_string = '<table border="' . $this->table_border . '" width="' . $this->table_width . '" cellspacing="' . $this->table_cellspacing . '" cellpadding="' . $this->table_cellpadding . '"'; if ($this->table_parameters != '') $tableBox_string .= ' ' . $this->table_parameters; $tableBox_string .= '><tr valign="top" align="center">' . "n"; for ($i=0; $i<sizeof($contents); $i++) { if ($denis_counter == 4) { $denis_counter = 0; $tableBox_string .= ' </tr><tr><td><br></td></tr><tr valign="top" align="center">'; } $denis_counter ++; if ($contents[$i]['form']) $tableBox_string .= $contents[$i]['form'] . "n"; $tableBox_string .= ' <td width="25%"'; if ($this->table_row_parameters != '') $tableBox_string .= ' ' . $this->table_row_parameters; if ($contents[$i]['params']) $tableBox_string .= ' ' . $contents[$i]['params']; $tableBox_string .= '><table border=0>' . "n"; if (is_array($contents[$i][0])) { for ($x=0; $x<sizeof($contents[$i]); $x++) { if ($contents[$i][$x]['text']) { $tableBox_string .= ' <tr><td'; if ($contents[$i][$x]['align'] != '') $tableBox_string .= ' align="' . $contents[$i][$x]['align'] . '"'; if ($contents[$i][$x]['params']) { $tableBox_string .= ' ' . $contents[$i][$x]['params']; } elseif ($this->table_data_parameters != '') { $tableBox_string .= ' ' . $this->table_data_parameters; } $tableBox_string .= '>'; if ($contents[$i][$x]['form']) $tableBox_string .= $contents[$i][$x]['form']; $tableBox_string .= $contents[$i][$x]['text']; if ($contents[$i][$x]['form']) $tableBox_string .= '</form>'; $tableBox_string .= '</td></tr>' . "n"; } } } else { $tableBox_string .= ' <tr><td'; if ($contents[$i]['align'] != '') $tableBox_string .= ' align="' . $contents[$i]['align'] . '"'; if ($contents[$i]['params']) { $tableBox_string .= ' ' . $contents[$i]['params']; } elseif ($this->table_data_parameters != '') { $tableBox_string .= ' ' . $this->table_data_parameters; } $tableBox_string .= '>' . $contents[$i]['text'] . '</td></tr>' . "n"; } $tableBox_string .= ' </table></td>' . "n"; if ($contents[$i]['form']) $tableBox_string .= '</form>' . "n"; } $tableBox_string .= '</tr></table>' . "n"; if ($direct_output) echo $tableBox_string; return $tableBox_string; } } i found a snippet of code that'll get rid of the "add to cart button" and displays a "product is out of stock on hold" message as below: <?php if (tep_get_products_stock($products_id) > 0) { ?> <?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?> <?php } else { ?> <em><font color="#ff0000">This item has been sold or put on hold</font></em><br> <?php //Comment out the line below...the grey image is still clickable if you do not //echo tep_image_submit('button_in_cart_grey.gif', 'Cannot add to cart - out of stock')?> <?php } ?> anyone have an idea on when a product is sold, it'll replace the price w/ a message that says SOLD OUT?
arc Posted July 5, 2003 Author Posted July 5, 2003 disregard the code i posted above. it was the wrong set of coding.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.