tbrides:
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
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
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.
This was posted in Feburary, I made the changes and it seems to work with Zen Cart 1.3.7.1. I can't get the dropdown to say sold out in red (it says sold out, I just can't get it to be red).
Can anyone explain exactly what the following instructions require.
Then I added the class .red to my stylesheet, which just sets color:red
Someone else asked the same thing and was told
have you added the style to your custom stylesheet and for the radio buttons and check boxes i wrapped TEXT_ATTRIBUTES_NOT_IN_STOCK in attributes.php in span tags with the class red and bold
That is not specific enough could someone post exactly what I need to put in the stylesheet. I am very new to this.
Thanks