Does anybody know how I can get alt text into my attributes images please?
Currently they output like this:
As you can see the alt text is missing.HTML Code:<img src="images/attributes/single-block.png" alt="" width="270" height="41">
Printable View
Does anybody know how I can get alt text into my attributes images please?
Currently they output like this:
As you can see the alt text is missing.HTML Code:<img src="images/attributes/single-block.png" alt="" width="270" height="41">
Admin > Configuration > Product Info - Show Option Values Name Below Attributes Image
https://docs.zen-cart.com/user/admin...tributes_image
Ah you're right. OK. Take includes/modules/attributes.php and copy to includes/modules/YOUR_TEMPLATE/attributes.php.
Then go through that file. Everywhere you see the config flag I mentioned PRODUCT_IMAGES_ATTRIBUTES_NAMES
right before that you will see a call to zen_image. It's in 6 places.
Change those zen_image calls so that the second parameter to zen_image is $products_options->fields['products_options_values_name']
(this is the value which is shown when PRODUCT_IMAGES_ATTRIBUTES_NAMES = 1).
Sorry if I am misunderstanding here.already exists. So where would I change it in the below?PHP Code:
$products_options->fields['products_options_values_name']
PHP Code:
if (!empty($products_options->fields['attributes_image'])) { $tmp_attributes_image .= '<div class="custom-control custom-checkbox attribImg">' . zen_draw_checkbox_field('id[' . $products_options_id . ']['.$products_options_value_id.']', $products_options_value_id, $selected_attribute, 'id="' . $inputFieldId . '" ' . $data_properties . $field_disabled) . '<br>' . zen_image(DIR_WS_IMAGES . $products_options->fields['attributes_image']) . '<label class="custom-control-label attribsCheckbox" for="' . $inputFieldId . '">' . (PRODUCT_IMAGES_ATTRIBUTES_NAMES == '1' ? '<br>' . $products_options->fields['products_options_values_name'] : '') . (!empty($products_options_details_noname) ? '<br>' . $products_options_details_noname : '') . '</label></div>' . "\n"; } else { $tmp_attributes_image .= '<div class="custom-control custom-checkbox attribImg">' . zen_draw_checkbox_field('id[' . $products_options_id . ']['.$products_options_value_id.']', $products_options_value_id, $selected_attribute, 'id="' . $inputFieldId . '" ' . $data_properties . $field_disabled) . '<br />' . '<label class="custom-control-label attribsCheckbox" for="' . $inputFieldId . '">' . $products_options->fields['products_options_values_name'] . (!empty($products_options_details_noname) ? '<br>' . $products_options_details_noname : '') . '</label></div>' . "\n"; } break;
Change
zen_image(DIR_WS_IMAGES . $products_options->fields['attributes_image'])
to
zen_image(DIR_WS_IMAGES . $products_options->fields['attributes_image'], $products_options->fields['products_options_values_name'])
in each place it's next to the check of PRODUCT_IMAGES_ATTRIBUTES_NAMES (because that's where the attributes image is shown).
If you know how to submit a PR, this would be a good fix to add to 1.5.8.
Even better if the attributes images could also have an alt text box in the admin when images are uploaded to attributes. This could be useful for SEO purposes as they could then contain keywords that are relative to the product. Obviously without Keyword Stuffing.
Where would I do that then?