Forums / Templates, Stylesheets, Page Layout / need php help for new/featured/specials output

need php help for new/featured/specials output

Views: 807

Results 1 to 6 of 6
1 Mar 2013, 5:08 PM
#1
keneso avatar

keneso

Totally Zenned

Join Date:
May 2009
Posts:
1,273
Plugin Contributions:
3

need php help for new/featured/specials output

Hi,

I'd like to output the products into a three column layout div, like

<div>
<div class ="33percent">product [B]1[/B]</div><div class ="33percent">product [B]2[/B]</div><div class ="33percent">product [B]3[/B]</div>
</div>
<div>
<div class ="33percent">product [B]4[/B]</div><div class ="33percent">product [B]5[/B]</div><div class ="33percent">product [B]6[/B]</div>
</div>
<div>
<div class ="33percent">product [B]7[/B]</div><div class ="33percent">product [B]8[/B]</div><div class ="33percent">product [B]9[/B]</div>
</div>

Thank you

1 Mar 2013, 11:07 PM
#3
keneso avatar

keneso

Totally Zenned

Join Date:
May 2009
Posts:
1,273
Plugin Contributions:
3

Re: need php help for new/featured/specials output

Thank you.
I know about them, and I do use SNAF, but they output as % division based on the number of products per row.

I need specifically the output as described above, which could be seen as output in table, but done in css.
I apologize as perhaps the choice of class="33percent" creates confusion, that class could be named anything.

1 Mar 2013, 11:21 PM
#4
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: need php help for new/featured/specials output

yes I guess I was confused to what your request was :blush:

I am still unsure what you are trying to accomplish, I have created the grid effect using pure css for my homepage categories with sub-categories addon, it is old and doesn't validate but with additional work, it can.

here is a link, like I said, I'm not sure if this is what you are looking to do. It display iss css and not # per row.

zcadditions[DOT]com/zc10193/

2 Mar 2013, 4:01 PM
#5
keneso avatar

keneso

Totally Zenned

Join Date:
May 2009
Posts:
1,273
Plugin Contributions:
3

Re: need php help for new/featured/specials output

Thanks for your patience.

I apologize for being a bit confusing, the example you posted is close to what I am trying to achieve; however there are two main differences:
1 - I want to control the number of columns in the html output, i.e. <div>s as opposed to css
2 - I needed it for the new/featured/specials modules

Trying to be more specific:
in includes/modules/new_products.php file I see the output loop for the new products

$list_box_contents[$row][$col] = array('params' => 'class="centerBoxContentsNew centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"',
    'text' => (($new_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $new_products->fields['products_image'], $new_products->fields['products_name'], IMAGE_PRODUCT_NEW_WIDTH, IMAGE_PRODUCT_NEW_HEIGHT) . '</a><br />') . '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">' . $new_products->fields['products_name'] . '</a><br />' . $products_price);

where if I am correct it creates the rows, and columns

$list_box_contents[$row][$col]

based on the number of new products, and the width of each column is given by this piece

{
    $col_width = floor(100/$num_products_count);
  } else {
    $col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS);
  }

Now, I would like to remove that condition, and decide the number of columns using <div>s preventively (beforehand), thus why I said it could be seen as <table> use and output as well, whereas

<table><tr>
<td>insert new product 1</td>
<td>insert new product 2</td>
</tr>
<tr>
<td>insert new product 3</td>
<td>insert new product 4</td>
</tr></table>

would be the same as

<div class="myRow">
<div class="myColumn">insert new product 1</div>
<div class="myColumn">insert new product 2</div>
</div>
<div class="myRow">
<div class="myColumn">insert new product 3</div>
<div class="myColumn">insert new product 4</div>
</div>

I tried removing the "style="width:' . $col_width . '%;"" piece, and add <div> after 'text' => but as you can guess it outputs error.

2 Mar 2013, 11:16 PM
#6
keneso avatar

keneso

Totally Zenned

Join Date:
May 2009
Posts:
1,273
Plugin Contributions:
3

Re: need php help for new/featured/specials output

Well, I think I kinda over-complicated it ...
All I needed was to add my class to array('params' =>, and remove style="width:' . $col_width . '%;".

Thank you rbarbour for your time.