Php Magento:显示具有组价格的产品
我需要展示具有团体价格的产品。 到目前为止,我得到的是这个 首先,我加载产品集合Php Magento:显示具有组价格的产品,php,magento,collections,Php,Magento,Collections,我需要展示具有团体价格的产品。 到目前为止,我得到的是这个 首先,我加载产品集合 <?php $_productCollection=$this->getLoadedProductCollection(); $_collectionSize = $_productCollection->count(); ?> 然后,我只检查两件事。如果用户已登录,则显示客户组 <?php if(Mage::getSingleton('customer/sess
<?php
$_productCollection=$this->getLoadedProductCollection();
$_collectionSize = $_productCollection->count();
?>
然后,我只检查两件事。如果用户已登录,则显示客户组
<?php if(Mage::getSingleton('customer/session')->isLoggedIn()){
// Get group Id
$groupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
//Get customer Group name
$group = Mage::getModel('customer/group')->load($groupId);
$var_customer_group = $group->getCode();
$product = Mage::getModel('catalog/product')->load($productId);
}?>
<?php if ($var_customer_group == "Wholesale")
{ ?>
我用我的产品建立了一个列表
<ul>
<?php foreach ($_productCollection as $_product): ?>
<li>
</li>
<?php endforeach ?>
</ul>
<?php } ?>
<?php
$_productCollection=$this->getLoadedProductCollection();
$_collectionSize = $_productCollection->count();
?>
-
如何在$\u productCollection
中查看哪些产品具有团体价格。
任何帮助都将不胜感激 我设法得到了我想要的东西。事实上,如果你开始跳出框框思考,这很简单。 我将提供代码来帮助其他人解决同样的问题 首先,添加产品集合
<ul>
<?php foreach ($_productCollection as $_product): ?>
<li>
</li>
<?php endforeach ?>
</ul>
<?php } ?>
<?php
$_productCollection=$this->getLoadedProductCollection();
$_collectionSize = $_productCollection->count();
?>
那么
<?php foreach ($_productCollection as $_product): ?>
<?php $product_id = $_product->getId();
$arrayofproductsID = Mage::getModel('catalog/product')->load($product_id);
$groupPrices = $arrayofproductsID->getData('group_price');
?>
<?php if(($groupPrices[0][price])) { ?> <-- //Here happens the check if there is a group price.
<li> ... </li>
<?php } ?>
<?php endforeach ?>