Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

User Store help

Asked Modified Viewed 1,847 times
V
vidzspot
V
  • Junior Member, joined since
  • Contributed 11 posts on the community forums.
  • Started 3 threads in the forums
  • Started this discussions
asked
Junior Member

I am working on an infusion that would allow users to have there own store and be able to sell what they want on it. I have ran into a bit of an issue with displaying items in the shop. I am trying to limit the amount of items per row that display and not per page. My goal is to have 4 items per row in each category.
.
this what it looks like atm.
php-fusion.us/forum/attachments/currently.png

.
this is what i am trying to have it look like.
www.php-fusion.us/forum/attachments/future.png


this is my code


            echo "<div align='center'><table><tr><th colspan=5>Browsing shop items at <b>".$shopdata['shop']."...</b></tr>";
         
         echo "<tr>";
             
            $qtwo =
                    mysql_query(
                            "SELECT si.*,i.*,it.* FROM ".DB_SHOPITEMS." si LEFT JOIN ".DB_ITEMS." i ON si.sitemITEMID=i.itemid LEFT JOIN ".DB_ITEMTYPES." it ON i.itemtype=it.itemtypeid WHERE si.sitemSHOP=".$_GET['shop']." ORDER BY i.itemtype, i.itembuyprice, i.itemname") or die(mysql_error());
            $st = "";
            while ($data = mysql_fetch_array($qtwo))
            {
                if ($st != $data['itemtypename'])
                {
                    $st = $data['itemtypename'];
                    echo"<tr><th colspan=5>".$st."</th></tr>";
                }
      
   echo "<td width='125'></br><div align='center' class='prod_box'>
        <div class='center_prod_box'>
          <div align='center' class='product_title'>".$data['itemname']."<a href='#'></a></div>
          <div align='center' class='product_img'><a href='#'><img src='images/p1.jpg' alt='".$r['itmdesc']."' border='0' /></a></div>
          <div align='center' class='prod_price'><span class='price'>".$buyprice."</span></div>
        </div>
        <div class='prod_details_tab'><form action='process_buy.php?ID=".$data['itemid']."' method='post'>Qty: <input type='text' name='qty' value='1' style='width:20px;'>
      <input type='submit' value='Buy'></form></br></div>
      </div></td>";
    
            }
          echo "</tr>";
            echo "</table></div>";
    
         closetable();
Edited by vidzspot on 13-09-2015 06:25,
0 replies

3 posts

C
Chan
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,842 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions
answered
Super Admin

<div style='width:100%; display:block;'>
$qtwo =
                    mysql_query(
                            "SELECT si.*,i.*,it.* FROM ".DB_SHOPITEMS." si LEFT JOIN ".DB_ITEMS." i ON si.sitemITEMID=i.itemid LEFT JOIN ".DB_ITEMTYPES." it ON i.itemtype=it.itemtypeid WHERE si.sitemSHOP=".$_GET['shop']." ORDER BY i.itemtype, i.itembuyprice, i.itemname") or die(mysql_error());
            $st = "";
            while ($data = mysql_fetch_array($qtwo))
            {
                if ($st != $data['itemtypename'])
                {
                    $st = $data['itemtypename'];
                    echo "<div style='width: 25%; float:left; padding:15px;'>\n"; // You said 4 right? 100/4 = 25
                    echo "Hammer for sale";
                    echo "</div>\n";
                }     
</div>
0 replies
V
vidzspot
V
  • Junior Member, joined since
  • Contributed 11 posts on the community forums.
  • Started 3 threads in the forums
  • Started this discussions
answered
Junior Member

hey thanks but that doesn't work they i need it to. each item is a different name.

I managed to kinda get it to display the way i would like but still not exactly correct.

echo "<div align='center'><table><tr><th colspan=5>Browsing shop items at <b>".$shopdata['shop']."...</b></tr>";
 echo "<tr>";


to

         echo "<div style='width:100%; display:block; align='center'><table width='100%'>";
             $i = 0;
       if ($i==0){
         echo "<tr>";
       }

this is how it currently is displaying with my changed code.
vidzspot attached the following file:
see.png [No information available / 66 Downloads]
0 replies
F
Falk
F
Falk 146
Need help?, Having trouble?
• View our Documentation for Guides, Standards and Functions
• Name and Organize your Topics and Content correctly in the corresponding Forums for best support results
• Attaching Log Files and Screenshots when reporting issues will help
• Provide with an URL to live example if one exists
• Please read the How to Report an Error post
• Please read and comply with the Code of Conduct

(¯·._.·(¯°·._.·°º*[ Project Manager ]*º°·._.·°¯)·._.·¯)
  • Super Admin, joined since
  • Contributed 6,201 posts on the community forums.
  • Started 639 threads in the forums
  • Answered 12 questions
answered
Super Admin

The example you were given was a div model, you are trying it on a table model.
the table model need to terminate and re-open <tr> for each 4 items counted ( as an example ).

if ($i==4){
         echo "</tr><tr>";
       }

You need to close it all outside the while loop such as ,

</tr></table>
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 3 posts
  • Votes 0 votes
  • Topic users 3 members

3 participants

F
F
Falk 146
Need help?, Having trouble?
• View our Documentation for Guides, Standards and Functions
• Name and Organize your Topics and Content correctly in the corresponding Forums for best support results
• Attaching Log Files and Screenshots when reporting issues will help
• Provide with an URL to live example if one exists
• Please read the How to Report an Error post
• Please read and comply with the Code of Conduct

(¯·._.·(¯°·._.·°º*[ Project Manager ]*º°·._.·°¯)·._.·¯)
  • Super Admin, joined since
  • Contributed 6,201 posts on the community forums.
  • Started 639 threads in the forums
  • Answered 12 questions
C
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,842 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions
V
V
  • Junior Member, joined since
  • Contributed 11 posts on the community forums.
  • Started 3 threads in the forums
  • Started this discussions

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet