php - How can i display seller's products on seller profile page? -


i building multi-seller marketplace on magento third party extension shows seller's profile page, details , reviews not show seller's products.

how can show seller's products on sellers profile page?

this seller profile.phtml code:

<?php $seller = $this->sellerprofile(); $country = mage::getmodel('directory/country')->loadbycode($seller['country']); ?>  <div class="seller-profile"> <div class="seller-top-panel">     <ul>         <li>             <div class="seller-profile-image">                 <img src="<?php echo mage::helper('marketplace')->getimagepath($seller['image']); ?>" height="140"     width="140">             </div>         </li>         <li class="shop-info">             <div class="shopname">                 <h2><?php echo $seller['shop_name']; ?></h2>             </div>             <div class="shop-description">                 <p><?php echo $seller['shop_description']; ?></p>             </div>             <div class="shop-contact">                 <span><?php echo $this->__('<b>phone</b>: %s',$seller['telephone']);?></span>             </div>             <div class="seller-profile-contact">                 <span><?php echo $this->__('<b>email</b>: %s',$seller['email']); ?></span>             </div>             <div class="shop-location">                 <span><?php echo $this->__('<b>country</b>: %s',$country->getname());?></span>             </div>             </li>          <li class="summary-overview">             <h3><?php echo $this->__('rating conclusion') ?></h3>             <?php foreach($this->ratingoverview() $rate):?>                 <div class="rating-list">                     <?php $ratingname =  $this->getratingname($rate['rating_id']); ?>                     <?php $avgpercentage = ($rate['sub_total']*100)/($rate['rating_count']*5); ?>                     <?php $rating = $rate['sub_total']/$rate['rating_count'] ; ?>                     <?php $ratingtitle = $this->__("rating: ").round($rating,1)."of 5"; ?>                     <div class="rating-stars">                         <div class="blank-stars"></div>                         <div title="<?php echo $ratingtitle; ?>"class="fill-stars" style="width:<?php echo round    ($avgpercentage,2); ?>%"></div>                     </div>                     <div class="rating-name"><?php echo $ratingname; ?></div>                 </div>         <?php endforeach; ?>                 </li>         <li>             <?php $sum = 0;foreach($this->getreviewstars() $rate) $sum += $rate['value_count'];?>             <?php $positive = array(5,4); $rate = $this->getpositivepercentage($positive);?>              <div class="rating-linegraph">                 <div class="avgratingsection sellerrating">                     <?php $positivetotal = count($rate) == 0 ? 0 : ($rate['positive_total']/$sum)*100 ?>                     <div class="rating-percentage">                         <span class="positive-average"><?php echo round($positivetotal)."%"; ?></span>                          <span class="positve-label"><?php echo $this->__('positive') ?></span>                         </div>                          <span><?php echo $this->__('based on %d ratings',$sum) ?></span>                     </div>                 <div class="seller-rating-bar seller-rating">                     <ul>                     <?php $count=5;for($count=5;$count>=1;$count--):                         $rate =  $this->getreviewstar($count);                          $avg = ($rate == null ? 0 : (($rate['value_count']/$sum)*100));                         ?>                         <li>                             <span><?php echo $count.$this->__('star') ?> </span>                             <div class="blank-ratingbar">                                 <div class="fill-bar" style="width:<?php echo $avg;  ?>%"></div>                             </div>                             <span class="rate-vote"><?php echo $rate == null ? 0 : $rate['value_count']; ?    ></span>                         </li>                 <?php endfor; ?>                      </ul>                 </div>                 <div class="seller-rate-type seller-rating">                     <div class="border type-positive"><?php echo $this->__('positive'); ?></div>                     <div class="border type-neutral"><?php echo $this->__('neutral');?></div>                     <div class="border type-negative"><?php echo $this->__('negative') ;?></div>                 </div>             </div>         </li> </div> </div> 

if seller's products distinct other products can use 1 many relationship

one many relationship goes

each seller may have zero, 1 or multiple products. product can belong 1 seller

for example have seller called jack has 4 products on products table create foreign key linking table products using jack's id on sellers table

notice: if deleted jack sellers table products deleted , makes sense can't supply merchat product seller doesn't exist

here answer one-to-many relationship in mysql - how build model?


Comments