How do I write html to magento footer in a module - module

I am trying to make a basic Magento module that writes to the footer of a store.
Here's what I've got so far.
<?php
class CTRL_DRP_Block_Footer_Footer extends Mage_Page_Block_Html_Footer{
protected function _toHtml(){
$html = 'CPTEST';
return $html;
}
}
I'm not sure if I'm heading in the right direction here. Can someone send me resources to help me learn how to go about this correctly?
Any help is appreciated.

The footer block already exists so you only need to add a simple block inside it.
In your module's config.xml file define a layout file.
...
<frontend>
<layout>
<updates>
<YOUR_MODULE>
<file>YOURMODULE.xml</file>
</YOUR_MODULE>
</updates>
</layout>
</frontend>
...
In the base theme's layout/YOURMODULE.xml file add to the footer block.
...
<default>
<reference name="footer">
<block type="core/template" name="YOUR_MODULE_footer" template="YOURMODULE/footer.phtml" />
</reference>
</default>
...
Create the appropriate template/YOURMODULE/footer.phtml file for the same theme.
<p>CPTEST</p>

Related

Shopware - Not able to show my page in My apps

I created Shopware App. I wanted to show my app in Iframe. But always showing "Whoops! You’ve moved too fast and lost orientation."
This is my manifest.xml
<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/shopware/platform/trunk/src/Core/Framework/App/Manifest/Schema/manifest-1.0.xsd">
<meta>
<name>TF</name>
<label>TF</label>
<label lang="de-DE">TF</label>
<author>TF</author>
<copyright></copyright>
<version>1.0.0</version>
<license>MIT</license>
</meta>
<setup>
<secret>test</secret>
<registrationUrl>https://example.com/shopware/register</registrationUrl>
</setup>
<permissions>
<read>order</read>
<read>product</read>
</permissions>
<admin>
<main-module source="https://example.com/app/shopware"/>
</admin>
</manifest>
I am using Laravel for my site. And I created route like
Route::get('/app/shopware', 'ShopwareController#showApp');
and my function is
public function showApp(Request $request)
{
echo 'Showing TF';
}
If I access this URL directly its working fine, but in Shopware showing error like this
How to solve this issue?
Thanks
I think you need to append the shop id and a timestamp to the url in the registrationUrl tags. This could be the reason shopware throws this error.
Take a look in here App Base Guide
There is an example of how a request should look like.
I think you need to add script code in the response html
<script>
window.onload = function () {
window.parent.postMessage('sw-app-loaded', '*');
}
</script>

Alfresco custom aikau footer

I want to customize Alfresco aikau footer. For the beginning I would like to inject custom html-template in AlfShareFooter. So far I created an extension:
<extension>
<modules>
<module>
<id>MyCmpny widgets</id>
<version>1.0</version>
<auto-deploy>true</auto-deploy>
<configurations>
<config evaluator="string-compare" condition="WebFramework" replace="false">
<web-framework>
<dojo-pages>
<packages>
<package name="mycmpny" location="js/mycmpny"/>
</packages>
</dojo-pages>
</web-framework>
</config>
</configurations>
</module>
</modules>
</extension>
Html template for the footer and now I'm trying to override templateString of the AlfShareFooter object:
define(["dojo/_base/declare",
"alfresco/footer/AlfShareFooter'",
"dojo/text!./templates/ep-footer.html"],
function (declare, AlfShareFooter, template) {
return declare([AlfShareFooter], {
templateString: template
})
});
But it doesn't work. I am not familiar with Dojo and I think the problem is in the syntax...
I've found out how to override template:
define(["dojo/_base/declare",
"dojo/text!./templates/my-footer.html",
"alfresco/footer/AlfShareFooter"],
function (declare, template, AlfShareFooter) {
return declare([AlfShareFooter],{
postMixInProperties: function my_footer_AlfShareFooter__postMixInProperties(){
this.inherited(arguments);
this.templateString = template;
}
});
});
But with g̶r̶e̶a̶t̶ custom footer template comes g̶r̶e̶a̶t̶ custom css and i18n... So I wrote a post about changing Aikau footer in Alfresco.

Cannot Display an Image (404)

I'm looking into upgrading an existing MVC5 project to MVC6. However when I try to get an image to display in the MVC6 project, it 404s. The path to the image is:
/Content/images/image.png
In my MVC5 project, the following works:
<img src="#Url.Content("~/Content/images/image.png")" />
I have tried the following:
<img src="#Url.Content("~/Content/images/image.png")" />
<img src="#Url.Content("/Content/images/image.png")" />
<img src="#Url.Content("Content/images/image.png")" />
<img src="#Url.Content("~Content/images/image.png")" />
<img src="~/Content/images/image.png" />
<img src="/Content/images/image.png" />
<img src="Content/images/image" />
<img src="~Content/images/image.png" />
<img src="C:\absolute\path\Content\images\image.png" />
Has the way to reference an image changed with MVC6?
You need to put the image under the wwwroot folder. Only static files under this folder are served up. You also need to make sure you have added support for static files in your Startup.cs file.
public void Configure(IApplicationBuilder application)
{
// Add static files to the request pipeline e.g. hello.html or world.css.
application.UseStaticFiles();
// Add MVC to the request pipeline.
application.UseMvc();
}
While I think it's better to move your files into the wwwroot folder as in the accepted answer to follow standard convention, you can also change the path for static files via configuration.
In your project.json file, change the configuration attribute to point to your static file path.
"webroot": "wwwroot"
Just an alternative approach.

Powered by Odoo footer

I need to change the "Powered" in "Powered by Odoo" footer to "Made",
So the footer of my Odoo (Formerly OpenERP) Version 8.0-aab3d9f will be "Made by Odoo"
any ideas??
Instead of changing directly in the core of odoo (which is not appreciated), you can create a new module that depends on web module.
Then you can extend template web.menu_secondary from webclient_templates.xml in web module, like this:
-> _ _openerp__.py file:
{
'name': "My Module",
# for the full list
'category': 'Web',
# any module necessary for this one to work correctly
'depends': ['web'],
# always loaded
'data': ['templates.xml'],
'demo': [],
}
-> templates.xml file:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="menu_secondary" inherit_id="web.menu_secondary">
<div class="oe_footer" position="replace">
<div class="oe_footer">
Made by <span>Odoo</span>
</div>
</div>
</template>
</data>
</openerp>
First go to your Odoo web module and open below file.
addons => web => views => webclient_templates.xml
Now find this tag <div class="oe_footer"> and edit it like
<div class="oe_footer">
Made by <span>Odoo</span>
</div>
Save it and refresh your browser. Hope you get what you want.
You can use the HTML Editor of the Website module to change your site's copyright footer:
Customize > HTML Editor
Website HTML Editor Footer Copyright
As this is a fast and clean way to accomplish what you're asking for, though changes will be saved directly to working database. If you want to replicate your changes in different databases, the best approach is to make a custom module.

EPiServer 7: Trouble adding dojo module to user interface

I have some trouble adding my dojo module to the user interface.It tries to access in the episerver/shell.
I have added a module.conifg;
<module>
<assemblies>
<add assembly="Mobile.Web" />
</assemblies>
<dojoModules>
<add name="MobileWeb" path="Scripts" />
</dojoModules>
</module>
Added my dojo module at ~/ClientResources/js/KeyValueEditor.js,
named the module declare('MobileWeb.js.KeyValueEditor', [widget, templatedMixin] and in my block type:
[ClientEditor(ClientEditingClass = "MobileWeb.js.KeyValueEditor")]
public virtual string KeyValueCategoryData { get; set; }
It works sometimes, but when I changed the dojoModules -> add name attribute to MobileWeb, it wont work anymore.
Anyone knows what this can be?
It looks like the system don’t know where to find client resources.
The name in the dojoModules node is kind of your namespace and the path should point to the folder where Dojo can find resources/scripts for that namespace. This path is relative to your module root directory.
As I understand you probably want to put your JavaScript files in ClientResources/js subfolder and your styles in ClientResources/css subfolder inside your module directory. In this case you can define Dojo module like this:
<dojoModules>
<add name="MobileWeb" path="ClientResources/js" />
</dojoModules>
It means that system will try to find resources in ClientResources/js subfolder in your module directory. When declaring widgets you should follow your namespace and folder structure. You can declare your widget in ClientResources/js/KeyValueEditor.js file like this:
define([
// your imports
],
function (/* imports */) {
return declare("MobileWeb.KeyValueEditor", [_Widget, /* … */ ], {
// implementation
});
});
And then you can use MobileWeb.KeyValueEditor name when you reference your widget in the back-end C# code.
You can find some examples and source code in sample add-on for EPiServer 7.