I'm running JomSocial 3.2 on Joomla 3.
I want to add some content to the right side of the registration page.
Some pictures and other contents.
So far, i've been able to get to the "register.index.php" file,
which is the file that displays some of the content in the homepag.
The file is in: "/site_root/components/com_community/templates/default/" folder
but i've not been able to fully edit the whole registration page.
This could be done in many different ways - even without editing any file. Install this extension: http://extensions.joomla.org/extension/advanced-module-manager and when editing module you'll have additional tab called "tasks" There will be field URL, type inside URLs of your registration form. Thanks to this you'll be able to assign modules to registration form.
You could also override for:
ROOT/components/com_community/templates/default/register.index.php
Copy it to:
ROOT/templates/your-template/html/com_community (if you don't have "html" or "com_community" folders, feel free to create them)
Then you may create module position inside file using this code:
$modules = JModuleHelper::getModules( 'reg-positon' );
foreach ($modules as $module) {
$_options = array( 'style' => 'xhtml' );
echo JModuleHelper::renderModule( $module, $_options );
}
Above code creates module position: "reg-positon'. You'll need to type this name manually as it will be not listed on module positions list.
Now you'll need a bit of html to display it on right or left of registration form.
Related
I am trying to edit the breadcrumbs in a custom Prestashop theme that I am making based on the Classic theme in version 1.7.6.8. The website I am working on has Prestashop located in a folder at mydomain.com/shop, so I would like the breadcrumbs to read:
Home / Shop / Products
Where Home links to mydomain.com and Shop goes to mydomain.com/shop.
I have added the link for Home to mydomain.com ok. Now I want to change the default Prestashop breadcrumbs because it currently reads:
Home / Home / Products
The second home goes to the right link (mydomain.com/shop) but I don't know how to change it to read Shop instead of Home. I have found a way to edit the controllers so as to remove the second home link, this would allow me to just add a new link with Shop next to the new Home link that I already added, however this doesn't seem like a very elegant solution and will require altering the script on lots of pages. Surely there must be a better way?
Thanks for any feedback.
Edit: Here is the code from controllers/productController.php
public function getBreadcrumbLinks()
{
/*$breadcrumb = parent::getBreadcrumbLinks();*/
$categoryDefault = new Category($this->product->id_category_default, $this->context->language->id);
foreach ($categoryDefault->getAllParents() as $category) {
if ($category->id_parent != 0 && !$category->is_root_category) {
$breadcrumb['links'][] = $this->getCategoryPath($category);
}
}
if (!$categoryDefault->is_root_category) {
$breadcrumb['links'][] = $this->getCategoryPath($categoryDefault);
}
/*$breadcrumb['links'][] = array(
'title' => $this->product->name,
'url' => $this->context->link->getProductLink($this->product, null, null, null, null, null, (int) $this->getIdProductAttributeByRequest()),
);*/
return $breadcrumb;
}
You can see the two sections I have removed, the first removes the default "Home" link, the second removes the link with the product name that I do not need. Obviously the code goes somewhere to look up the link and matches it to a name, I just don't know where.
I found the answer, you can change the tag from "Home" to "Shop" by altering the files in shoproot/var/cache/prod/translations/catalogue.[your language].php
There are a number of places where "Home" appears in the file, to change the breadcrumb it is around line 6370 in the en-gb version.
EDIT: Here is a better option, from your Prestashop control panel you can go to international, translations, modify translations. From the drop downs select theme translation, the theme you are working on, the language, click modify, search for "home" and then put the translation as "shop". This saves you having to make the change to the cached file if you have to clear the cache from the control panel.
I want to place articles and modules on my page. It should look like my scatch:
I am wondering if i can make 4 articles and one module (information box) and place this inbetween those articles, Or should i just create one article wich looks like the hole area (article 1-4 + INformation box)? So far i have tried to do {loadposition infobox-pos} into article 2. But than the box-width is not 100% but 50%.
Than aggain if i would make one big article with the contents from article 1-4 it would not fit great into my responsive layout.
I use T3-Framework.
Joomla doesn't support this natively, since module output is controlled by the template, and component output (in this case, com_content, view=category, layout=blog) is handled before modules are rendered.
You can proceed in many ways, I am listing them in order of decreasing ease:
Write a jquery script that moves the pieces in the browser. You could also use mootools and it's bundled with joomla, but odds are you already have jquery loaded anyways.
Write a view override for abovementioned view: so copy /components/com_content/view/category/tmpl to /templates/your_template/html/com_content/category (copy all files). Then edit blog.php and insert your module there, use something like /plugins/content/loadmodule/loadmodule.php :
$document = JFactory::getDocument();
$renderer = $document->loadRenderer('module');
$modules = JModuleHelper::getModules($position);
$params = array('style' => $style);
foreach ($modules as $module) {
echo $renderer->render($module, $params);
}
Write a content plugin
you can also use {loadmodule YourCustomModuleTitle} and place this in <div> with custom style attributes like
<div style="width:100%;float:right">{loadmodule MyModule}</div>
or
<div class="something">{loadmodule MyModule}</div>
Note: the module which loaded must be assigned to the same menu item or "all"
I've been trying to override the file login.xml but no matter what I try, the edited version in my template folder doesn't show up.
How can I override this file?
Update
I have tried template/<templatename>/html/com_users/models/login.xml and other variations like template/<templatename>/html/com_users/models/forms/login.xml or template/<templatename>/html/com_users/forms/login.xml etc without any success.
Here's a solution:
http://forum.joomla.org/viewtopic.php?t=583380#p2375649
I just tested it in Joomla 2.5.3 and it works.
Update
here is the solution copied from above URL
We can override output by using the normal template override feature. For me, I'm trying to override the login page. So, I'm taking a copy of /components/com_users/views/login/tmpl/default.php and putting it into /templates/beez_20/html/com_users/login.
Now take a copy of /components/com_users/models/forms/login.xml and place in /templates/beez_20/html/com_users/login as well.
Then edit /templates/beez_20/html/com_users/login/default.php and add at the top of the form (I added mine just after the form tag) the following lines of code:
// to reset the form xml loaded by the view
$this->form->reset( true );
// to load in our own version of login.xml
$this->form->loadFile( dirname(__FILE__) . DS . "login.xml");
Similarly you can safely edit /templates/beez_20/html/com_users/registration/registration.xml to modify the registration form.
The answer posted in the forum that #Shaz definitely works, but for Joomla 3.X you have to tweak a little, so it would be
First of all you copy
/components/com_users/models/forms/login.xml
To
/templates/YOUR_TEMPLATE/html/com_users/login/forms/login.xml
And place this piece of code right at the top
if(!defined('DS')) define('DS', DIRECTORY_SEPARATOR);
$this->form->reset( true ); // to reset the form xml loaded by the view
$this->form->loadFile( dirname(__FILE__) . DS . "forms" . DS . "login.xml"); // to load in our own version of login.xml
This did the tick for me a kudos for the user #dylanjh that posted the original answer on the Joomla forum
I was able to leverage Griiettner's solution for Joomla 3. I wanted to not allow users to edit their email address in the profile edit screen on the frontend. I only modified it slightly, copy this file:
components/com_users/models/forms/profile.xml
to:
/templates/YOUR_TEMPLATE/html/com_users/profile/forms/profile.xml
Also copy this file:
components/com_users/views/profile/tmpl/edit.php
to:
/templates/YOUR_TEMPLATE/html/com_users/profile/edit.php
And put this code at the top of the edit.php file right after the:
defined('_JEXEC') or die;
I left out the $this->form->reset( true ); // to reset the form xml loaded by the view
and only used this:
// JOOMLA 3
if(!defined('DS')) define('DS', DIRECTORY_SEPARATOR);
$this->form->loadFile( dirname(__FILE__) . DS . "forms" . DS . "profile.xml");
This allowed me to keep the user profile information populated in the edit form. I then edited the profile.xml file and added:
readonly="true"
to the email1 and email2 fields. This prevents the user from editing.
I have an extension which should give the users (logged in as an Admin in the magento backend) the ability to change some configs in the frontend area. I want to have a link in the frontend which loads the config area via ajax and gives the user the possibility to edit&save this config in the loaded div. I want to use the magento backend forms for this so i don't have to code the forms myself.
My current approach has the link on the pages and loads via ajax the correct backend page (e.g. System > Configuration > Design). For this approach I created a Controller which extends the Mage_Adminhtml_Controller_Action. This Controller get the params from the ajax request and uses an action (like the editAction of the class Mage_Adminhtml_System_ConfigController) to get the right config page in the backend.
My Problems are:
- showing only the correct Area (I just want the user to edit only the section "themes" under System > Configuration > Design) everything else should be not available... so how to remove all the information around this config section?
The form needs the JS-variable Form_Key. How to get the current Form_Key (in the frontend)?
After the ajax has loaded the content the form doesnt get initialized correctly. So if I'm trying to submit the form my firebug says "JS-Error: configForm is not defined". How to solve this form initialising ? Any ideas?
I really hope anybody here can give me a hint how to solve this problems to get the backend config work in the frontend.
This is untested, but it should be enough to get you on the right track:
Output only a specific block
In the frontend most blocks are instantiated via layout XML. In the adminhtml area this is different, so you need to work with PHP instantiation much more.
In your AJAX action I assume you are currently calling loadLayout() and renderLayout().
To only output a specific section use this instead:
public function yourAjaxAction()
{
// assuming the required config section is set in the AJAX request
$sectionCode = $this->getRequest()->getParam('section');
$sections = Mage::getSingleton('adminhtml/config')->getSections();
$blockName = (string)$sections->frontend_model;
if (empty($blockName)) {
$blockName = Mage_Adminhtml_Block_System_Config_Edit::DEFAULT_SECTION_BLOCK;
}
$block = $this->getLayout()->createBlock($blockName)->initForm();
// Set the AJAX response content
$this->getResponse()->setBody($block->toHtml());
}
The form key
The form key can be fetched via
Mage::getSingleton('core/session')->getFormKey()
It must be present in the form posted back to the server. You can use the following code to create a HTML hidden field with the formkey:
// If loadLayout() was called:
$formkeyHtml = Mage::app()->getLayout()->getBlock('formkey')->toHtml();
// If working without layout XML:
$formkeyHtml = Mage::app()->getLayout()->createBlock('core/template', 'formkey')
->setTemplate('formkey.phtml') // adminhtml theme formkey
//->setTemplate('core/formkey.phtml') // frontend theme formkey
->toHtml();
Add configForm JavaScript
The configForm variable is an JS varienForm object of the DOM element containing the config fields.
It is instantiated using:
// config_edit_form is the CSS id
configForm = new varienForm('config_edit_form');
The varienForm declaration is in the file js/varien/form.js.
There also is some additional javascript used by the system configuration. Magento always adds in these blocks to set up the system config JS environment:
Mage::app()->getLayout()->getBlock('js')->append(
$this->getLayout()->createBlock('adminhtml/template')
->setTemplate('system/shipping/ups.phtml')
);
Mage::app()->getLayout()->getBlock('js')->append(
$this->getLayout()->createBlock('adminhtml/template')
->setTemplate('system/config/js.phtml')
);
Mage::app()->getLayout()->getBlock('js')->append(
$this->getLayout()->createBlock('adminhtml/template')
->setTemplate('system/config/applicable_country.phtml')
);
I hope that gets you started.
I have created my first Magento widget on a test site (same code and configuration as my live site). The widget works perfectly on the test site. However, having moved the code to the live site, I can configure the widget instance, but the output of the widget is not showing on the product page. So I know Magento is pulling information from the widget's config.xml and widget.xml files.
I have confirmed that the correct layout update is being inserted in the core_layout_update table. The information on the live system's table is exactly the same as that on the working test site.
I have confirmed that the file permissions and ownership are correct on the live site.
I have confirmed that I can put another (Magento supplied) widget in the exact spot on the configurable product page (Product Extra Info). So I know that my templating, etc. is not getting in the way of adding the widget in that spot.
I've tried deleting the widget instance and recreating a new instance of the same widget.
I have compared the code to the test site and copied the code straight from the test site. Still no success. I have enabled php_flag display_errors in .htaccess and no errors are shown. And no errors are showing in the exception.log when enabled.
The live and test systems are on different servers, different OS's, different versions of PHP (both 5.3.x). I've refreshed all the caches and confirmed that the test widget is showing so I don't think this is a caching issue.
How is the best way to confirm that Magento on the live site can actually access or find the Block code for my widget? As indicated I know Magento is accessing the widget.xml file in my local code directory. Not sure if installing Alan Storm's CommerceBug is the way to trace or dump what Magento is trying to load (modules, widgets, etc) for the page in question.
Verify that you have your xml in the /app/etc/modules folder.
You can turn on Block Hints by going to Admin->System->Configuration->Advanced->Developer, change the Current Configuration Scope to Main Website and click on Debug. Change Template Path Hints to Yes and save.
Verify your filenames. This has gotten me a number of times. I develop on a Mac (non case-sensitive), and occasionally when I upload to Linux (case-sensitive), it breaks. One of the first thing I check is the file name's case.
Ensure that the class name matches the filename.
The next step I'd take is to take a look at the final page layout xml generated for the page your'e adding the widget to and ensure a bit of Layout XML is being added to the page for your widget. If it isn't, there's something wrong with the Layout XML Updates that are added to the table via the widget UI. If it is, then start debugging why the particular chunk of generated layout XML isn't being added to the page.
This is the top-down approach to debugging the problem, but it's the only way I know to be sure.
I had the same problem. It's my decision:
app\code\local\Mage\Core\Model\Resource\Layout.php
When 'theme' => Mage::getSingleton('core/design_package')->getTheme('layout') result is not correct: 'theme' => 'multistore', should be 'theme' => 'your_theme'.
So, delete argument 'layout' in function getTheme() and get right result
*/
class Mage_Core_Model_Resource_Layout extends Mage_Core_Model_Resource_Db_Abstract
{
...
public function fetchUpdatesByHandle($handle, $params = array())
{
$bind = array(
'store_id' => Mage::app()->getStore()->getId(),
'area' => Mage::getSingleton('core/design_package')->getArea(),
'package' => Mage::getSingleton('core/design_package')->getPackageName(),
// 'theme' => Mage::getSingleton('core/design_package')->getTheme('layout')
'theme' => Mage::getSingleton('core/design_package')->getTheme()
);
foreach ($params as $key => $value) {
if (isset($bind[$key])) {
$bind[$key] = $value;
}
}
$bind['layout_update_handle'] = $handle;
$result = '';
$readAdapter = $this->_getReadAdapter();
if ($readAdapter) {
$select = $readAdapter->select()
->from(array('layout_update' => $this->getMainTable()), array('xml'))
->join(array('link'=>$this->getTable('core/layout_link')),
'link.layout_update_id=layout_update.layout_update_id',
'')
->where('link.store_id IN (0, :store_id)')
->where('link.area = :area')
->where('link.package = :package')
->where('link.theme = :theme')
->where('layout_update.handle = :layout_update_handle')
->order('layout_update.sort_order ' . Varien_Db_Select::SQL_ASC);
$result = join('', $readAdapter->fetchCol($select, $bind));
}
return $result;
}
}