RMD27 Posted September 24, 2010 Share Posted September 24, 2010 Warning: sprintf() [function.sprintf]: Too few arguments in */*/includes/boxes/reviews.php on line 37 Hi. Im getting this error when someone leaves a review, the error shows in the review box between the header bar and above the grey area which has the product photo. I have no clue what the problem is, I havent added any contributions related to Reviews but the shop is modified Any help at all much appreciated as to how to sort this out! This is line 37 $info_box_contents[] = array('text' => '<div align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'products_id=' . $random_product['products_id'] . '&reviews_id=' . $random_product['reviews_id']) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></div><a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'products_id=' . $random_product['products_id'] . '&reviews_id=' . $random_product['reviews_id']) . '">' . $rand_review_text . ' ..</a><br><div align="center">' . tep_image(DIR_WS_IMAGES . 'stars_' . $random_product['reviews_rating'] . '.gif' , sprintf(BOX_REVIEWS_TEXT_OF_5_STARS, $random_product['reviews_rating'])) . '</div>'); Link to comment Share on other sites More sharing options...
multimixer Posted September 24, 2010 Share Posted September 24, 2010 The function sprintf needs in this case 2 arguments sprintf(BOX_REVIEWS_TEXT_OF_5_STARS, $random_product['reviews_rating']) The one is BOX_REVIEWS_TEXT_OF_5_STARS The other is $random_product['reviews_rating'] So, there are 2 things to check 1) if you have in your includes/languages/english.php following define('BOX_REVIEWS_TEXT_OF_5_STARS', '%s of 5 Stars!'); 2) If you have in your includes/boxes/reviews.php in following query $random_select = "select r.reviews_id, r.reviews_rating, p.products_id, p.products_image, pd.products_name from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = r.products_id and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int)$languages_id . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'"; r.reviews_rating If you did nothing related to reviews, so I guess that you deleted the entry in english.php My community profile | Template system for osCommerce - New: Responsive | Feedback channel Link to comment Share on other sites More sharing options...
RMD27 Posted September 25, 2010 Author Share Posted September 25, 2010 The function sprintf needs in this case 2 arguments sprintf(BOX_REVIEWS_TEXT_OF_5_STARS, $random_product['reviews_rating']) The one is BOX_REVIEWS_TEXT_OF_5_STARS The other is $random_product['reviews_rating'] So, there are 2 things to check 1) if you have in your includes/languages/english.php following define('BOX_REVIEWS_TEXT_OF_5_STARS', '%s of 5 Stars!'); 2) If you have in your includes/boxes/reviews.php in following query $random_select = "select r.reviews_id, r.reviews_rating, p.products_id, p.products_image, pd.products_name from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = r.products_id and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int)$languages_id . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'"; r.reviews_rating If you did nothing related to reviews, so I guess that you deleted the entry in english.php Multimixer, Ive seen some of your other posts to help people and they are always gold and this post is no exception! I had this in my english file define('BOX_REVIEWS_TEXT_OF_5_STARS', '%s από 5 αστέρια/%s of 5 Stars!'); I use greek and english together hence the problem, I have deleted the Greek bit and its butter now, all sorted, many thanks :thumbsup: Link to comment Share on other sites More sharing options...
multimixer Posted September 25, 2010 Share Posted September 25, 2010 I think it would also work like this define('BOX_REVIEWS_TEXT_OF_5_STARS', '%s από 5 αστέρια / of 5 Stars!'); My community profile | Template system for osCommerce - New: Responsive | Feedback channel Link to comment Share on other sites More sharing options...
burt Posted September 25, 2010 Share Posted September 25, 2010 George is correct. You may also do this; define('BOX_REVIEWS_TEXT_OF_5_STARS', '%s από 5 αστέρια / %s of 5 Stars!'); Note you have TWO lots of %s .... So... sprintf(BOX_REVIEWS_TEXT_OF_5_STARS, $random_product['reviews_rating'], $random_product['reviews_rating']) I changed the colour to show the link between the "define" (language) and the "sprintf" (php code). Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.