Timeline for how to get special price and regular price in phtml file magento2
Current License: CC BY-SA 4.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 9, 2020 at 15:41 | comment | added | nihal malik | using the above code with object manager gives this error : Call to undefined method Magento\Catalog\Model\ProductRepository\Interceptor::create() | |
Jul 9, 2020 at 11:00 | comment | added | nihal malik | yes i know this but for now i have to do this using object manager just to test several logics | |
Jul 9, 2020 at 10:44 | history | edited | Rizwan Khan | CC BY-SA 4.0 |
Updated answer
|
Jul 9, 2020 at 10:42 | comment | added | Vivek Kumar | it is not recommended practice to write business logic in phtml, also don't use objectmanager as it jacks up the readability. Use blocks to get data/ business logic as suggested in answer. | |
Jul 9, 2020 at 10:41 | history | edited | Rizwan Khan | CC BY-SA 4.0 |
Improved Answer
|
Jul 9, 2020 at 10:40 | comment | added | nihal malik | i can use object manager | |
Jul 9, 2020 at 10:40 | comment | added | nihal malik | i cannot use constructs as i am working in phtml file | |
Jul 9, 2020 at 10:34 | history | answered | Rizwan Khan | CC BY-SA 4.0 |