Bryndog Posted August 11, 2005 Posted August 11, 2005 Hi, Im looking to change the default setup on the main page to have the 'specials' appear here instead of the 'new products'. I want them to appear in the same way as the 'new products' and if possible have the new products go to the side bar where the specials used to be. Dont even know if it is possible. Any help would be appriciated. L8erz, Bryn :thumbsup: Bryndog, a lone crusader charged with not messing up Thanks to any an all for your help and advice.
♥Monika in Germany Posted August 11, 2005 Posted August 11, 2005 Hi,Im looking to change the default setup on the main page to have the 'specials' appear here instead of the 'new products'. I want them to appear in the same way as the 'new products' and if possible have the new products go to the side bar where the specials used to be. Dont even know if it is possible. Any help would be appriciated. L8erz, Bryn :thumbsup: <{POST_SNAPBACK}> sure you can do it. Create a new file copying the new_products.php (includes/modules), naming it specials.php Adjust the sql query to the one in the current specials box, and then link it instead the new_products.php to your index.php :-) Monika addicted to writing code ... can't get enough of databases either, LOL! my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum Interactive Media Award July 2007 ~ category E-Commerce my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...
Bryndog Posted August 16, 2005 Author Posted August 16, 2005 sure you can do it. Create a new file copying the new_products.php (includes/modules), naming it specials.php Adjust the sql query to the one in the current specials box, and then link it instead the new_products.php to your index.php <{POST_SNAPBACK}> Hi Monika, Thanks for posting. I have manged to do as you said - copying new_products.php and renaming it to specials.php. I then looked at the query and insterted the sql from the proper specials page. Im quite new to this, so I got as far as displaying the specials products but they are displaying the proper price and not the special price. I think there is something wrong or missing from the code which displays the results, but I really dont know. :huh: I know that there is stuff in here that I dont need, but Im just cutting and pasting. <?php $info_box_contents = array(); $info_box_contents[] = array('text' => sprintf(TABLE_HEADING_SPECIALS, strftime('%B'))); new contentBoxHeading($info_box_contents); $new_products_query = tep_db_query("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added DESC"); $specials_split = new splitPageResults($specials_query_raw, MAX_DISPLAY_SPECIAL_PRODUCTS); $row = 0; $col = 0; $info_box_contents = array(); while ($new_products = tep_db_fetch_array($new_products_query)) { $new_products['products_name'] = tep_get_products_name($new_products['products_id']); $info_box_contents[$row][$col] = array('align' => 'center', 'params' => 'class="smallText" width="25%" valign="top"', 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><br>' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id']))); $col ++; if ($col > 2) { $col = 0; $row ++; } } new contentBox($info_box_contents); ?> <!-- new_products_eof //--> Any ideas coz I got none! Newbie, Bryn Bryndog, a lone crusader charged with not messing up Thanks to any an all for your help and advice.
♥Monika in Germany Posted August 16, 2005 Posted August 16, 2005 Hi Monika, Thanks for posting. I have manged to do as you said - copying new_products.php and renaming it to specials.php. I then looked at the query and insterted the sql from the proper specials page. Im quite new to this, so I got as far as displaying the specials products but they are displaying the proper price and not the special price. I think there is something wrong or missing from the code which displays the results, but I really dont know. :huh: I know that there is stuff in here that I dont need, but Im just cutting and pasting. <?php ?$info_box_contents = array(); ?$info_box_contents[] = array('text' => sprintf(TABLE_HEADING_SPECIALS, strftime('%B'))); ?new contentBoxHeading($info_box_contents); ?$new_products_query = tep_db_query("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added DESC"); ? ?$specials_split = new splitPageResults($specials_query_raw, MAX_DISPLAY_SPECIAL_PRODUCTS); ?$row = 0; ?$col = 0; ?$info_box_contents = array(); ?while ($new_products = tep_db_fetch_array($new_products_query)) { ? ?$new_products['products_name'] = tep_get_products_name($new_products['products_id']); ? ?$info_box_contents[$row][$col] = array('align' => 'center', ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'params' => 'class="smallText" width="25%" valign="top"', ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><br>' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id']))); ? ?$col ++; ? ?if ($col > 2) { ? ? ?$col = 0; ? ? ?$row ++; ? ?} ?} ?new contentBox($info_box_contents); ?> <!-- new_products_eof //--> Any ideas coz I got none! Newbie, Bryn <{POST_SNAPBACK}> lol Bryn, this will be fast and painless: get rid of this line, a copy error and it's just "de trop" :-))) $specials_split = new splitPageResults($specials_query_raw, MAX_DISPLAY_SPECIAL_PRODUCTS); then when you call the price, yu are only calling the regular price :-) $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) ... will do you no good right? let's see how the price is called in the specials box: '<s>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>' you have to change the query name from $random_product to $new_products, and then just copy this in ... should work just fine! :-) Monika addicted to writing code ... can't get enough of databases either, LOL! my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum Interactive Media Award July 2007 ~ category E-Commerce my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...
Bryndog Posted August 16, 2005 Author Posted August 16, 2005 lol Bryn, this will be fast and painless:get rid of this line, a copy error and it's just "de trop" :-))) $specials_split = new splitPageResults($specials_query_raw, MAX_DISPLAY_SPECIAL_PRODUCTS); then when you call the price, yu are only calling the regular price :-) $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) ... will do you no good right? let's see how the price is called in the specials box: '<s>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>' you have to change the query name from $random_product to $new_products, and then just copy this in ... should work just fine! <{POST_SNAPBACK}> Thanks Monica, Cheers for that, I'm now getting a parse error now though. Parse error: parse error, expecting `')'' in /home/httpd/html/sdesiresshop/catalog/includes/modules/specials.php on line 29 Can you have a look at this code and tell me if I have done what you told me to do, just in case it is just me...which is highly possible :-" <?php $info_box_contents = array(); $info_box_contents[] = array('text' => sprintf(TABLE_HEADING_SPECIALS, strftime('%B'))); new contentBoxHeading($info_box_contents); $new_products_query = tep_db_query("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added DESC"); $row = 0; $col = 0; $info_box_contents = array(); while ($new_products = tep_db_fetch_array($new_products_query)) { $new_products['products_name'] = tep_get_products_name($new_products['products_id']); $info_box_contents[$row][$col] = array('align' => 'center', 'params' => 'class="smallText" width="33%" valign="top"', 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><br><s>' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . $currencies->display_price($new_products['specials_new_products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '</span>' $col ++; if ($col > 2) { $col = 0; $row ++; } } new contentBox($info_box_contents); ?> <!-- new_products_eof //--> Cheers Monica... your a star! Bryn Bryndog, a lone crusader charged with not messing up Thanks to any an all for your help and advice.
♥Monika in Germany Posted August 16, 2005 Posted August 16, 2005 Thanks Monica,Cheers for that, I'm now getting a parse error now though. Can you have a look at this code and tell me if I have done what you told me to do, just in case it is just me...which is highly possible :-" <?php ?$info_box_contents = array(); ?$info_box_contents[] = array('text' => sprintf(TABLE_HEADING_SPECIALS, strftime('%B'))); ?new contentBoxHeading($info_box_contents); ?$new_products_query = tep_db_query("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added DESC"); ?$row = 0; ?$col = 0; ?$info_box_contents = array(); ?while ($new_products = tep_db_fetch_array($new_products_query)) { ? ?$new_products['products_name'] = tep_get_products_name($new_products['products_id']); ? ?$info_box_contents[$row][$col] = array('align' => 'center', ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'params' => 'class="smallText" width="33%" valign="top"', ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><br><s>' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . $currencies->display_price($new_products['specials_new_products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '</span>' ? ?$col ++; ? ?if ($col > 2) { ? ? ?$col = 0; ? ? ?$row ++; ? ?} ?} ?new contentBox($info_box_contents); ?> <!-- new_products_eof //--> Cheers Monica... your a star! Bryn <{POST_SNAPBACK}> lol you forgot to close that array at the end ... right after '</span>' it should work after that is fixed! I think it needs a ); but check it out if all brackets have partners :thumbsup: :-) Monika addicted to writing code ... can't get enough of databases either, LOL! my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum Interactive Media Award July 2007 ~ category E-Commerce my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...
Bryndog Posted August 16, 2005 Author Posted August 16, 2005 lol you forgot to close that array at the end ... right after '</span>' it should work after that is fixed! I think it needs a ); but check it out if all brackets have partners :thumbsup: <{POST_SNAPBACK}> Hi Monika, Yess!!! You were right! All sorted now. Thankyou so much for helping me out. I am learning this stuff...but slowly. I`m a Designer with an urge to learn php...and i really dont know why. Anyway, I hope the sun is out where you are, thanks again. Dont work too hard. Bryn Bryndog, a lone crusader charged with not messing up Thanks to any an all for your help and advice.
imlifu Posted August 28, 2005 Posted August 28, 2005 Adjust the sql query to the one in the current specials box, and then link it instead the new_products.php to your index.php <{POST_SNAPBACK}> How to adjust the sql query and link it instead... I am quite lost, can explain a bit more, thanks
Wendy James Posted August 28, 2005 Posted August 28, 2005 Specials on index contribution http://www.oscommerce.com/community/contributions,123 Wendy James Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
imlifu Posted August 28, 2005 Posted August 28, 2005 thanks Wendy, sort out after I got hint from your reply to another member's question.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.