Question

How can I add a new product tag like 'New', 'Promo'.

And need to display it with the product edit page as a toggle.

In category pages, it should be near to the product list.

Was it helpful?

Solution

What you're after is attributes.

There are a few way this can be done, but mainly you create attributes and attach them in attribute sets accordingly. From here you can add values to those attributes for each product and create your logic on how you'd like to use and display them.

For example if you create attribute called "New Tag" (code: new_tag), then you'd fetch it in your phtml template like so: $newAttributeTag = $product->getNewTag();

Magento will automatically fetch your attribute and you can now use your newly created variable to create your logic.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top