SHARE
TWEET

Untitled

a guest Jul 23rd, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top