Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $regularPrice = $product->getPriceInfo()->getPrice('regular_price')->getValue();
- $specialPrice = $product->getPriceInfo()->getPrice('special_price')->getValue();
- if ($product->getTypeId() == 'bundle') {
- $regularPrice = $product->getPriceInfo()->getPrice('regular_price')->getMinimalPrice()->getValue();
- $specialPrice = $product->getPriceInfo()->getPrice('final_price')->getMinimalPrice()->getValue();
- }
- if ($product->getTypeId() == 'configurable') {
- $basePrice = $product->getPriceInfo()->getPrice('regular_price');
- $regularPrice = $basePrice->getMinRegularAmount()->getValue();
- $specialPrice = $product->getFinalPrice();
- }
- if ($product->getTypeId() == 'grouped') {
- $usedProds = $product->getTypeInstance(true)->getAssociatedProducts($product);
- foreach ($usedProds as $child) {
- if ($child->getId() != $product->getId()) {
- $regularPrice += $child->getPrice();
- $specialPrice += $child->getFinalPrice();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement