Forums / Addon Templates / Need help to creat a break line after 7 IMG in order Page

Need help to creat a break line after 7 IMG in order Page

Views: 2,108

Results 1 to 8 of 8
1 May 2011, 12:35 AM
#1
mauari avatar

mauari

New Zenner

Join Date:
May 2011
Posts:
67
Plugin Contributions:
4

Need help to creat a break line after 7 IMG in order Page

Hello Guys,
I modified my order page to display all IMG ordered with code and attributes.

Now I need a HOW TO make a break line <tr> after 7 IMG displayed.

To understand a bit more see it in http://www.pendientesparati.com/prob.html
after 7 photos I need a new horizontal line with other 7 photos at final ordered products to print purpose.

I modified ther orders.php and renamed to orders-foto.php and included a button to call the ordered products with PHOTO and attributes.

Now I NEED WHAT and WHERE put something to mnake a break line after 7 IMG

<tr> <?php for ($i=0, $n=sizeof($order->products); $i<$n; $i++) { echo ' <td align="left" valign="top">' . "\n" . ' <img border="0" src="http://www.pendientesparati.com/images/' . $order->products[$i]['model'] . '.JPG" width="90" height="120"><br>' . $order->products[$i]['qty'] . 'X ' . $order->products[$i]['model'] . '' . "\n"; if (isset($order->products[$i]['attributes']) && (sizeof($order->products[$i]['attributes']) > 0)) { for ($j = 0, $k = sizeof($order->products[$i]['attributes']); $j < $k; $j++) { echo '<br><small> <i>' . nl2br(zen_output_string_protected($order->products[$i]['attributes'][$j]['value'])); if ($order->products[$i]['attributes'][$j]['price'] != '0') echo ' (' . $order->products[$i]['attributes'][$j]['prefix'] . $currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ')'; if ($order->products[$i]['attributes'][$j]['product_attribute_is_free'] == '1' and $order->products[$i]['product_is_free'] == '1') echo TEXT_INFO_ATTRIBUTE_FREE; echo '</i></small>'; } }
  echo '            </td>' . "\n";
}

?>
</tr>

19 May 2011, 3:48 PM
#2
mauari avatar

mauari

New Zenner

Join Date:
May 2011
Posts:
67
Plugin Contributions:
4

Re: Need help to creat a break line after 7 IMG in order Page

no one know how I can do it????

25 May 2011, 5:11 PM
#3
dragoon09 avatar

dragoon09

New Zenner

Join Date:
Sep 2010
Location:
Cahokia, IL
Posts:
19
Plugin Contributions:
0

Re: Need help to creat a break line after 7 IMG in order Page

<tr> means table row I only see 1 <tr> in your code - hence the one row. try adding another <tr> after your 7th image

Matt Doty
https://www.MoodBoosters.net
"It's better to be a Smart A$$ than a Dumb A$$

27 May 2011, 1:40 AM
#4
nigelt74 avatar

nigelt74

Totally Zenned

Join Date:
Sep 2005
Location:
Waikato, New Zealand
Posts:
1,558
Plugin Contributions:
1

Re: Need help to creat a break line after 7 IMG in order Page

You would need to put a counter in and set it to trigger when the count reaches 7

You need to put a new row in after every seven products, the code below should work

It creates a table within the row you were using and allows you to create rows within that new table, note it hasn't been tested and there are the obvious bugs but it should give you a starting point, try it as a drop in fro the code you had, and see if it works

<tr>
 <?php
 echo '<td><table><tr>'
 $counter = 1;
 for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
 echo ' <td align="left" valign="top">' . "\n" .
 ' <img border="0" src="http://www.pendientesparati.com/images/' . $order->products[$i]['model'] . '.JPG" width="90" height="120"><br>' . $order->products[$i]['qty'] . 'X ' . $order->products[$i]['model'] . '' . "\n";
 if (isset($order->products[$i]['attributes']) && (sizeof($order->products[$i]['attributes']) > 0)) {
 for ($j = 0, $k = sizeof($order->products[$i]['attributes']); $j < $k; $j++) {
 echo '<br><small> <i>' . nl2br(zen_output_string_protected($order->products[$i]['attributes'][$j]['value']));
 if ($order->products[$i]['attributes'][$j]['price'] != '0') echo ' (' . $order->products[$i]['attributes'][$j]['prefix'] . $currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ')';
 if ($order->products[$i]['attributes'][$j]['product_attribute_is_free'] == '1' and $order->products[$i]['product_is_free'] == '1') echo TEXT_INFO_ATTRIBUTE_FREE;
 echo '</i></small>';
 }
 }

 echo ' </td>' . "\n";
 if ($counter==7)
	{echo '</tr><tr>';
	$counter =1;
	}
	else
	{
	$counter = ($counter + 1);
	}
 }

 echo '</tr></table></td>'

 ?>
 </tr>

Webzings Design
Semi retired from Web Design

12 Jul 2011, 8:35 PM
#5
mauari avatar

mauari

New Zenner

Join Date:
May 2011
Posts:
67
Plugin Contributions:
4

Re: Need help to creat a break line after 7 IMG in order Page

Great great great the only BUG WAS the semi colon in the end line <tr>

<?php echo '<td><table><tr>' "here" ; Worked FINE, Now I can Print the order and send to prepare THANK you so much
13 Jul 2011, 4:32 AM
#6
nigelt74 avatar

nigelt74

Totally Zenned

Join Date:
Sep 2005
Location:
Waikato, New Zealand
Posts:
1,558
Plugin Contributions:
1

Re: Need help to creat a break line after 7 IMG in order Page

Good to hear it worked for you

Webzings Design
Semi retired from Web Design

14 Dec 2014, 6:39 PM
#7
mauari avatar

mauari

New Zenner

Join Date:
May 2011
Posts:
67
Plugin Contributions:
4

Re: Need help to creat a break line after 7 IMG in order Page

nigelt74:

Good to hear it worked for you

Now after years I need display it ordered by image name o product code

The question.. how do I can display it ordered my product model o image name?

<?php echo '<td><table><tr>'; $counter = 1; for ($i=0, $n=sizeof($order->products); $i<$n; $i++) { echo ' <td width="100" valign="top">' . "\n" . '<img src="' . DIR_WS_CATALOG . DIR_WS_IMAGES . zen_get_products_image($order->products[$i]['id']) .'"width="90" height="120" /><br>' . $order->products[$i]['qty'] . 'X ' . $order->products[$i]['model'] . '' . "\n"; if (isset($order->products[$i]['attributes']) && (sizeof($order->products[$i]['attributes']) > 0)) { for ($j = 0, $k = sizeof($order->products[$i]['attributes']); $j < $k; $j++) { echo '<br><small> <i>' . nl2br(zen_output_string_protected($order->products[$i]['attributes'][$j]['value'])); if ($order->products[$i]['attributes'][$j]['price'] != '0') echo ' (' . $order->products[$i]['attributes'][$j]['prefix'] . $currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ')'; if ($order->products[$i]['attributes'][$j]['product_attribute_is_free'] == '1' and $order->products[$i]['product_is_free'] == '1') echo TEXT_INFO_ATTRIBUTE_FREE; echo '</i></small>'; } } echo ' </td>' . "\n"; if ($counter==7) {echo '</tr><tr>'; $counter =1; } else { $counter = ($counter + 1); } } echo '</tr>' ?>
10 Jan 2016, 7:49 PM
#8
mauari avatar

mauari

New Zenner

Join Date:
May 2011
Posts:
67
Plugin Contributions:
4

Re: Need help to creat a break line after 7 IMG in order Page

The solution is...

Attachment 15946