Guest Posted August 17, 2005 Posted August 17, 2005 Folks, I finally gave up in total dispair. I have tried editing every file i thought possible, or found tutorials on. I am trying to edit the way to 'new products' on the index.php are output-ed. I have been trying for 5 freakin days (seriously, all day every day). I just cannot figure out how to write the code right on the includes/modules/new_products.php which i assume controls that box from the info I have researched. Here is my code, broken up/organized where its seperated for the product Image, Name, Price. I just CANNOT for the life of me figure out how to implement HTML into it. Any help would be SO much appreciated! <?php ?> <!-- new_products //--> <?php $info_box_contents = array(); $info_box_contents[] = array('text' => sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B'))); new contentBoxHeading($info_box_contents); if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) { $new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); } else { $new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_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="150" 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 //--> thanks again in advanced!
Wendy James Posted August 17, 2005 Posted August 17, 2005 Would help more if you could tell us how you want it laid out. How you add the html will depend on what you want it to do. Wendy James Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Guest Posted August 17, 2005 Posted August 17, 2005 Would help more if you could tell us how you want it laid out. How you add the html will depend on what you want it to do. <{POST_SNAPBACK}> I just want to put the output data into a HTML table. I just want to change the layout basically. I'm trying to figure out how to write/edit the code properly to do so, i tried a lot but kept getting parse error after parse error.
HQ Secure Posted August 18, 2005 Posted August 18, 2005 Same here. I've figured out it has someting to do with $row = 0; $col = 0; and perhaps if ($col > 4) { $col = 0; $row ++; } Personally I'm trying to get two columns with four rows. When I change the $row to four and the $col to 2 all new products dissapear altogether?! Anyone?
oscommerceking Posted August 18, 2005 Posted August 18, 2005 Same here. I've figured out it has someting to do with $row = 0; ?$col = 0; and perhaps if ($col > 4) { ? ? ?$col = 0; ? ? ?$row ++; ? ?} Personally I'm trying to get two columns with four rows. When I change the $row to four and the $col to 2 all new products dissapear altogether?! Anyone? <{POST_SNAPBACK}> Along with this, does anyone now how to limit the sizes of the images ( file size wise ), which are displayed in the new products info box, i don't want to change the filesize of the actual product just how it is displayed on the homepage, it is taking up nearly 200k on my homepage and thats 1/3 of my page size for homepage Thanks Wendy Jon My Contributions: Add Search + Drop Down Anywhere, Eliminate Subcategories in Drop Down
Wendy James Posted August 18, 2005 Posted August 18, 2005 To change the image size just change ['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) to ['products_name'], '50', '50') or whatever you want the dimentions to be. To change the layout you need to edit the line with 'text' => How you do it will all depend on what you want the box to do. Wendy James Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Wendy James Posted August 18, 2005 Posted August 18, 2005 Same here. I've figured out it has someting to do with $row = 0; ?$col = 0; and perhaps if ($col > 4) { ? ? ?$col = 0; ? ? ?$row ++; ? ?} Personally I'm trying to get two columns with four rows. When I change the $row to four and the $col to 2 all new products dissapear altogether?! Anyone? <{POST_SNAPBACK}> I believe you can set the number of new products to show up in that box in your admin area max values. if ($col > 4) { is the only value you need to edit to change the number of products that show up in a row Wendy James Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.