[SOLVED] - Showing Product Title in Admin During Product Editing
Posted: Fri Jul 08, 2011 7:26 pm
Today, I came across a problem that was silently bugging me for the past week and that is that when I am editing a product in the admin system, I sometimes forget what product I am editing. With over 500 products, you can easily get lost. The problem is that Open Cart does not show you the product name while you are editing in one of its many tabs including "Data", "Link", and "Design". It just says "Product". I would like it show the name of the product that I am editing wherever I am. I went to work to make that happen and solve this problem.
You only need to add 4 lines of code to the \admin\controller\catalog\product.php
You also need to add that variable to the view at admin\view\template\catalog\product_form.tpl
Editing the view is quick and only takes one line.
Look for the line of code with <?php echo $heading_title towards the top. You simply add your $product_title variable that you set up in the controller.
That is it! Your product title will now display.
If you notice in my controller code, I am reference the language file, which is optional and that simply shows "New Product" when you are adding a new product, but you will need to add that entry to your language file at \admin\language\english\catalog\product.php - This is optional and you can change the first line in the controller code to $this->data['product_title'] = "New Product"; and bypass the language file if you want.
I also have written more details on this on my hub at http://hubpages.com/hub/OpenCart-Ecomme ... min-screen
Bruce
You only need to add 4 lines of code to the \admin\controller\catalog\product.php
Code: Select all
$this->data['product_title'] = $this->language->get('product_title'); // Initiate the product_title variable for the view when entering a new product.
if(isset($this->request->get['product_id']))
{
$this->data['product_title'] = $this->data['product_description'][1]['name']; // Change the product_title variable for the view if we are editing an existing product.
}
Code: Select all
<?php echo $heading_title . ": $product_title"; ?>
Look for the line of code with <?php echo $heading_title towards the top. You simply add your $product_title variable that you set up in the controller.
That is it! Your product title will now display.
If you notice in my controller code, I am reference the language file, which is optional and that simply shows "New Product" when you are adding a new product, but you will need to add that entry to your language file at \admin\language\english\catalog\product.php - This is optional and you can change the first line in the controller code to $this->data['product_title'] = "New Product"; and bypass the language file if you want.
I also have written more details on this on my hub at http://hubpages.com/hub/OpenCart-Ecomme ... min-screen
Bruce