magento 我如何在卖家个人资料页面上显示卖家的产品?

ilmyapht  于 2022-11-12  发布在  其他
关注(0)|答案(1)|浏览(97)

我正在建立一个多卖方市场上的magento与第三方扩展,显示卖方的个人资料页,细节和评论,但它不显示卖方的产品。
如何在卖家的个人资料页面显示卖家的商品?
这是卖家档案。phtml代码:

<?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() as $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() as $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>
42fyovps

42fyovps1#

如果卖方的产品与其他产品不同,则可以使用一对多关系
一对多关系类似于
每个卖方可以有零个、一个或多个产品。但一个产品只能属于一个卖方
例如,您有一个名为jack的卖方,他在products表中有4个产品。您将使用jack在sellers表中的id创建一个链接到表products的外键
注意:如果你从卖家表中删除了杰克,他的所有产品也将被删除,这是有道理的,你不能提供一个商品,他的卖家不存在
这里有一个答案,将帮助您One-to-Many relationship in MySQL - how to build model?

相关问题