質問

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

売り手の多くの売り手は同じ商品を持っているので、製品の表示ページではすべての売り手を表示します。

製品が売り手「KidsDial4」によってアップロードされていると仮定すると、同じ製品が別の売り手「KidsDial6」によって割り当てられているものが割り当てられている。

SO Product Viewページでは、この

上にあなたは売り手の子供たちのPrice Rs .20:

を見ることができます

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

底にあなたは売り手の子供たちのPrice Rs .10:

を見ることができます。

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

ここでは「Seller KidsDial4はその製品の価格Rs 20を持っています。

&KidsDial6売り手はその製品の価格Rs.10を持っています。

だから私は最低価格のために売っている人の上に展示されたい

ここでは、キッズダイアル6は上に表示されるべきである、キッズダイアル4は下に表示されるべきです。

今すぐ上および下のview.phtmlの下でスクリプトを試しています。

しかし、私は下記にKidsdial6 seller name and his price displayingを加えたいです。

jQuery(function($) {
    function getPriceFromString(str){
            return str.replace( /^\D+/g, '')
    }

    productPriceFormated = jQuery('#product_addtocart_form span.price').text();
    productPrice = getPriceFromString(productPriceFormated);
    lowestPrice = productPrice;
    productId = 0;
    soldBy = ''


    jQuery('#seller-list-new form').each(function(index){
        price = getPriceFromString(jQuery(this).find('span span.price').text());

        if(price < lowestPrice){
            lowestPrice = price;
            productId = jQuery(this).find('.mpassignproduct_id').val()
            soldBy =  jQuery(this).find('div.wk_seller_profile').html()
        }

    });

    if(productId > 0){
        jQuery('#product_addtocart_form span.price').text(productPriceFormated.replace(productPrice, lowestPrice));
        jQuery('input:hidden[name=product]').remove();
        jQuery('#product_addtocart_form').prepend('<input type="hidden" value="' + productId + '" name="mpassignproduct_id" class="mpassignproduct_id">');
        jQuery('#product_addtocart_form .soled-by-dealer span').html(soldBy)
    }
});
.

display Kidsdial4 seller name & his price=> 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の賞金ポイントを与えます....

役に立ちましたか?

解決

あなたの価格はソートされていません$collection->getSelect()->setOrder()

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();

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