Page 1 of 1

Suggestion: Add ability to set template file for layouts

Posted: Thu Jun 14, 2018 9:50 pm
by xseon
I'd like to propose an effective way to allow store owners set what template file to be associated with each layout. You can see it better in the attached picture but in brief:
  • In the Layout edit form should be added a new column with Upload, Download and Restore buttons for mainaining template files.
  • Uploaded files with the same name as the default name may rename the existing default file so that to be possible to restore it later if necessary.
  • Users will see the file name that is being currently used right before the buttons and will have the ability to change the file. Editing it would be available in Theme Editor section.
Then we need all controller files that output data in the catalog (clients area) to add the file name as a variable and include it in the output statement. For exapmle, for products it is:

Code: Select all

$this->response->setOutput($this->load->view('product/product', $data));
It may become like this:

Code: Select all

$this->response->setOutput($this->load->view('product/'.$filename, $data));
I think this would be a much appreciated improvement. And it seems to me it can be done easily. I hope I'm not missing something. Have a look and let me know how you think.

Re: Suggestion: Add ability to set template file for layouts

Posted: Sat Jun 16, 2018 8:10 am
Well, what keeps you from doing it ?! :o It could possibly even be offered as Extension. ;)
Still, to make such work in the first place, one could not just add another File, replacing
the Original, without making sure, that the new file would only consist out of exactly
the same 'Variables', in order to be 'understud' by the controller/language/model Files,
related to whatever File would be changed.

I would be surprised, if such a construction would not raise a lot of problems, since most
Buyers would expect it to work troughout the whole Scenario of OC Themes and Mods.
But go ahead, if you can do it, because OC won't, I assume ...
Good Luck! ;)