How do I apply nonintrusive design changes to Magento 1.X - magento

I am having a little trouble here with a Magento installation here, which I "inherited" from a company who did some pretty heavy customizations to the theme.
I tried to rationalize most of the changes and was pretty successful with it. The problem is now, that I have some template files which have only one line of change.
In this specific case for example it would be a <button> that is now an <a> link. This is pretty much only one line in a 300 line template file.
Similar problems occurred with layout files of extensions. They have ONE dirty line in there, which for example resets the whole layout.
I then need to overwrite the complete layout XML file in the design, just to make a little change in one line, because those layout files are either overwritten or not. There is not merging process involved.
I took a look into the designer's documentation of Magento, but could not find anything useful.
I know that I could do some specific layout changes in the "local.xml" in my design, but those are more or less "contextless", which is not that great if those changes do belong to a certain extension.
Do you know a way to apply little template changes like mentioned in the first half or partially layout file overrides?
My main goal is to keep the files automatically updatable, which pretty much means: Download the module, replace files, done.
No manual updates to any overwritten files.

Use the "inherited" template as default template in a new package and add a child template with your changes. Example:
app/design/frontend/[package_name]/default - here will be the "inherited" old template
app/design/frontend/[package_name]/[your_child_template] - here will be your new child template
skin/design/frontend/[package_name]/default - here will be the "inherited" old template
skin/design/frontend/[package_name]/[your_child_template] - here will be your new child template
Partially layout file overwrides can be done for all pages or extensions in one local.xml file. Example:
app/design/frontend/[package_name]/[your_child_template]/layout/local.xml
If you want to add changes for a certain extension just add the extension xml file in your template folder. It will be the last one rendered and will wthe original. Example for the checkout cart page:
app/design/frontend/[package_name]/[your_child_template]/template/checkout/cart.phtml
For a small change inside a phtml file like your button example you will have to overwrite the whole phtml file. There is no way in Magneto to overwrite just a part of a phtml file.

Related

Add a warning directive at the top of every page on a Sphinx RTD site

I'd like to add a simple warning directive at the top of every page on a Sphinx RTD site:
.. attention::
The next major release of this project will launch on X date.
In the meantime, we're looking for feedback.
If you'd like an early preview, please reach out at someemail#someaddress.com!
What's the simplest way to do this? I'm using the sphinx_rtd_theme.
I can see how to add a block using the extrabody block, but it appears outside the main content area and is positioned and styled totally independently.
Ideally, I'd want this block to show up at an attention directive just below the breadcrumbs on every page.
You could add this to the conf.py Sphinx configuration file:
rst_prolog = """.. attention::
The next major release is imminent.
"""
and it will be included at the beginning of every source file that is read ‒ see https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-rst_prolog.
F-string literals work too, so f'This is release #{release}' will substitute that variable value.

Edit PHP file for Joomla 2.5 Module K2 Content

I'm trying to edit the K2 content module by changing the file:
/modules/mod_k2_content/tmpl/Default/default.php
Basically I need a div to wrap around:
<a class="moduleItemCategory">
Somewhere near line 128.
But when I change the file nothing is changed on the webpage...
Is this the right file?
I'm not using sub-templates.
It might be possible that there is a template override for this file. Template overrides are simply a duplicate of your default.php (name may sometimes be different) which will be located in the directory below and is used to perform edits to the view of an extension without editing the core file.
templates/TEMPLATE_NAME/html/mod_k2_content/default.php
If you see this file there, then you will need to edit this one

create dynamic template for joomla 1.5

there are tutorials on the web about gow to create index.html, css file and template.xml that contain placeholders. ok, i got it, it's simple. but i need a template that has some different views. for example:
-all pages have a topmenu, header, left sidebar, mainarea and a footer but:
-first page has no header .topmenu after which sidebar, mainarea and footer comes.
-second page has sidebar moved from left to right
-third page has four blocks (blocks for special offers) instead of mainarea.
as far as i can see, i need to create three standalone templates with unique set of placeholders for each template. because i can't see the way to change laarge mainarea placeholder with four placeholders for offers blocks on some pages. dynamically.
is there if-statements in joomla templates to simply determine a document id to view four placeholders instead of mainarea. or to not show header on the main page (f.e. doc. id="mainpage")
but i want it to be selectable like:
-this page has first case of that template (index_1.php)
-and that page has a second case of the same template (index_2.php)
like a selectbox.
is that possible?
I will make this an answer as opposed to a comment since I believe it will do what you are looking for.
Once your articles are setup and your links to them are established (the site has the info on it you're looking for), you can create the modules containing the data that you want shown from time to time.
Go to the module manager - on the right you should see 'module assignment' or something along the lines of 'display this module on the following pages'; you can then pick which pages you want the module to show on. You can specify all pages, none, specific pages, however you want.
This will enable you to show them only where needed however you like.
You can ALSO do this programatically inside the module (if you do custom HTML and use an extension like Sourcerer to add PHP to the module) with PHP should you want a little more flexibility, but just choosing the pages to show on should work for what you're doing.

Best Way to Modify Another Programmer's Navigation

"Change an item in the navigation? Sure I can do that in 15 minutes."
So I am trying to update the navigation on a site that I inherited only to find out that the previous programmer was a college student and was using this site as a project of some sort. Needless to say there are zero comments and the code calls function after function and I just can't follow the logic.
I am looking for a roundabout way to update the navigation. I tried using Dreamweaver to search through all of the files in the site and look for any files that contain the name of the page or the url (hoping to find some sort of included file). There was none. I did file text files that control the main navigation but none for the subnavigation.
There is no database.
If it helps here is the site. http://bit.ly/jbs639
And if you want to look at the interesting text file that is parsed to create the main navigation you can find it here: http://bit.ly/m3erna
Hmmm.... Interesting indeed. You have my sympathy.
One thing that I would look at... The file that gets parsed for the main navigation appears to be a simple delimited file. Sure, the delimiter is a rather unusual +++, but that choice means it avoids conflict with things like commas that might be desirable in the link text. It looks as if the last element indicates what type of resource is being accessed (file or directory, although I don't know what - if any - effect that has on the final output). It also appears that there are similar text files (in the framework/cfg/nav/ folder... which should probably not be generally accessible BTW) for the sub-menus. (E.g. the file stores.txt appears to contain the additional navigation items associated with the stores sub-navigation).
You don't mention which sub-menu you're trying to change. I suspect it is the "About TTO" one, which I can't find an entry for... but I'd look to see if there are any similar navigation text files in the /content/about/ folder.
Good Luck!
Of course it was as simple as a function that reads all of the files in the directory and the name of the file. I guess that in this case there was no shortcut.

Magento xml layouts - before="-" not working in 1.4.2

I have some custom extensions. They're shown in the right sidebar, and I previously had them appearing directly underneath the sidebar cart, which appears at the top, as it has before="-" in the checkout.xml file.
Since upgrading to 1.4.2, my custom extensions now appear at the top of the sidebar. I've added after="cart_sidebar" to the extensions xml layouts, but they still appear above the sidebar cart regardless.
Changing the order of the extensions, they only move amongst themselves, always at the top - for example, if I add after="-" to any of them, they just appear after the other custom extensions, but still at the top above the cart and other default sidebar items.
Anyone any idea why?
UPDATE:
I turned on the "Template Path Hints", and for my custom sidebar blocks, the red text showing the template paths appears further down the sidebar, where the block should be showing, but the actual html of the block is appearing at the top of the sidebar still!
Before trying to find out what's happening in here you should notice following:
All Magento modules and extensions are loaded in such an order that they meet their declaration section requirements (xmls in app/etc/modules/). So that modules that depend on other modules are loaded only after them.
If modules are equal by their needs, then priority goes to 'Mage' namespace, then to custom modules namespaces. Inside namespaces priority is given by alphabetical order.
Module layout configuration is created during module load. So result of "before" and "after" instructions depends on blocks already added by previously loaded modules. I.e. when some block has 'before="-"' instruction - it places block first, but later other blocks from next modules can use their instructions to be attached before this block.
Now let's return to your case. Your problem can have multiple reasons heavily depending on your Magento configuration.
First of all I recommend to
Turn off whole cache - so that you'll see all changes instantly
Turn off all your extensions and test things only with one of them
Turn on default Magento CE theme and skin ("default" package)
Then check following cases:
Maybe your layout scheme is modified and your extension not referencing correct block (same as "cart_sidebar" uses) to put self in.
Maybe some extension deletes original cart_sidebar block and then puts it last in queue of blocks.
Maybe some CSS or JS rules place block only visually before other blocks (check blocks order in original html source)
Maybe some extension is modifying layout composition rules. Try to turn only one of them. Then try to turn only other one and check result.

Resources