Shopware - Not able to show my page in My apps - shopware6

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>

Related

How to remove Magento product details storage in browser?

In Magento 2 when we are opening multiple products it stores data of those products into window.localStorage.product_data_storage locally into the browser many of the browser that data get deleted automatically but in some of the browsers it is not getting deleted
I do have to say I opened about 200 products before this happened, but
it is never clear.
When we clear the cache of browser then it is removing that content of data from browser, but it is simply understood that the end user will not go to clear their cache every time so How we can remove this content from their browser?
Any Help will be appreciated
Thank You!
As of I understood that you wanted to remove the content from browser that Magento stores locally into every browser when you/anyone opens your site to use them at some places for example to maintain the component of knock-out js in magento like in checkout page, mini-cart, etc.
Here I have created a module to achieve this, with this module you can manage that how much content should be stored into the browsers local storage. Means the magento will store the content into local storage of browser but like if you want that data should be get deleted when the limit riches to 10-20 whatever the unit you wish Then the module will delete the content from the browser & magento will again start storing data to the local from 1 count to your desired limit.
Create a module at below location
Magento_root/app/code/{VendorName}/{ModuleName}
Create below files into it at the appropriate given location.
registration.php
etc/module.xml
view/frontend/layout/catalog_product_view.xml
view/frontend/templates/product/view/removelocal.phtml
view/frontend/web/js/removelocal.js
Here I am not putting the content of registration.php & module.xml assuming that it is already understood to you. For this answer I am taking the VendorName => Vendorname & the ModuelName => Removelocal. Here is the code of custom module.
catalog_product_view.xml
<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="Magento\Framework\View\Element\Template" name="vendorname.removelocal.content" template="Vendorname_Removelocal::product/view/removelocal.phtml" before="-" />
</referenceContainer>
</body>
</page>
removelocal.phtml
<div class="swatch-opt" data-role="remov-local-content"></div>
<script type="text/x-magento-init">
{
"[data-role=remov-local-content]": {
"Vendorname_Removelocal/js/removelocal": {
}
}
}
</script>
removelocal.js
define([
'jquery'
], function ($){
'use strict';
$.widget('mage.removelocal', {
_init: function () {
if(window.localStorage.product_data_storage)
{
var temp = window.localStorage.product_data_storage;
var myObject = JSON.parse(window.localStorage.product_data_storage);
var count = Object.keys(myObject).length;
if(count >= 10){
window.localStorage.removeItem('product_data_storage');
}
}
}
});
return $.mage.removelocal;
});
Note: After completing please do run the below command.
php bin/magento module:enable Vendorname_Removelocal
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy -f
php bin/magento cache:flush

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.

read and writing file using mozilla xul

I've got a problem with reading and writing files in mozilla xul.
At first I want simply to read path to file(to check whether I/O works)
So I wrote this code
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="window" title="title">
<script>
Components.utils.import("resource://gre/modules/FileUtils.jsm");
var file = FileUtils.getFile("Desk", ["temp.xml"]);
alert(file.path);
</script>
</window>
It should show alert window with path to temp.xml(this file exists on desktop). But it shows nothing in mozilla firefox.
what's the problem?
My Firefox shows two problems:
it chokes on alert() with error:
Error: Cannot call openModalWindow on a hidden window =
NS_ERROR_NOT_AVAILABLE Source file:
resource://gre/components/nsPrompter.js Line: 382
Your window has no style, so it's "invisible"
Here is a work around with displaying the path in a textbox instead and in browser console
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="window" title="title">
<textbox id="text" value="N/A"/>
<script type="application/javascript">
Components.utils.import("resource://gre/modules/FileUtils.jsm");
var file = FileUtils.getFile("Desk", ["temp.xml"]);
document.getElementById("text").value = file.path;
console.log(file.path);
//alert(file.path);
</script>
</window>

Flex mobile - tabbed application data http service

Flex Mobile Project
I have a tabbed application with a http service.
I would like to load the data, and once it is loaded pass it to the first tab, so the first tab can show a list with some data of the http service
I would like to use the firstViewData property of the tab (as probably on the future I will send different data to each tab)
I have tried the following but I get no data on the view :-(
On the main application
<?xml version="1.0" encoding="utf-8"?>
<s:TabbedViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:wsdatos="services.wsdatos.*"
creationComplete="tabbedviewnavigatorapplication1_creationCompleteHandler(event)"
applicationDPI="160">
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.events.FlexEvent;
import mx.rpc.events.ResultEvent;
public var WS:ArrayCollection;
protected function operation1():void
{
Operation1Result.token = wSDatos.Operation1();
}
protected function tabbedviewnavigatorapplication1_creationCompleteHandler(event:FlexEvent):void
{
operation1();
}
protected function wSDatos_resultHandler(event:ResultEvent):void
{
WS = event.result as ArrayCollection;
}
]]>
</fx:Script>
<s:ViewNavigator label="Home" width="100%" height="100%" firstView="views.HomeView" firstViewData="{WS}"/>
<s:ViewNavigator label="Publicidad" width="100%" height="100%" firstView="views.PublicidadView"/>
<s:ViewNavigator label="Eventos" width="100%" height="100%" firstView="views.EventosView"/>
<fx:Declarations>
<s:CallResponder id="Operation1Result"/>
<wsdatos:WSDatos id="wSDatos" result="wSDatos_resultHandler(event)"/>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
</s:TabbedViewNavigatorApplication>
On the home view
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" title="Home">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:List width="100%" height="100%" dataProvider="{data}" labelField="Nombre"/>
</s:View>
I am just new in Flex so I am probably missing basic concepts...
Any help on how to pass the data ?
The sample below works really fine on a not tabbed application, I just use navigator.pushView(views.HomeView event.result as ArrayCollection); on the function wSDatos_resultHandler (No need to use the var WS)
So I am trying to do somehting similiar on a tabbed application
Thanks!
One thing you'll need to do is mark your variable WS as [Bindable]. Without this, there is no notification sent when the data changes.
What's happening is that the view is created and the data from WS (initially unspecified) is used to display; then the HTTP request populates the WS return value, but since it's not marked Bindable the view isn't notified to update.

Multiple File uploads using .ashx

I have been looking at this for several days now with no success. I am trying to create a multi-file upload system for a website. I have tried several jQuery plugins, including SWFUpload and Uploadify. Everything works except for the actual upload; the uploaded files never save to the folder. I'm guessing its the way I am using the .ashx, so any direction on whats wrong with the following code is appreciated. Thanks,
//Jquery is inherited, and I'm pretty sure this is all correct
<link href="/_uploadify/uploadify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="/_uploadify/swfobject.js"></script>
<script type="text/javascript" src="/_uploadify/jquery.uploadify.v2.1.4.min.js"></script>
//Again, this all works as expected. CSS displays, SWF works, the issue I THINK deals
//with 'script' and 'folder'. My Upload.ashx is in the root, as well as uploads folder
<script type="text/javascript">
$(document).ready(function () {
alert("here");
$('#file_upload').uploadify({
'uploader': '/_uploadify/uploadify.swf',
'script': 'Upload.ashx',
'cancelImg': '/_uploadify/cancel.png',
'folder': 'uploads',
'multi': true,
'auto': true
});
});
</script>
<input id="file_upload" name="file_upload" type="file" />
//My handler code, I'm not sure if this works or not but I do know that if
//I try to debug nothing ever fires... I'm sure that's part of the problem
<%# WebHandler Language="C#" Class="Upload" %>
using System;
using System.Web;
using System.IO;
public class Upload : IHttpHandler {
public void ProcessRequest(HttpContext context)
{
HttpPostedFile file = context.Request.Files["Filedata"];
file.SaveAs("C:\\" + file.FileName);
context.Response.ContentType = "text/plain";
context.Response.Write("Hello World");
}
public bool IsReusable
{
get
{
return false;
}
}
}
That's everything I have. If I try to upload a file with SWFUpload jQuery it says it succeeds but nothing ever saves to the folder. If I try with Uploadify it fails with either an HTTP Error or IO Error, and again, nothing saves. Thanks for any and all help.
I figured it out after some more time and debugging. The issue was actually with Form Authentication and occurred on any pages after the login screen. Here is the fix...
Add one of the below snippets to the web.config
If you aren't worried about any authentication try
<authorization>
<allow users="*"/>
</authorization>
If you only want to allow access to the new handler, do this
<location path="_handlers/Upload.ashx">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
After I did this the debug points I had in my handler file were getting hit and I was able to solve the rest from there.