Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please add category Title Chooser in config #76

Open
seansan opened this issue Feb 4, 2019 · 1 comment
Open

Please add category Title Chooser in config #76

seansan opened this issue Feb 4, 2019 · 1 comment

Comments

@seansan
Copy link
Contributor

seansan commented Feb 4, 2019

Please add category Title Chooser in config

Some websites use two attributs for categories

  1. for the TITLE in the menu navigation
  2. for the NAME H1 on the page (page title)

The TITLE can be quite short something like "White"; suppose in a menu like "Shirts->White"; however the page title on the page is "White Shirts" taken from another attribute

Default should stay default 'name' but one should be able to change it in the backend

Quick and SImple win ; also goes for M2

@seansan
Copy link
Contributor Author

seansan commented Feb 4, 2019

Can be updated in public function categoryAction()


// 1. GET SETTING FROM BACKEND HERE

        // SNH CUSTOM 4-2-2019 CHANGED DB FETCH and added ->addAttributeToSelect('page_title')
        $categories = Mage::getModel('catalog/category')
            ->getCollection()
            ->addIsActiveFilter()
            ->addAttributeToSelect('name')
            ->addAttributeToSelect('page_title')                                    // 2. ADD FETCH DATA HERE
            ->addAttributeToFilter('path', ['like' => "1/{$rootCategoryId}/%"])
            ->setOrder('entity_id', Varien_Db_Select::SQL_ASC)
            ->setPageSize($limit)
            ->setCurPage($page);

        $items = [];

        foreach ($categories as $category) {
            //Get children categories
            $children = $category->getResource()->getChildren($category, false);

            // SNH CUSTOM 4-2-2019 CHANGED CATEGORIES FETCH FROM: $category->getName() to $category->getPageTitle(),
            $data = [
                'id' => (int) $category->getId(),
                'name' => $category->getPageTitle(),                                // 3. SUBMIT DATA HERE .... CAN ALSO BE EXTRA FIELD OF CLERK SUPPORTS IT
                'url' => $category->getUrl(),
                'subcategories' => array_map('intval', $children),
            ];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant