0

kindly note i have a selective products around 20 that i need to show a label or a tag " LIMITED QUANTITY". i tried the add tag under catalog but its only related to back end and administrator use and not to front end use. can anyone help me how to make this enable on website front end? thanks in advance for help and support.

1 Answer 1

0

Create a new product attribute and assign the LIMITED QUANTITIES value to all required products:

  1. In the admin, create a new product attribute by navigating to Catalog > Attributes > Manage Attributes, and clicking Add New Attribute. Call the new attribute something like limited_qty_message.
  2. The new attribute should be of type Text Field.
  3. Add this new text field attribute to EVERY ATTRIBUTE SET that contains the products that you need to assign the LIMITED QUANTITIES value.
  4. Set the value of this new attribute for your 20 products as LIMITED QUANTITIES.

Now output this new value, if it's set, to the product page:

  1. Open /app/design/YOUR_PACKAGE/YOUR_THEME/template/catalog/product/view.phtml in your text editor.
  2. Paste the following code in the file where you would like to output the new attribute:
<?php if ($_product->getData("limited_qty_message")) : //if the attribute has a value for this product ?>
    <?php echo $_product->getData("limited_qty_message"); // output it's value ?>
<?php endif; ?>

Once the attribute value is outputting as you need, add your HTML markup and style it.

11
  • dear kindly note i tried it today and after clearing magento cache and flushing my history and browsing cache on many browsers and devices; its showing on the backend of magento but not on the website front end. i set a text for 5 products for now for testing but they are not appearing on the website; can you help?
    – Marcos
    Jul 11, 2018 at 12:20
  • @Marcos - this definitely works. I would double check that you did not miss any of the steps. If it still doesn't work, I would enable template path hints, clear cache, and refresh your product page to confirm that you are working in the correct template file for the product details page. Jul 11, 2018 at 16:06
  • this is my template path : /public_html/app/design/frontend/tv_arion_package/tv_arion/template/catalog/product/view.phtml and your code was added successfully in this file under product description section! although, keep in mind, i need to show the ribbon or the label in the listing page. shall i work on a different file or the same?
    – Marcos
    Jul 12, 2018 at 6:21
  • You would need to add the same code from above to the list template. /public_html/app/design/frontend/tv_arion_package/tv_arion/template/catalog/product/list.phtml. The code snippet would need to be added inside both foreach loops - once for the list view, and again once for the grid view. Jul 12, 2018 at 13:36
  • OK dear i can see it now in the website but i have 2 store views. and its showing like a description and not a label or a tag on the image like i requested earlier in list view or grid view. i don't want it as description of the product but i want it as a tag or label. can i send you a clear screenshot or something related to be more specific please?
    – Marcos
    Jul 12, 2018 at 13:53

Your Answer

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

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