Jump to content


Corporate Sponsors


Latest News: (loading..)

- - - - -

Changing the way products are displayed


10 replies to this topic

#1 jds580s

  • Community Member
  • 9 posts
  • Real Name:Justin Sirois

Posted 27 September 2004, 16:30

Hey, I'm looking for some advice on how to change the way products are listed in a category.

  <table width="180" border="0" cellpadding="0" cellspacing="0" class="product_listings">
                <tr>
                  <td><a href="#"><img src="images/temp_products/Prod1.jpg" width="85" height="108" border="0"></a></td>
                  <td width="35">&nbsp;</td>
                </tr>
                <tr>
                  <td><span class="product_name">Product Name</span><br>
                      <span class="product_price">Price</span></td>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <td class="product_description"><br>Description</td>
                  <td class="product_description">&nbsp;</td>
                </tr>
              </table>

Something like that is what I'm after, and I can find in product_listing.php where some of the current info comes from, but there are also some <td> tags and class attributes that are in the source of the final output, but not in this page. I'm not sure where they are coming from... Any help is much appreciated.

#2 dblake

  • Community Member
  • 875 posts
  • Real Name:Dennis

Posted 27 September 2004, 16:37

jds580s, on Sep 27 2004, 04:30 PM, said:

Hey, I'm looking for some advice on how to change the way products are listed in a category.

  <table width="180" border="0" cellpadding="0" cellspacing="0" class="product_listings">
                <tr>
                  <td><a href="#"><img src="images/temp_products/Prod1.jpg" width="85" height="108" border="0"></a></td>
                  <td width="35">&nbsp;</td>
                </tr>
                <tr>
                  <td><span class="product_name">Product Name</span><br>
                      <span class="product_price">Price</span></td>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <td class="product_description"><br>Description</td>
                  <td class="product_description">&nbsp;</td>
                </tr>
              </table>

Something like that is what I'm after, and I can find in product_listing.php where some of the current info comes from, but there are also some <td> tags and class attributes that are in the source of the final output, but not in this page.  I'm not sure where they are coming from... Any help is much appreciated.

<{POST_SNAPBACK}>


What you need to change is what is in the product_listing.php, in the modules folder. That other stuff your seeing is from that page too. What that file does is gets all the information together and then displays all the in a table defined by boxes.php (I think).

On the product_listing.php look for this $lc_text = ' and table it out. Make sure you pay attention to your "else" as you will need to add the same code there to get the same display. Then close the table out after you have everthing in the order you want. So basically you will have a table withing a table when your done.

-Dennis

Edited by dblake, 27 September 2004, 16:38.


#3 jds580s

  • Community Member
  • 9 posts
  • Real Name:Justin Sirois

Posted 27 September 2004, 17:29

dblake, on Sep 27 2004, 10:37 AM, said:

What you need to change is what is in the product_listing.php, in the modules folder.  That other stuff your seeing is from that page too.  What that file does is gets all the information together and then displays all the in a table defined by boxes.php (I think).

On the product_listing.php look for this $lc_text = ' and table it out.  Make sure you pay attention to your "else" as you will need to add the same code there to get the same display.  Then close the table out after you have everthing in the order you want.  So basically you will have a table withing a table when your done.

-Dennis

<{POST_SNAPBACK}>


As far as the modifying the $lc_text in product_listing.php, that sounds about like what I've done so far, except it seems that the table info from boxes.php isn't where that info is coming from. I just can't find the file that does have the info.

#4 omnivore

  • Community Member
  • 7 posts
  • Real Name:Pete

Posted 27 September 2004, 19:29

I'm having the same problem. I need to edit the way the product table is being generated.

product_listing.php makes the sql call, creates an array and send it to boxes.php via productListingBox($list_box_contents)

I can't find where the table structure if being created.
Something with the array data sent to tableBox class?
Any thoughts? My head is spinning.

--
pete

#5 dblake

  • Community Member
  • 875 posts
  • Real Name:Dennis

Posted 27 September 2004, 19:33

You don't need to modify the tablebox class, just put another table inside of that table through your lc text.

#6 omnivore

  • Community Member
  • 7 posts
  • Real Name:Pete

Posted 27 September 2004, 20:36

Where? Within the case statements?
Do you have an example?

--
pete

#7 dblake

  • Community Member
  • 875 posts
  • Real Name:Dennis

Posted 27 September 2004, 20:40

Here is examply from one of my sites.

    $listing = tep_db_query($listing_split->sql_query);
    while ($listing_values = tep_db_fetch_array($listing)) {

      $listing_values['products_name'] = tep_get_products_name($listing_values['products_id']);

      $lc_text= '<table align="left" class="newproducts1" border="0" cellpadding="2" cellspacing="0"><tr><td colspan="2">' . $listing_values['products_name'] . '</td></tr><tr><td align="left"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing_values['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing_values['products_image'], $listing_values['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td><td valign="top"><a class="wishtell" title="tell a friend" href="' . tep_href_link(FILENAME_TELL_A_FRIEND, 'products_id=' .$new_products['products_id']) . '">' . tep_image_button('tell_a_friend_small.gif') . '&nbsp;Tell a Friend</a><br><a class="wishtell" title="add to wishlist" href="' . tep_href_link(FILENAME_WISHLIST, 'products_id=' .$new_products['products_id']) . '">' . tep_image_button('wish_list_small.gif') . '&nbsp;Wishlist</a><br><a class="wishtell" title="more info" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image_button('details_small.gif') . '&nbsp;Details</a>';
      
   if ($listing_values['specials_new_products_price']) {
        $lc_text .= '<br><span class="price">' .  $currencies->display_price($listing_values['products_price'], tep_get_tax_rate($listing_values['products_tax_class_id'])) . '</span></s>&nbsp;&nbsp;<span class="productSpecialPrice">' . $currencies->display_price($listing_values['specials_new_products_price'], tep_get_tax_rate($listing_values['products_tax_class_id'])) . '</span>&nbsp;';
   } else {
        $lc_text .= '<br><span class="price">' . $currencies->display_price($listing_values['products_price'], tep_get_tax_rate($listing_values['products_tax_class_id'])) . '&nbsp;</span>';
      }  

   if (PRODUCT_LIST_BUY_NOW) {
        $lc_text .= '<br><br><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing_values['products_id'], 'NONSSL') . '">' . tep_image_button('button_buy_now.gif', TEXT_BUY . $listing_values['products_name'] . TEXT_NOW) . '</a>&nbsp;</td></tr><tr><br><br></tr></table>';      
      }

go here to see how it looks, http://www.mw-db.com/flowers

Edited by dblake, 27 September 2004, 20:43.


#8 jds580s

  • Community Member
  • 9 posts
  • Real Name:Justin Sirois

Posted 27 September 2004, 21:27

I was able to find what the correct table info, it was in boxes.php, but specifically includes/classes/boxes.php

To make the change I was after I needed to modify both product_listing.php and boxes.php

I needed it to create rows of 3 items with a line after every third, and a few other things, this may not have been the most elegent solution, but it is working.

Quote

I can't find where the table structure if being created.
Something with the array data sent to tableBox class?
Any thoughts? My head is spinning.

If I'm not mistaken, some of the table info is in product_listing.php, but the rest (and the part that I didn't like) was in boxes.php I didn't want a new row for each product like the default OSC display.

#9 inquisitivemind

  • Community Member
  • 203 posts
  • Real Name:Edwin
  • Location:Australia, Melbourne

Posted 28 September 2004, 06:53

jds580s

do you have a link to your store so we can see how it tuned out?

Cheers,

Edwin.

#10 omnivore

  • Community Member
  • 7 posts
  • Real Name:Pete

Posted 28 September 2004, 16:28

dblake,

EXCELLENT!!!
Thanks for the code sample.
It lead me to look at new_products.php.

The problem was that product_listing.php doesn't pass a column:
$list_box_contents[$cur_row][] = array('align' => $lc_align,
'params' => 'class="productListing-data"',
'text' => $lc_text);

New_products.php passed $col and has a control structure to format the number of columns per row:
$info_box_contents[$row][$col] = array('align' => 'center',
'params' => 'class="smallText" width="33%" valign="top"',
'text' => '...code');
$col ++;
if ($col > 2) {
$col = 0;
$row ++;
}


Thanks, I'm on my way now. Hopefully this will help another newbie.

--
pete

#11 jds580s

  • Community Member
  • 9 posts
  • Real Name:Justin Sirois

Posted 28 September 2004, 20:11

inquisitivemind, on Sep 28 2004, 12:53 AM, said:

jds580s

do you have a link to your store so we can see how it tuned out?

Cheers,

Edwin.

<{POST_SNAPBACK}>


Right now I'm still working on other problems so if you go there you may see nothing, or error pages.

It went from this
[img]http://www.onthez.com/temphosting/jacqueline/ys_cart.jpg[/img]
to this
[img]http://www.onthez.com/temphosting/jacqueline/ys_design.jpg[/img]

the link to the testing site is http://www.onthez.com/cart
Nothing is final in this version, I'm just trying to get it all to work together.