cclayton Posted November 27, 2013 Posted November 27, 2013 I have added a field into products table (products_image_alt) which is for the alt text of the image in the product listing table as I dont want to repeat the product name there. But I dont seem to be calling the field correctly in product_listing.php as no text is showing in the alt field when it outputs so it shows as: alt="" which is not correct. Can anyone help? <!-- listing //--> <div id="list_sec"> <div id="list_hd"> <?php $listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id'); if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3') ) ) { ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td> <td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td> </tr> </table> <?php } ?> </div> <?php // $info_box_contents = array(); //$info_box_contents[] = array('text' => sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B'))); //new contentBoxHeading($info_box_contents); $row = 0; $col = 0; // $info_box_contents = array(); if ($listing_split->number_of_rows > 0) { $rows = 0; $listing_query = tep_db_query($listing_split->sql_query); while ($listing = tep_db_fetch_array($listing_query)) { $rows++; $reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$listing['products_id'] . "'"); $reviews = tep_db_fetch_array($reviews_query); $reviews_query_average = tep_db_query("select (avg(reviews_rating)) as average_rating from " . TABLE_REVIEWS . " where products_id = '" . (int)$listing['products_id'] . "'"); $reviews_average = tep_db_fetch_array($reviews_query_average); $reveiws_stars = $reviews_average['average_rating']; $reveiws_rating = number_format($reveiws_stars,0); ?> <div class="list_phd"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '">'.$listing['products_name'].'</a>'; ?></div> <div class="list_box"> <div class="cimg_box"> <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_image_alt'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>' ?> </div> <div class="info"><?php echo substr(strip_tags($listing['products_description']),0,280) ?><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '" class="MoreDetail"> <b> More Details...</b></a>'?> <br /> <div style="margin-top:5px;margin-bottom:5px;"> <FONT COLOR="#FF6600"><?php if ((int)$reveiws_rating>0) echo TEXT_REVIEW_AVERAGE . ': ' . tep_image(DIR_WS_IMAGES . 'stars_' . (int)$reveiws_rating . '.gif', '', 70, 15, 'align=absmiddle') . '</a>'."(".number_format($reveiws_stars,1)."/5)"; ?></font><br> <FONT COLOR="#FF6600"><?php echo TEXT_DISPLAY_NUMBER_OF_REVIEWS_PRODUCT_INFO; echo " ".$reviews['count']; ?></font> </div> </div> <div class="price_box"> <?php if (tep_not_null($listing['specials_new_products_price'])) { echo 'Adult Price From: <br /><span class="old_price">' . $currencies->display_price($listing['products_price'], '', '', tep_get_tax_rate($listing['products_tax_class_id'])) . '</span><br /><span class="new_price">' . $currencies->display_price($listing['specials_new_products_price'], '', '', tep_get_tax_rate($listing['products_tax_class_id'])) . '</span>'; } else { echo 'Adult Price From: <br /><span class="new_price">' . $currencies->display_price($listing['products_price'], '', '', tep_get_tax_rate($listing['products_tax_class_id'])) . ' </span>'; } ?> <div class="booknow"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '"><img src="images/book_now_small.png" alt="Book This Tour Now" width="80" height="20" /></a>'?></div> </div> </div> <?php } } //new contentBox($info_box_contents); ?> </div> <!-- listing_eof //--> Founder & Director at CSC Tours Ltd
♥bruyndoncx Posted November 27, 2013 Posted November 27, 2013 you have to include it in the listing_sql statement you find amongst others in index.php . you also need to update products_new, specials and advanced_search_results if you also want the alt text to show in those listings in index.php I believe there is a standard column_list you can add it to KEEP CALM AND CARRY ON I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support). So if you are still here ? What are you waiting for ?! Find the most frequent unique errors to fix: grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt
MrPhil Posted November 28, 2013 Posted November 28, 2013 Make sure you are using "alt" text the right way. "alt" is text to be provided to visually-impaired users with a screen reader, in lieu of the graphics, or for those with graphics turned off, as well as search engine bots. "title" text is for the pop-up tooltip if you hover over the image (or other element). "alt" text is required per W3C standards, although browsers will let you get away with omitting that attribute. Give alt="" for trivial graphics (fancy bullets, dividers, spacers). "title" is usually just a little extra to improve the user interface, although search engines do read it too. For a long time, Internet Explorer incorrectly used "alt" text as the tooltip if no "title" was provided, so it was considered good practice to give an empty (title="") tooltip if you gave "alt" text. "alt" and "title" text can be the same, or different, or one or both can be empty.
cclayton Posted November 28, 2013 Author Posted November 28, 2013 you have to include it in the listing_sql statement you find amongst others in index.php . you also need to update products_new, specials and advanced_search_results if you also want the alt text to show in those listings in index.php I believe there is a standard column_list you can add it to I have added it to index.php but its still not showing, have I done it correctly? case 'PRODUCT_LIST_IMAGE_ALT': $listing_sql .= "pd.products_image_alt"; break; Founder & Director at CSC Tours Ltd
cclayton Posted November 30, 2013 Author Posted November 30, 2013 @@bruyndoncx any ideas? Sorry, I cant get it working. Founder & Director at CSC Tours Ltd
Recommended Posts
Archived
This topic is now archived and is closed to further replies.