Add model under product name in admin
- tessthepup
- Certified Developer
- Posts: 381
- Joined: Mon Mar 01, 2021 5:55 pm
- Phoenix Version:
- Has thanked: 47 times
- Been thanked: 62 times
Add model under product name in admin
Hi Guys,
I have the need to be able to see the model of the product without editing the product.
I have looked through the admin/includes/actions/catalog/ files but not sure how/where to put the relevant code.
Ideally I would like the products_model either under the product name or above the date added line.
I have the need to be able to see the model of the product without editing the product.
I have looked through the admin/includes/actions/catalog/ files but not sure how/where to put the relevant code.
Ideally I would like the products_model either under the product name or above the date added line.
You do not have the required permissions to view the files attached to this post.
- Kofod95
- Senior Contributor
- Posts: 748
- Joined: Sat Feb 06, 2021 7:38 pm
- Phoenix Version: 1.0.8.20
- Has thanked: 99 times
- Been thanked: 179 times
Re: Add model under product name in admin
You can hook that in. Try watching the end of Zipurs video for the customer data module (how did you find us), where he shows how to hook something into the infoBox.
//Daniel
//Daniel
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
Here are a lot of corns: Phoenix user guide
- tessthepup
- Certified Developer
- Posts: 381
- Joined: Mon Mar 01, 2021 5:55 pm
- Phoenix Version:
- Has thanked: 47 times
- Been thanked: 62 times
Re: Add model under product name in admin
Cheers Daniel, It helped and worked
I would however like the model furthe up either under the product name or above the date added.
Any ideas without changing the core hook placement???
Thanks
Mark
You do not have the required permissions to view the files attached to this post.
-
ecartz
- Core Team
- Posts: 3084
- Joined: Tue Nov 05, 2019 6:02 pm
- Phoenix Version:
- Has thanked: 4 times
- Been thanked: 208 times
Re: Add model under product name in admin
- tessthepup
- Certified Developer
- Posts: 381
- Joined: Mon Mar 01, 2021 5:55 pm
- Phoenix Version:
- Has thanked: 47 times
- Been thanked: 62 times
Re: Add model under product name in admin
Lost me with that one palecartz wrote: ↑Sun Jul 14, 2024 12:45 pmUse array_splice instead of appending.
https://stackoverflow.com/q/1763959/6660678
-
heatherbell
- Senior Contributor
- Posts: 2540
- Joined: Mon Oct 07, 2019 4:39 am
- Phoenix Version:
- Has thanked: 35 times
- Been thanked: 243 times
Re: Add model under product name in admin
Maybe that's an unhelpful reply when looking for more help? Not even a thank you?
Look at the StackOverflow link given, there's another link there that goes to https://www.php.net/manual/en/function.array-splice.php which explains its use.
Can only guess that you're using array_push in your hook (shouldn't need to guess, post your code) so try using array_splice instead, use the examples in PHP Manual as a start point.
- tessthepup
- Certified Developer
- Posts: 381
- Joined: Mon Mar 01, 2021 5:55 pm
- Phoenix Version:
- Has thanked: 47 times
- Been thanked: 62 times
Re: Add model under product name in admin
heatherbell wrote: ↑Sun Jul 14, 2024 3:24 pmMaybe that's an unhelpful reply when looking for more help? Not even a thank you?
Look at the StackOverflow link given, there's another link there that goes to https://www.php.net/manual/en/function.array-splice.php which explains its use.
Can only guess that you're using array_push in your hook (shouldn't need to guess, post your code) so try using array_splice instead, use the examples in PHP Manual as a start point.
No disrespect intended, sorryMaybe that's an unhelpful reply when looking for more help? Not even a thank you?
Thank you I will look at that.Look at the StackOverflow link given, there's another link there that goes to https://www.php.net/manual/en/function.array-splice.php which explains its use.
I am not using array_push but thisCan only guess that you're using array_push in your hook (shouldn't need to guess, post your code) so try using array_splice instead, use the examples in PHP Manual as a start point.
Code: Select all
<?php
class hook_admin_catalog_catalogmodel{
public function listen_infoBox($parameters) {
global $product;
if (isset($product) && ($product Instanceof Product)) $parameters['contents'][] = ['class' => 'style', 'text' => TEXT_CATALOG_PRODUCTS_MODEL . ' ' . $product->get('model')];
}
}-
ecartz
- Core Team
- Posts: 3084
- Joined: Tue Nov 05, 2019 6:02 pm
- Phoenix Version:
- Has thanked: 4 times
- Been thanked: 208 times
Re: Add model under product name in admin
Code: Select all
if (isset($product) && ($product Instanceof Product)) {
array_splice($parameters['contents'], 1, 0, [['class' => 'style', 'text' => TEXT_CATALOG_PRODUCTS_MODEL . ' ' . $product->get('model')]]);
}- tessthepup
- Certified Developer
- Posts: 381
- Joined: Mon Mar 01, 2021 5:55 pm
- Phoenix Version:
- Has thanked: 47 times
- Been thanked: 62 times
Re: Add model under product name in admin
Thank you very much. Works perfect.ecartz wrote: ↑Mon Jul 15, 2024 4:54 amChange the 1 to other numbers to change where it appears.Code: Select all
if (isset($product) && ($product Instanceof Product)) { array_splice($parameters['contents'], 1, 0, [['class' => 'style', 'text' => TEXT_CATALOG_PRODUCTS_MODEL . ' ' . $product->get('model')]]); }
- burt
- Core Team
- Posts: 4550
- Joined: Tue Oct 29, 2019 9:37 am
- Phoenix Version: v1.1.0.8
- : Buy Me A Beverage
- Has thanked: 252 times
- Been thanked: 412 times
Re: Add model under product name in admin
You could also add in a new column to the display table, with a Hook.
So (eg) model could be in between the "name" and the "red/green status" columns.
So (eg) model could be in between the "name" and the "red/green status" columns.
I am not here to build for you.
I am here to build with you. Let's help each other.
I am here to build with you. Let's help each other.