shopware 6 admin module for app not showing app in menu - shopware6

I made a shopware app and in manifest.xml i added the tag for a admin module:
<admin>
<module name="VisualSearchAdminModule"
parent="sw-extension"
source="http://localhost:8080/admin/shopware"
position="50"
>
<label>Visual Search</label>
<label lang="de-DE">Visual Search</label>
</module>
</admin>
Do you have any idea why the admin module is not showing in the menu ?
The app is installed and activated.
The module source is a valid url.
Later Edit
I do have the setup tag in my manifest. I posted below the entire manifest
<?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>VisualSearch</name>
<label>Visual Search</label>
<label lang="de-DE">Visual Search</label>
<description>Visual Search app for Shopware 6</description>
<description lang="de-DE">Visual Search app für Shopware 6</description>
<author>Agency</author>
<copyright>(c) by Agency</copyright>
<version>1.0.0</version>
<icon>Resources/config/plugin.png</icon>
<license>MIT</license>
</meta>
<setup>
<registrationUrl>http://myapp/auth</registrationUrl>
<secret>visualsearchsecret</secret>
</setup>
<admin>
<module name="VisualSearchAdminModule"
parent="sw-extension"
source="http://myapp/admin/shopware"
position="50">
<label>Visual Search</label>
<label lang="de-DE">Visual Search</label>
</module>
</admin>
<permissions>
<read>product</read>
</permissions>
<webhooks>
<webhook name="app-activated" url="http://myapp/api/shop/activate" event="app.activated"/>
<webhook name="app-deactivated" url="http://myapp/api/shop/deactivate" event="app.deactivated"/>
<webhook name="app-deleted" url="http://myapp/api/shop/delete" event="app.deleted"/>
</webhooks>
</manifest>
The registration for the app works ok.
But the admin module doesn't show in shopware admin menu.

To register admin modules, your app currently must have a setup segment to register with an external web service, even if it is a private app. Otherwise the modules will just be ignored.
<manifest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/shopware/platform/master/src/Core/Framework/App/Manifest/Schema/manifest-1.0.xsd">
<!-- ... -->
<setup>
<registrationUrl>http://localhost/register.php</registrationUrl>
<secret>verysecret</secret>
</setup>
<admin>
<module name="exampleModule"
source="https://example.com/promotion/view/promotion-module"
parent="sw-marketing"
position="50"
>
<label>Example module</label>
<label lang="de-DE">Beispiel Modul</label>
</module>
</admin>
</manifest>
Here's a minimal example for a register.php
<?php
require __DIR__ . '/vendor/autoload.php';
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\JsonResponse;
$request = Request::createFromGlobals();
$query = $request->query->all();
$proof = \hash_hmac(
'sha256',
$query['shop-id'] . $query['shop-url'] . 'TestApp',
'verysecret'
);
$response = new JsonResponse([
'proof' => $proof,
'secret' => 'verysecret',
'confirmation_url' => 'http://localhost/confirm.php'
]);
$response->send();
Exchange TestApp for the name of your app.

Related

Access denied error when accessing usb stick files in Windows IoT core app

I want to access files (images, text files etc.) from an USB stick on my Raspberry Pi 2 using Windows 10 IoT Core.
So I've added the to the appxmanifest file.
When using this code in my IBackgroundTask I get an access denied error in the second line:
public sealed class StartupTask : IBackgroundTask
{
public async void Run(IBackgroundTaskInstance taskInstance)
{
//...
Windows.Storage.StorageFolder sf = Windows.Storage.KnownFolders.RemovableDevices;
//get list of drives
IReadOnlyList<Windows.Storage.StorageFolder> list = await sf.GetFoldersAsync();
...
}
}
I found that I should add the fileTypeAssociation with the file types I'd like to access in Package.appxmanifest so I did that:
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:iot="http://schemas.microsoft.com/appx/manifest/iot/windows10" IgnorableNamespaces="uap mp iot">
<Identity Name="test-uwp" Publisher="CN=user" Version="1.0.0.0" />
<mp:PhoneIdentity PhoneProductId="8f31dff8-3a2b-4df1-90bb-2c5267f32980" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties>
<DisplayName>test</DisplayName>
<PublisherDisplayName>user</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
</Dependencies>
<Resources>
<Resource Language="x-generate" />
</Resources>
<Applications>
<Application Id="App">
<uap:VisualElements DisplayName="test" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="test" BackgroundColor="transparent" AppListEntry="none">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png">
</uap:DefaultTile>
<uap:SplashScreen Image="Assets\SplashScreen.png" />
</uap:VisualElements>
<Extensions>
<Extension Category="windows.backgroundTasks" EntryPoint="test.StartupTask">
<BackgroundTasks>
<iot:Task Type="startup" />
</BackgroundTasks>
</Extension>
<uap:Extension Category="windows.fileTypeAssociation">
<uap:FileTypeAssociation Name="myimages">
<uap:SupportedFileTypes>
<uap:FileType ContentType="image/jpeg">.jpg</uap:FileType>
</uap:SupportedFileTypes>
</uap:FileTypeAssociation>
</uap:Extension>
</Extensions>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
<uap:Capability Name="removableStorage" />
</Capabilities>
</Package>
If I want to deploy that, I get the following error:
Severity Code Description Project File Line Suppression State
Error Error : DEP0700 : Registration of the app failed.
AppxManifest.xml(37,10): error 0x80070490: Cannot register the
test-uwp_1.0.0.0_arm__yzekw4x8qxe1g package because the following
error was encountered while parsing the windows.fileTypeAssociation
Extension element: Element not found. . Try again and contact the
package publisher if the problem persists. (0x80073cf6)
As soon as I remove the uap:Extension element, the error goes away (but the access denied is still there).
Did I miss anything? Is it not possible to access files from an USB stick using a background service (I want to run that headless with no user interaction)?
At the moment you can't register a headless app that uses filetypeAssociation.
There is a workaround - see here: https://github.com/ms-iot/ntvsiot/issues/62
Simply add a headed app (project) to your solution (no need for any special code there).
Add a reference to this project in your headless app.
Now change the manifest of the headless (file asso..) and add Executable: YourHeadedApp.exe and EntryPoint: YourHeadedApp.App now with the next deploy the EXE will be included in deployment - so it can be found when the manifest is checked.

setup installer script in magento module

Hi i am developing a little magento module.
below is my directory structure of module
app/code/local/Xyz/Total
/var/www/magext/app/code/local/Xyz/Total/Block/Prototal.php
/var/www/magext/app/code/local/Xyz/Total/controllers/IndexController.php
/var/www/magext/app/code/local/Xyz/Total/etc/config.xml
/var/www/magext/app/code/local/Xyz/Total/Model/Price/Observer.php
below is my config file code
<?xml version="1.0"?>
<config>
<global>
<blocks>
<total>
<class>Xyz_Total_Block</class>
</total>
</blocks>
<models>
<xyztotal>
<class>Xyz_Total_Model</class>
</xyztotal>
</models>
<events>
<sales_order_place_after>
<observers>
<xyz_total_price_observer>
<type>singleton</type>
<class>Xyz_Total_Model_Price_Observer</class>
<method>apply_discount_percent</method>
</xyz_total_price_observer>
</observers>
</sales_order_place_after>
</events>
</global>
<frontend>
<routers>
<total>
<use>standard</use>
<args>
<module>Xyz_Total</module>
<frontName>newcatalog</frontName>
</args>
</total>
</routers>
<layout>
<updates>
<total>
<file>total.xml</file>
</total>
</updates>
</layout>
</frontend>
</config>
now what i need to install a product attribute through my module
.But i cant understand understand where should i put my installer
script and how to modify config file.
please suggest.
I saw your config.xml i am not able to find xml vesrion.
So you need to give xml version like below example:
<config>
<modules>
<Xyz_Total>
<version>0.1.0</version> <!-- Version of module -->
</Xyz_Total>
</modules>
</config>
Now create the file app/code/local/Xyz/Total/sql/total_setup/mysql4-install-0.1.0.ph‌​p
After that reinstall the module And check it.
You also have to add below code in config.xml under config tag.
<global>
<resources> <!-- These are resource setting giving access to module, read/write permission on database -->
<total_setup>
<setup>
<module>Xyz_Total</module>
</setup>
<connection>
<use>core_setup</use>
</connection>
</total_setup>
<total_write>
<connection>
<use>core_write</use>
</connection>
</total_write>
<total_read>
<connection>
<use>core_read</use>
</connection>
</total_read>
</resources>
</global>
After that reinstall module.
Take a look # Adding custom product attributes in Magento using setup script
<modules>
<Xyz_Total>
<version>0.1.0</version>
</Xyz_Total>
</modules>
<global>
....
<models>
<xyztotal>
<class>Xyz_Total_Model</class>
<resourceModel>total_setup</resourceModel>
</xyztotal>
</models>
<resources>
<catalog_setup>
<setup>
<module>Mage_Catalog</module>
<class>Mage_Catalog_Model_Resource_Setup</class><!-- that line !-->
</setup>
</catalog_setup>
</resources>
...
In
app/code/local/Xyz/Total/sql/total_setup/mysql4-install-0.1.0.ph‌​p
$installer->addAttribute('catalog_product', 'offer_type', array(
'backend' => '',
...
));

Custom module issue

I tried creating one new module. For that i created indexController, config.xml, block, layout and other required files, even though i am unable to view the message that i wrote in my block file. Whenever the url is fired (http://mydomain.com/foobar/) the output "it is from foo bar" should be displayed, but at the moment it is not working.
My indexController.php code :
class Foo_Bar_IndexController extends Mage_Core_Controller_Front_Action
{
public function indexAction()
{
$this->loadLayout();
$this->renderLayout();
}
}
Code related to block :
class Foo_Bar_Block_News extends Mage_Core_Block_Template
{
public function _prepareLayout()
{
return parent::_prepareLayout();
}
public function fetchRow()
{
echo "it is from foo bar";
}
}
code related to config.xml :
<?xml version="1.0"?>
<config>
<modules>
<Foo_Bar>
<version>1.0.0</version>
</Foo_Bar>
</modules>
<frontend>
<routers>
<foobar>
<use>standard</use>
<args>
<module>Foo_Bar</module>
<frontName>foobar</frontName>
</args>
</foobar>
</routers>
<layout>
<updates>
<bar>
<file>foobar.xml</file>
</bar>
</updates>
</layout>
<!--<events>
<catalog_product_load_after>
<observers>
<foo_bar>
<type>model</type>
<class>foo_bar/observer</class>
<method>catalogProductLoadAfter</method>
</foo_bar>
</observers>
</catalog_product_load_after>
</events>-->
</frontend>
<global>
<blocks>
<foobar>
<class>Foo_Bar_Block</class>
</foobar>
</blocks>
</global>
</config>
code related to layout.xml
<?xml version="1.0" encoding="UTF-8"?>
<layout version="0.1.0">
<default>
<reference name="content">
</reference>
</default>
<foobar_index_index>
<reference name="content">
<block type="foobar/news" name="news_test" template="bar/check.phtml"/>
</reference>
</foobar_index_index>
</layout>
Code related to template file
<?php
echo $this->fetchRow()
?>
Any help realted to this will be appreciated.
The solution to this issue in my case is to Disable the compilation from admin. Everything else is fine. The desired output is obtained after disabling the compilation from admin.
To disable compilation login to admin side of your magento project and then go to system>>Tools>>Compilation and then click on disable button to disable the compilation.

Deploying .war containing JavaFX .jar to GlassFish NoClassDefFoundError

My JavaFX application requires a class in another jar file.
Both are deployed as part of a war file
The JavaFX jar is not finding the my-xxx.class contained in WEB-INF/lib/MyJavaFXClient.jar
The contents of my war file are:
images/
META-INF/
META-INF/MANIFEST.MF
WEB-INF/
WEB-INF/lib/
WEB-INF/lib/bin/glass.dll
WEB-INF/lib/MyJavaFxClient.jar ( this is the jar my JavaFX app requires )
WEB-INF/sun-web.xml
WEB-INF/web.xml
index.jsp
index.html
MyJavaFxApp.jnlp
MyJavaFxApp.jar (my JavaFx app)
JNLP:
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0" xmlns:jfx="http://javafx.com" href="MyJavaFxApp.jnlp">
<information>
<title>App: TestDriver</title>
<vendor>Demo</vendor>
<description>JavaFX application test client</description>
<homepage href="http://localhost:8080/testdriver/"/>
<offline-allowed/>
</information>
<security>
<all-permissions/>
</security>
<resources>
<jfx:javafx-runtime version="2.2+"
href="http://javadl.sun.com/webapps/download/GetFile/javafx-latest/windows- i586/javafx2.jnlp"/>
</resources>
<resources>
<j2se version="1.6+" java-vm-args="-verbose:class
href="http://java.sun.com/products/autodl/j2se"/>
<property name="javafx.verbose" value="true"/>
<property name="java.library.path" value="WEB-INF/lib/bin"/>
<jar href="MyJavaFxApp.jar" size="318607" download="eager" />
</resources>
<applet-desc width="800" height="600"
main-class="com.javafx.main.NoJavaFXFallback"
name="MyJavaFxApp" >
<param name="requiredFXVersion" value="2.2+"/>
</applet-desc>
<jfx:javafx-desc width="800" height="600"
main-class="ui.client.MyJavaFXMain" name="MyJavaFxApp" />
<update check="background"/>
</jnlp>

magento 1.7 add attributegroup

I need to add an attributegroup called Videos in the database using an install script.
these are my files:
app/code/local/Company/ProductVideo/etc/config.xml
<resources>
<attributegroup_setup>
<setup>
<module>Company_ProductVideo</module>
<class>Company_ProductVideo_Model_Entity_Setup</class>
</setup>
</attributegroup_setup>
</resources>
</global>
app/code/local/Company/ProductVideo/Model/Entity/Setup.php
<?php
class Company_ProductVideo_Model_Entity_Setup extends Mage_Eav_Model_Entity_Setup{
}
?>
app/code/local/Company/sql/attributegroup_setup/msql4-install-1.7.0.php
<?php
$installer = $this;
$installer->startSetup();
$installer->addAttributeGroup('catalog_product', 'Default','Videos', 40);
$installer->endSetup();
?>
My module is also registered in app/code/etc/modules/Company_ProductVideo.xml
<config>
<modules>
<Company_ProductVideo>
<active>true</active>
<codePool>local</codePool>
</Company_ProductVideo>
</modules>
</config>
But this is not working, any help is welcome!!
I have already solved it, the problem was the name of the folder under the sql folder.
the convention is to name it like this: mysql4-install-'version'.