質問

マーケットプレイスマルチベンダー/売り手サイトを持っています。

製品ビューページに複数の売り手を表示しています。

最初に1つの製品が売り手「KidsDial4」によってアップロードされ、同じ製品が他の売り手によって割り当てられている「KidsDial6」。

製品ビューページよりもこの

上にあなたはseller kidsDial4を見ることができます:

画像の説明が入力されています

底に売り手のキッズダイアル6:

を見ることができます

画像の説明が入力されています

ここでseller kidsdial4 have "zero" stock [在庫切れ]製品の

&KidsDial6売り手はその製品の数量を持っています。

だから私は上にキッズダイアル6の売り手を展示したい、キッズダイアル4は下に表示されるべきです。

販売店→

<?php $productid=Mage::registry('current_product')->getId(); ?>
<?php if(count($this->sellerNewProductList())!=0 || count($this->sellerUsedProductList())!=0): ?>
    <div class="wk_mp_design" id="seller-list" style="clear:both">
        <div class="block block-account">
            <div class="head block-title">
                <strong>
                    <span class="wk_new_tab list_active_tab" for="seller-list-new"><?php echo $this->__('Sold By')." ".count($this->sellerNewProductList())."" ." Sellers "; ?></span>
                    <!-- <span class="wk_tab_seperator"></span>
                    <span class="wk_used_tab" for="seller-list-used"><?php echo $this->__('Used')." (".count($this->sellerUsedProductList()).")";?></span> -->
                </strong>
            </div>
            <div class="seller-list" id="seller-list-new">
                <?php if(count($this->sellerNewProductList())==0): ?>
                    <div class="fieldset wk_mp_fieldset">
                        <div class="wk_emptymsg">
                            <?php echo $this->__('No New Product Available') ?>
                        </div>
                    </div>
                <?php else: ?>
                    <div class="title">
                        <span class="lable profile"><?php echo $this->__('Sellers');?></span>
                        <span class="lable comment"><?php echo $this->__('Delivered By');?></span>
                        <span class="lable price"><?php echo $this->__('Price');?></span>
                        <span class="lable addto"><?php echo $this->__('');?></span>
                    </div>
                    <?php foreach($this->sellerNewProductList() as $seller): ?>
                        <?php
                            $userlist=Mage::getModel('marketplace/userprofile')->getCollection();
                            $userlist->addFieldToFilter('mageuserid',array('eq'=>$seller->getSellerId()));
                            foreach($userlist as $user){
                                $profileurl=$user->getProfileurl();
                                $logo=$user->getLogopic();
                            }
                        ?>
.

売り手リスト.phtmlの完全なコード=> http://pasted.co/13849662

wk_block.phtml

<?php
    $helper=Mage::helper('marketplace');
    $_product=Mage::registry('current_product');
    $productowner=Mage::getModel('marketplace/product')->isCustomerProduct($_product['entity_id']);
    if($productowner['userid']!=""){
        $captchenable = $percent = Mage::getStoreConfig('marketplace/marketplace_options/captcha');
        $rowsocial=Mage::getModel('marketplace/userprofile')->getPartnerProfileById($productowner['userid']);
?>

<div class="block wk-block block-viewed">
    <div class="block-title"><strong><span>
    <?php   if($rowsocial['shoptitle']!='')
            echo $rowsocial['shoptitle'];
        else
            echo  $rowsocial['profileurl']; ?>
    </span></strong></div>
    <div class="block-content">
        <div class="wk_blockdetail">   
            <ul class="partnerlinks">
                <li>
                    <a href="<?php echo  Mage::getUrl('marketplace/seller/collection').$rowsocial['profileurl'] ?>" title="<?php echo $helper->__('Visit Complete Collection') ?>" id="siteconnect"><?php echo $helper->__('View Collection') ?></a>
                </li>
                <li class="profile-view">
                    <a href="<?php echo  Mage::getUrl()."marketplace/seller/profile/".$rowsocial['profileurl'] ?>" title="<?php echo $helper->__('Visit Profile') ?>" id="profileconnect"><?php echo $helper->__('View Profile') ?></a>
                    <div class="wk-block-hover-div">
                        <div class="arrow"></div>
                        <?php echo $rowsocial['compdesi']; ?>
                    </div>
                </li>

                <?php echo $this->getChildHtml();?>

            </ul>
        </div>
    </div> 
</div>
.

wk_block.phtmlのフルコード: http://pasted.co/0a221176

販売者リスト.php

app/code/local/Exam/Mpassignproduct/Block/Sellerlist.php

<?php

class Exam_Mpassignproduct_Block_Sellerlist extends Mage_Core_Block_Template
{
    public function _prepareLayout() {
        return parent::_prepareLayout();
    }

    public function sellerNewProductList() {
        $productid=Mage::registry('current_product')->getId();
        $collection=Mage::getModel('mpassignproduct/mpassignproduct')->getCollection()
                        ->addFieldToFilter('product_id',array('eq'=>$productid))
                        ->addFieldToFilter('qty',array('gt'=>0))
                        ->addFieldToFilter('flag',array('eq'=>'1'))
                        ->addFieldToFilter('product_condition', array('eq'=>'new'));
        $collection->setOrder("price",ASC);
        return $collection;
    }

    public function sellerUsedProductList() {
        $productid=Mage::registry('current_product')->getId();
        $collection = Mage::getModel('mpassignproduct/mpassignproduct')->getCollection()
                        ->addFieldToFilter('product_id',array('eq'=>$productid))
                        ->addFieldToFilter('qty',array('gt'=>0))
                        ->addFieldToFilter('product_condition',array('eq'=>'used'))
                        ->addFieldToFilter('flag',array('eq'=>'1'));
        $collection->setOrder("price",ASC);
        return $collection;
    }
}
.

私は答えが入ったら、余分な100の賞金ポイントを与えます....

役に立ちましたか?

解決

私はすでに答えそこで同じ質問

public function sellerNewProductList() {
    $productid=Mage::registry('current_product')->getId();
    $collection=Mage::getModel('mpassignproduct/mpassignproduct')->getCollection()
                    ->addFieldToFilter('product_id',array('eq'=>$productid))
                    ->addFieldToFilter('qty',array('gt'=>0))
                    ->addFieldToFilter('flag',array('eq'=>'1'))
                    ->addFieldToFilter('product_condition', array('eq'=>'new'));
        $collection->getSelect()->order("price",ASC);
        return $collection;
    }


public function sellerUsedProductList() {
    $productid=Mage::registry('current_product')->getId();
    $collection = Mage::getModel('mpassignproduct/mpassignproduct')->getCollection()
                    ->addFieldToFilter('product_id',array('eq'=>$productid))
                    ->addFieldToFilter('qty',array('gt'=>0))
                    ->addFieldToFilter('product_condition',array('eq'=>'used'))
                    ->addFieldToFilter('flag',array('eq'=>'1'));
    $collection->getSelect()->order("price",ASC);
    return $collection;
}
.

ソートするためのソートはクエリを実行しようとしているecho $collection->getSelect();

他のヒント

下記のようなあなたの両方の売り手コレクションを変更することによって、あなたはあなたのコレクション内の売り手の位置を注文することができます。

既に0値を超える数量で売り手リストをフィルタリングしています。

価格と数量を注文することで、あなたが最初の場所で価格が少ない売り手が売り手になるでしょう、そしてどちらの売り手も同じ価格を持っているならば、それは最初の場所としてその特定の製品の数の数を多く有する売り手を考えるでしょう。

あなたのコレクションの両方にこれらを適用することができます。

public function sellerUsedProductList() {
    $productid=Mage::registry('current_product')->getId();
    $collection = Mage::getModel('mpassignproduct/mpassignproduct')->getCollection()
                    ->addFieldToFilter('product_id',array('eq'=>$productid))
                    ->addFieldToFilter('qty',array('gt'=>0))
                    ->addFieldToFilter('product_condition',array('eq'=>'used'))
                    ->addFieldToFilter('flag',array('eq'=>'1'));
 //    $collection->setOrder("price",ASC); your order by commented
          $collection->getSelect()->order("price ASC")->order("qty DESC");
    return $collection;
}
.

まだ問題があるかどうかを知らせてください。

コードはできませんでしたが、アイデアはとても簡単です。 結局のところ、この製品を持っているすべての売り手を読み込んだり、「名前」=>「在庫」を持つ配列を作成し、最初に「在庫」のHight値を持つ配列を注文してから、アレイをロードしてください。名前で売り手、そしてそれを示すために彼の在庫を使って。

ライセンス: CC-BY-SA帰属
所属していません magento.stackexchange
scroll top