Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. $regularPrice = $product->getPriceInfo()->getPrice('regular_price')->getValue();
  2. $specialPrice = $product->getPriceInfo()->getPrice('special_price')->getValue();
  3.  
  4. if ($product->getTypeId() == 'bundle') {
  5. $regularPrice = $product->getPriceInfo()->getPrice('regular_price')->getMinimalPrice()->getValue();
  6. $specialPrice = $product->getPriceInfo()->getPrice('final_price')->getMinimalPrice()->getValue();
  7. }
  8.  
  9. if ($product->getTypeId() == 'configurable') {
  10. $basePrice = $product->getPriceInfo()->getPrice('regular_price');
  11.  
  12. $regularPrice = $basePrice->getMinRegularAmount()->getValue();
  13. $specialPrice = $product->getFinalPrice();
  14. }
  15.  
  16. if ($product->getTypeId() == 'grouped') {
  17. $usedProds = $product->getTypeInstance(true)->getAssociatedProducts($product);
  18. foreach ($usedProds as $child) {
  19. if ($child->getId() != $product->getId()) {
  20. $regularPrice += $child->getPrice();
  21. $specialPrice += $child->getFinalPrice();
  22. }
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement