armada21st Posted April 6, 2005 Share Posted April 6, 2005 where can i get the new products code and featured code without the info box code added to it. i want to change the look of my site and add these boxes to the header but when i have tried i end up with the info box as well. is there a package of these codes some where. thanks Link to comment Share on other sites More sharing options...
Guest Posted April 6, 2005 Share Posted April 6, 2005 You'll need this code section: 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="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>' . $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); Of course, you can create another class contentBox to match your specification. And use different CSS classes to change the looks and feel of it. Link to comment Share on other sites More sharing options...
mark27uk3 Posted April 6, 2005 Share Posted April 6, 2005 Hi, Can I jump in on this thread about creating a new class for info boxes, I have wanted to do this for a long time and I have now decided to give it a go! On my main page I use the star_products contribution, now when the box contents are called it is by this line: new contentBox($star_products_output); and this line new contentBox($star_products); I am presuming that to create a new class I would need to copy/change this code in includes/classes/boxes.php class contentBox extends tableBox { function contentBox($contents) { $info_box_contents = array(); $info_box_contents[] = array('text' => $this->contentBoxContents($contents)); $this->table_cellpadding = '1'; $this->table_parameters = 'class="infoBox"'; $this->tableBox($info_box_contents, true); } function contentBoxContents($contents) { $this->table_cellpadding = '4'; $this->table_parameters = 'class="infoBoxContents"'; return $this->tableBox($contents); } } And then obviously change the classes in the stylesheet (infoBox & infoBoxContents) Am I on the right lines here? Thanks Mark Lifes a bitch, then you marry one, then you die! Link to comment Share on other sites More sharing options...
Guest Posted April 6, 2005 Share Posted April 6, 2005 I'm thinking about creating a new class based on the original. Basically create another copy of the class contentBox along side the old one in the same file. class contentBox extends tableBox { function contentBox($contents) { $info_box_contents = array(); $info_box_contents[] = array('text' => $this->contentBoxContents($contents)); $this->table_cellpadding = '1'; $this->table_parameters = 'class="infoBox"'; $this->tableBox($info_box_contents, true); } function contentBoxContents($contents) { $this->table_cellpadding = '4'; $this->table_parameters = 'class="infoBoxContents"'; return $this->tableBox($contents); } } class contentBox extends tableBox { function contentBox($contents) { $info_box_contents = array(); $info_box_contents[] = array('text' => $this->contentBoxContents($contents)); $this->table_cellpadding = '1'; $this->table_parameters = 'class="infoBox"'; $this->tableBox($info_box_contents, true); } function contentBoxContents($contents) { $this->table_cellpadding = '4'; $this->table_parameters = 'class="infoBoxContents"'; return $this->tableBox($contents); } } Now that we have 2 of the same class next to each other, we'll modify one of them: class contentBoxStoreHeader extends tableBox { function contentBoxStoreHeader($contents) { $info_box_contents = array(); $info_box_contents[] = array('text' => $this->contentBoxContents($contents)); $this->table_cellpadding = '1'; $this->table_parameters = 'class="infoBoxStoreHeader"'; $this->tableBox($info_box_contents, true); } function contentBoxContents($contents) { $this->table_cellpadding = '4'; $this->table_parameters = 'class="infoBoxContentsStoreHeader"'; return $this->tableBox($contents); } } The changes to the duplicated class are: - PHP's class name from contentBox to contentBoxStoreHeader - PHP's class constructor from contentBox to contentBoxStoreHeader - CSS class from infoBox to infoBoxStoreHeader - CSS class from infoBoxContents to infoBoxContentsStoreHeader And of course, we have to call the correct class by changing: new contentBox($star_products_output); to new contentBoxStoreHeader($star_products_output); Link to comment Share on other sites More sharing options...
Guest Posted April 6, 2005 Share Posted April 6, 2005 P.S. Don't forget to create new CSS classes based on the original ones - infoBoxStoreHeader - infoBoxContentsStoreHeader Link to comment Share on other sites More sharing options...
mark27uk3 Posted April 6, 2005 Share Posted April 6, 2005 I have done all the changes, you can see them here. Now how about changing the infobox heading to just have the title and an underline all the way across the width of the box instead of the dark grey background I have. Thanks Mark Lifes a bitch, then you marry one, then you die! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.