fatmcgav Posted June 8, 2005 Posted June 8, 2005 Hey there, I've been working on modifying Featured Products 1.5.4 so that the user can specify a single product to be featured in the Index page, as a Product of the Week sort of thing. I've managed to edit the sql query in the featured prods module to query for the index column, which i've added to the featured table in my db. I've also added another set of status buttons in featured.php so that it's possible to toggle which one is the POW from the featured products page in admin. However, i'm having some problems getting the sql query to edit the db correct. Basically, all i've done is coppied the status change stuff, and changed the relavent fields and links... The DB query function tep_set_featured_index($featured_id, $index) { if ($index == '1') { return tep_db_query("update " . TABLE_FEATURED . " set index = '1', expires_date = NULL, date_status_change = NULL, where featured_id = '" . $featured_id . "'"); } elseif ($index == '0') { return tep_db_query("update " . TABLE_FEATURED . " set index = '0', date_status_change = now() where featured_id = '" . $featured_id . "'"); } else { return -1; } } The setindex case case 'setindex': tep_set_featured_index($HTTP_GET_VARS['id'], $HTTP_GET_VARS['flag']); tep_redirect(tep_href_link(FILENAME_FEATURED, '', 'NONSSL')); break; The Index buttons <?php if ($featured['index'] == '1') { echo tep_image(DIR_WS_IMAGES . 'icon_status_green.gif', IMAGE_ICON_STATUS_GREEN, 10, 10) . ' <a href="' . tep_href_link(FILENAME_FEATURED, 'action=setindex&flag=0&id=' . $featured['featured_id'], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_red_light.gif', IMAGE_ICON_STATUS_RED_LIGHT, 10, 10) . '</a>'; } else { echo '<a href="' . tep_href_link(FILENAME_FEATURED, 'action=setindex&flag=1&id=' . $featured['featured_id'], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_green_light.gif', IMAGE_ICON_STATUS_GREEN_LIGHT, 10, 10) . '</a> ' . tep_image(DIR_WS_IMAGES . 'icon_status_red.gif', IMAGE_ICON_STATUS_RED, 10, 10); } ?> If i click on either the green of the red buttons to toggle the POW, it gives me a 1064 mysql error with my code - however i cant see where it is, as the code is identical to the status update query, apart from changin a different field. Any ideas on what might be causing this? Cheers Fatmcgav Quote
fatmcgav Posted June 13, 2005 Author Posted June 13, 2005 Hey there, I've been working on modifying Featured Products 1.5.4 so that the user can specify a single product to be featured in the Index page, as a Product of the Week sort of thing. I've managed to edit the sql query in the featured prods module to query for the index column, which i've added to the featured table in my db. I've also added another set of status buttons in featured.php so that it's possible to toggle which one is the POW from the featured products page in admin. However, i'm having some problems getting the sql query to edit the db correct. Basically, all i've done is coppied the status change stuff, and changed the relavent fields and links... The DB query function tep_set_featured_index($featured_id, $index) { if ($index == '1') { return tep_db_query("update " . TABLE_FEATURED . " set index = '1', expires_date = NULL, date_status_change = NULL, where featured_id = '" . $featured_id . "'"); } elseif ($index == '0') { return tep_db_query("update " . TABLE_FEATURED . " set index = '0', date_status_change = now() where featured_id = '" . $featured_id . "'"); } else { return -1; } } The setindex case case 'setindex': tep_set_featured_index($HTTP_GET_VARS['id'], $HTTP_GET_VARS['flag']); tep_redirect(tep_href_link(FILENAME_FEATURED, '', 'NONSSL')); break; The Index buttons <?php if ($featured['index'] == '1') { echo tep_image(DIR_WS_IMAGES . 'icon_status_green.gif', IMAGE_ICON_STATUS_GREEN, 10, 10) . ' <a href="' . tep_href_link(FILENAME_FEATURED, 'action=setindex&flag=0&id=' . $featured['featured_id'], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_red_light.gif', IMAGE_ICON_STATUS_RED_LIGHT, 10, 10) . '</a>'; } else { echo '<a href="' . tep_href_link(FILENAME_FEATURED, 'action=setindex&flag=1&id=' . $featured['featured_id'], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_green_light.gif', IMAGE_ICON_STATUS_GREEN_LIGHT, 10, 10) . '</a> ' . tep_image(DIR_WS_IMAGES . 'icon_status_red.gif', IMAGE_ICON_STATUS_RED, 10, 10); } ?> If i click on either the green of the red buttons to toggle the POW, it gives me a 1064 mysql error with my code - however i cant see where it is, as the code is identical to the status update query, apart from changin a different field. Any ideas on what might be causing this? Cheers Fatmcgav <{POST_SNAPBACK}> Anybody???? Cheers Fatmcgav Quote
fatmcgav Posted June 15, 2005 Author Posted June 15, 2005 Somebody must know what the problem is.... Cheers Fatmcgav Quote
fatmcgav Posted June 16, 2005 Author Posted June 16, 2005 K, i'm getting this SQL error now if i try to disable a product: 1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'index = '0', date_status_change = now() where featured_id = '1' update featured set index = '0', date_status_change = now() where featured_id = '1' And This one if i try to enable a product: 1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'index = '1', expires_date = NULL, date_status_change = NULL, wh update featured set index = '1', expires_date = NULL, date_status_change = NULL, where featured_id = '3' The corresponding section in featured.php is: function tep_set_featured_index($featured_id, $index) { if ($index == '1') { return tep_db_query("update " . TABLE_FEATURED . " set index = '1', expires_date = NULL, date_status_change = NULL, where featured_id = '" . $featured_id . "'"); } elseif ($index == '0') { return tep_db_query("update " . TABLE_FEATURED . " set index = '0', date_status_change = now() where featured_id = '" . $featured_id . "'"); } else { return -1; } } Any ideas ppl? Cheers Fatmcgav Quote
fatmcgav Posted July 4, 2005 Author Posted July 4, 2005 K, i'm getting this SQL error now if i try to disable a product:And This one if i try to enable a product: The corresponding section in featured.php is: function tep_set_featured_index($featured_id, $index) { if ($index == '1') { return tep_db_query("update " . TABLE_FEATURED . " set index = '1', expires_date = NULL, date_status_change = NULL, where featured_id = '" . $featured_id . "'"); } elseif ($index == '0') { return tep_db_query("update " . TABLE_FEATURED . " set index = '0', date_status_change = now() where featured_id = '" . $featured_id . "'"); } else { return -1; } } Any ideas ppl? Cheers Fatmcgav <{POST_SNAPBACK}> Somebody out there must know how to fix this problem, PLEASE. I'm completely at a wits end with this one. Somebody, PLEASE... Quote
Get-Wireless 2 Posted December 10, 2006 Posted December 10, 2006 Y not use star product instead? Just change the title so instead of saying Star Product its says This Weeks Star Product? Quote Contributions installed so far Discount Coupon Codes Ultimate SEO Urls Star Product Product Description Header template Modern design Search box Add to favorites Discount Plus All Manufacturers Loginbox Best Lightbox V2 Optional Related Products Plus Many more
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.