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
Related
Hi I'm new to magento!
I want to edit the layout of the search field like change its placeholder, text instead of icon for the search button, etc.
and it seems like its located here:
/www/cleanz-aire/vendor/magento/module-search/view/frontend/templates/form.mini.phtmlMagento\Framework\View\Element\Template
I'm working in a child theme so is there any way I can edit it from child theme?
Sure you can.
Create a directory Magento_Search in your theme.
app/code/design/frontend/<vendor>/<name>/Magento_Search
Create a file in the Magento_Search directory.
app/code/design/frontend/<vendor>/<name>/Magento_Search/templates/form.mini.phtml
Copy code from the original file (vendor/magento/module-search/view/frontend/templates/form.mini.phtml) into the new one and make your changes.
Don't forget to flush your caches.
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.
So we have a section on our website (category menu) which was modified to include a custom menu system. in the file top.phtml i found the following code
<div >
<?php //echo $_menu;
echo $nf_menu;
?>
</div>
The code inside the div's is calling for the menu, but i need to edit the actual code of the menu as it has inline styles for z-index applied to it and i need to adjust the z-index number.
Where would i find this menu. does that php code indicate where the file may be? Our coder is gone so we are not sure how they did this.
Based on the very limited information you've provided, there are basic ways of finding out where specific code is being generated in Magento (or any other scripting/php based framework).
View the html source (output) of your menu in a browser and find a piece of the menu HTML that would be unique. An example can be a unique class name or something that will set it apart from everything else.
<ul class="nf-menu">
<li>...
Do a site-wide file search for the unique reference you found in step 1. For example, search for <ul class="nf-menu"> or just nf-menu.
Don't know how to search for text in a file? Use the resources you have available to learn how:
For Linux based machines, see Finding all files containing a text string on Linux
Or if you have the files locally, use an IDE program such as phpStorm or Dreamweaver that includes a folder search for files containing a string of text.
Once you've found the file generating the code, simply make the modifications. I'd recommend making a backup of any file you modify so that you can revert to it if you're changes don't work as intended.
In the shopping cart page of my magento store, there is a line item for Shipping & Handling. I am trying to change the HTML output of this line. I have figured out how to change the actual text "Shipping & Handling - Method" , but I would like to change the actual HTML output. I looked through all of my theme files and could not figure out where to access this. I simply need to add a CSS class for that line so I can style it. Any ideas?
Thank you.
An easier solution to take if you are not a developer is to update the translation of that line of text in your translation file /app/locale/en_US/Mage_Checkout.csv if it isn't already in there just add a line at the end. The first part is what the text currently is and the second is what you want it to read.
tread lightly, it effects that line of text anywhere on your site.
If you just need to style some text add the html of that section and I can help you with a selector.
The file you are looking for is app/code/core/Mage/Sales/Model/Quote/Address/Total/Shipping.php you will
$title = Mage::helper('sales')->__('Shipping & Handling');
Under fetch(Mage_Sales_Model_Quote_Address $address) function and around 20th line. There you can change but editing magento core file is not recommended. So you have two solutions
Copy Shipping.php file in to local code pool and edit there
This is the best way create your own module for override Shipping.php file by extending Mage_Sales_Model_Quote_Address_Total_Shipping class you can find a tutorial of creating module at steve perrys' blog
I just want to add some 'default text' to the fields...
My efforts to edit the PHP have not worked at all !!
I'm guessing that the file to edit is the ' mod_simpleemailform.php '
I cant seem to find the "echo's" that spit out the form...
Am i on the right track...?
Thanks!!
Based on my research this is not a module that comes installed with Joomla! I will answer your question when it comes to properly formated modules.
To find your form go into the folder for your module. In your case it should be /modules/mod_simpleemailform.
This is where the "System" for your module resides. You will find files such as:
mod_simpleemailform.xml This is a configuration file for the module.
index.html This prevents the listing of your module's folder contents.
helper.php This is where your module's functions and brains are located.
mod_simpleemailform.php This calls functions in your helper.php in order to get content and information. Once it has all of its data it will call a template file for the module located in /tmpl of your module's directory.
In here you will find:
index.html It does the same thing as the previous index.html
default.php This is your default template file for your module. This file will contain your form and HTML code that you see on screen.
The default.php is the file that you likely want to use. It is possible that your form is in an other file located in the /tmpl folder so you may have to pick around a little bit.
Usually your fields are not in an echo they are just place on the outside of php tags. You will likely want to add a value attribute and then add some text to it like so <input type="text" name="myField" value="My Default Text" />.
Even better still you could add parameters to the XML file so then you may echo a default text you entered in the back-end of Joomla!.
Just follow on Jonathan's answer, yes, you can find the brain of the module inside of helper.phpand all that you need to achieve your goal: "add some 'default text' to the fields".
Inside the constructor function, you can find the following sentence, that save in $l the name of the current field (because it's inside a loop):
$l = trim($params->get($labelLabel));
you can just add a string with your desired default text (i.e. inside a variable: $myDefaultText):
$l = $myDefaultText . trim($params->get($labelLabel));