Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8146133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:53:38+00:00 2026-06-06T13:53:38+00:00

We have accounting software populating the name field on a magento webstore, the problem

  • 0

We have accounting software populating the name field on a magento webstore, the problem is there’s a 30 character limit and the name always tends to be aimed more at our inhouse operations than SEO or UI.

I’m wondering the best way to create an ‘alternate name’ for some magento products, but only if it exits, otherwise fall back to the regular name field.

Is the best way to do this to just create a new Product Attribute (alternate_name) and the call an if else statement in the frontend?

<?php if($_product->getAttributeText(’alternate_name’)) { 
 echo $_product->getAttributeText(’alternate_name’) 
 } else {
 echo $_product->getName(); 
 } ?>

Will I then need to change it in several places in the layout folder? or is there an easier place to override this method once and have it work everytime $product->getName() gets called?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T13:53:40+00:00Added an answer on June 6, 2026 at 1:53 pm

    If you need this for reading/viewing in the frontend only, you could override the getName() method of the core model Mage_Catalog_Model_Product to do something like this:

    public function getName()
    {
        if (Mage::app()->getStore()->isAdmin()) {
            return $this->getData('name');
        }
        return (
            ($this->getData('alternate_name')
            ? $this->getData('alternate_name')
            : $this->getData('name')
        );
    

    }

    This way you’d have just a single point of change, serving all product getName() calls, no matter where they’re coming from.

    Be aware that doing so can cause issues when it comes to editing/saving the name attribute.

    This is because the Magento backend for example will also use your getName() to fill the name field of the product edit <form>, so the value landing in this <input> field could be either the one of the alternate_name or the name attribute.

    Saving changes could then lead to saving the alternate_name value in the name attribute, which you most probably don’t want.

    To avoid this, the method above always returns the value of the name attribute in case the call is coming from within the admin area. This should be enough to catch admin edit forms, but can of course not catch other possible cases, where getName() is used to feed setName()->save() calls.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a Desktop based accounting software in Java. I want to put
I have an accounting & payroll client/server application where there are several input form
I have an accounting table that contains a dollar amount field. I want to
I have the following code in my accounting application: // switch View to the
I have a VisualStudio project with a few sub folders like Accounting, Store etc.
Assuming I have a page request which goes like http://localhost/accounting/products?id=234 and sometimes it goes
I am designing an online accounting system as a college project. I have got
I'm currently graduating at a small company which makes and sells accounting software. My
I have some accounting report's summary with such rows: vat, net, total. How can
i have made a company website which has the MYSQL database of accounting,inventory,expenses, etc.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.