Hello,
I've a solution for adding Sold Out on the attribute if the stock of it is 0.
It works for dropdown boxes, radio buttons and checkboxes.
I've modified kuroi's attributes.php file, adding the suggestions of other people and figuring it out for dropdowns.
- First you need to add this to:
includes\languages\english\custom\product_info.php
if product_info.php is not there it will be in
includes\languages\english\product_info.php
Once you have added the below move the file to your custom directory
PHP Code:
define('TEXT_ATTRIBUTES_NOT_IN_STOCK',' Sold Out');
- I've changed the function "function zen_draw_pull_down_menu" in includes\functions\html_output.php
PHP Code:
function zen_draw_pull_down_menu($name, $values, $default = '', $parameters = '', $required = false) {
$field = '<select name="' . zen_output_string($name) . '"';
$soldout = "";
if (zen_not_null($parameters)) $field .= ' ' . $parameters;
$field .= '>' . "\n";
if (empty($default) && isset($GLOBALS[$name])) $default = stripslashes($GLOBALS[$name]);
for ($i=0, $n=sizeof($values); $i<$n; $i++) {
/* Added by TB on 16/2/2007 */
/*need to check if Sold Out occurs in the option tag for the dropdown*/
if(strpos($values[$i]['text'], "Sold Out")) $soldout = 'class ="red bold"';
else $soldout = "";
$field .= ' <option '.$soldout.' value="' . zen_output_string($values[$i]['id']) . '"';
if ($default == $values[$i]['id']) {
$field .= ' selected="selected"';
}
$field .= '>' . zen_output_string($values[$i]['text'], array('"' => '"', '\'' => ''', '<' => '<', '>' => '>')) . '</option>' . "\n";
}
$field .= '</select>' . "\n";
if ($required == true) $field .= TEXT_FIELD_REQUIRED;
return $field;
}
- Then I modified kuroi's attributes.php file. Located in
includes\modules\custom\attributes.php.
See attached. Rename your old one to something like attributes.php-old and upload this one.
- Then I added the class .red to my stylesheet, which just sets color:red
If anybody cares to try this in a test environment for me after they have installed the stock by attributes module.
Please let me know how it goes. It should work, works for me, but no guarantees.
Bookmarks