1

So I have a Magento Page with 3 products on it and the images/prices/product title are all hard coded. in HTML how can I make it so that the price is not hard coded and whenever the product price changes, the price will change on that page too for those 3 products? I say html because it's on a Magento page.

  • How do you mean the images/prices/product titles are hardcoded? Did you add them in a CMS page? – Niels May 9 '18 at 14:40
  • Yes I coded the page myself in a cms page. So everything is hardcoded. – DevAnd May 9 '18 at 14:42
2

I would ditch the hard-coding and use Magento's "Catalog Products List" widget. You can specify a bunch of criteria in the widget to show the products you want, e.g. from a certain category or - in your case - based on their IDs.

An overview to widgets is here, I'm not affiliated with this I just found it in Google:

https://www.humcommerce.com/tutorial/add-widgets-in-magento-2/

If your page needs a drastically different way of displaying the data, you could insert each product in its own widget and heavily customize the CSS as required.

If this is too generic then you'll be in the territory of writing your own block classes and rendering them with phtml templates within the page, which is a whole different ball game.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.