I was right, I was missing that I was editing addProduct() and then testing updateProduct().
So the solution (if anyone should ever wonder
)
Firstly add the input fields to the admin product template (admin\view\template\catalog\product_form.tpl)
values are added later:
Code: Select all
<label for="image_alt">Alternative text</label>
<input type="text" name="image_alt" value="" id="image_alt"/>
<label for="image_alt">Image title</label>
<input type="text" name="image_title" value="" id="image_title"/>
Do this both at the static html and in the javascript addImage() function.
Then add the columns "alt_text" & "title_text" to the database table "product_image".
Then update the save product images call to the database in both the addProduct() and the updateProduct() methods in admin\model\catalog\product.php. Code is for addProduct():
Code: Select all
if (isset($data['product_image'])) {
$indexer = 0;
foreach ($data['product_image'] as $image) {
$this->db->query("INSERT INTO " . DB_PREFIX . "product_image SET product_id = '" . (int)$product_id . "', image = '" . $this->db->escape($image) . "'");
if (isset($data['product_image_alt'][$indexer])) {
$this->db->query("UPDATE " . DB_PREFIX . "product_image SET alt_text = '" . $data['product_image_alt'][$indexer] . "' WHERE product_id = '" . (int)$product_id . "' AND image = '" . $this->db->escape($image) . "'");
}
if (isset($data['product_image_title'][$indexer])) {
$this->db->query("UPDATE " . DB_PREFIX . "product_image SET title_text = '" . $data['product_image_title'][$indexer] . "' WHERE product_id = '" . (int)$product_id . "' AND image = '" . $this->db->escape($image) . "'");
}
$indexer++;
}
}
Now all that is left is updating the controller to include the values for redisplaying and then of course update the corresponding code in the store\catalog part to display the values to product page and voila! the accessability of the site is improved!