How to change things in Admin

Open to all! Ask other shopowners for help.
14Steve14
Senior Contributor
Posts: 920
Joined: Fri Oct 25, 2019 7:01 pm
Phoenix Version: v1.0.9.1
Has thanked: 17 times
Been thanked: 103 times

Re: How to change things in Admin

Post by 14Steve14 »

Just found this thread through a search and it may save me creating a new one.

We wanted to add in a character count when editing things like product title, seo title and meta description. The same with the category page. We created a hook in includes/hooks/admin/category but the only way to show the counts was to actually edit the admin/includes/actions/catalog/edit_category.php and the admin/includes/actions/catalog/views/new_product.php.

With those two files modified we were thinking about whether they could be overridden but cannot find anything using the search feature apart from this thread.

Any help appreciated.


Join The Code Co-op to get access to your library in the Code Co-op Forum
User avatar
burt
Core Team
Posts: 4546
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: How to change things in Admin

Post by burt »

14Steve14 wrote: Sun Jun 28, 2026 7:14 am Just found this thread through a search and it may save me creating a new one.

We wanted to add in a character count when editing things like product title, seo title and meta description. The same with the category page. We created a hook in includes/hooks/admin/category but the only way to show the counts was to actually edit the admin/includes/actions/catalog/edit_category.php and the admin/includes/actions/catalog/views/new_product.php.

With those two files modified we were thinking about whether they could be overridden but cannot find anything using the search feature apart from this thread.

Any help appreciated.
You did post something similar a while back; https://phoenixcart.org/forum/viewtopic.php?f=10&t=2638

The general idea, as you're using JS to count keystrokes would be to also use JS to place that number somewhere nearby the input where you can see it...

It's interesting and potentially broadly useful - I'll look at doing something for the July co-op.
14Steve14
Senior Contributor
Posts: 920
Joined: Fri Oct 25, 2019 7:01 pm
Phoenix Version: v1.0.9.1
Has thanked: 17 times
Been thanked: 103 times

Re: How to change things in Admin

Post by 14Steve14 »

I did post something a while back for what I think was my current site, but in trying to replicate what we currently have onto a new latest test site I got to thinking about this again and I noticed that you wanted something more challenging.
raiwa
Certified Developer
Posts: 1640
Joined: Sat Dec 21, 2019 8:08 am
Phoenix Version: 1.1.0.6
Has thanked: 70 times
Been thanked: 152 times

Re: How to change things in Admin

Post by raiwa »

I used in the admin image support included in the latest kissit image version, a new way (at least for me) to overwrite the default view of the Admin catalog's categories/products listing.

As catalog.php is not yet modernized to easy add custom columns to the listing by hook, before I injected columns by javascript. The other way is to redirect to a renamed copy of catalog.php, duplicating all related action and language files.

As I only needed to modify the default view file, I made a hook which adds the URL parameter "default_images" when no action parameter is set. This loads my modified copy of the view file instead of the default view file.
Hook: includes\hooks\admin\catalog\catMod.php

Code: Select all

class hook_admin_catalog_catMod {
	
	  function listen_injectSiteStart() {
			$GLOBALS['action'] = !Text::is_empty($GLOBALS['action'])? $GLOBALS['action'] : 'default_images';
		}

}
Then in the copy of the core default view file:
admin\includes\actions\catalog\views\default_images.php
I added the custom column(s).

The language constants for the column header(s) can be defined in a language file of the hook:
includes\languages\english\hooks\admin\catalog\catMod.php


Hope it's helpful.
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply