I've created a group product with two simple products.Each simple product has tier pricing.For example,
Simple product -1: tier pricing : Qty Price
2 100
3 75
5 60
Simple product -2: tier pricing: Qty Price
2 110
3 80
<?php if ($_hasAssociatedProducts): ?>
<?php foreach ($_associatedProducts as $_items): ?>
<?php $_items->setData('tier_price',null); ?>
<?php $_tierPrices = $this->getTierPrices($_items); ?>
<?php foreach ($_tierPrices as $key => $value): ?>
<th><?php echo $value['price_qty']; ?></th>
<?php endforeach; ?>
<?php endforeach; ?>
<?php endif; ?>
The above code returns all the qty 2 3 5 2 3
.How do I remove the repeated "qty" values and show only unique values?
Best Answer
@pspahn's comment is correct.
array_unique()
will remove the duplicates. In your code example, it could be used like this:This will output
2 3 5
based on your example.Were you just wanting to display the quantities only like this?