I'm looking to output a base original price for a configurable product with both "price" and "special_price" set. For simplicity's sake I'm concerned only about the first such linked product's attributes.

The problem is, I cannot pull the base "price" from inside list.phtml like I can from final_price.html. Only special (after discount) price is available. When I call $_product->getPrice() (or any other million methods) I always get 0 and a message:

Call to a member function getPrice() on null

But the very same method works fine elsewhere. What am I doing wrong there? Why is that price available inside Magento_ConfigurableProduct module but not inside Magento_Catalog module?

Edit: so it appears the data is being pulled from the main configurable product that has "price": 0 and "attribute_code": "special_price", "value": "170.000000" attributes. So the question is, how can I pull the price data for the first simple product linked to that configurable product?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.