gpt4 book ai didi

magento - 根据数量交换产品 View 页面中的卖家名称

转载 作者:行者123 更新时间:2023-12-02 20:43:12 25 4
gpt4 key购买 nike

我们有市场多供应商/卖家网站。

我们在产品 View 页面上显示多个卖家。

最初一件产品是由卖家“kidsdial4”上传的,而同一产品则由另一卖家“kidsdial6”分配。

与产品 View 页面相比,我们显示两个卖家名称,例如 this

在顶部您可以看到卖家 kidsdial4

enter image description here

在底部您可以看到卖家 kidsdial 6

enter image description here

此处卖家 kidsdial4 该产品的库存为“零” [缺货]。

& kidsdial6 卖家有该产品的数量。

所以我想在顶部显示 kidsdial 6 卖家,kidsdial 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();
}
?>

app/design/frontend/default/default/template/mpassignproduct/sellerlist.phtml 的完整代码 => http://pasted.co/13849662

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

<?php

class Webkul_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;
}
}

最佳答案

按 block 中的数量(从高到低)对集合 sellerNewProductList() 进行排序

关于magento - 根据数量交换产品 View 页面中的卖家名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36447840/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com