Я встроил свое приложение Shopify из Shopify Partners, но приложение по-прежнему открывается в собственном окне браузера - PullRequest
0 голосов
/ 03 августа 2020

Я создал приложение Shopify, это канал продаж ... теперь я хочу встроить приложение, но приложение всегда отображается в новом окне браузера.

Вот что я сделал: Из учетной записи Shopify Partners я перешел к расширению приложения и сделал его встроенным:

enter image description here

Now when user installs the app, I redirect the users to the oAuth page... if user accepts the app is installed.


Next time user logs in to the app, I return the following code (C#, ASP.NET MVC):

public ActionResult Handshake(string shop)
{
    return View("Test"); // test view
}

I have tried returning both of the following content in the Test view:

  1. a complete HTML page:
<!DOCTYPE html>
  Тест   Настройки   Содержание страницы      
Просто div, который содержит мое приложение:
<div class="Polaris-Page">
    <div class="Polaris-Page__Header">
        <h1 class="Polaris-DisplayText Polaris-DisplayText--sizeLarge">Settings</h1>
    </div>
    <div class="Polaris-Page__Content">
        <p>Page Content</p>
    </div>
</div>

Но HTML, который я возвращаю, никогда не встраивается в страницу администратора Shopify ... Он всегда отображается в новой вкладке браузера.

введите описание изображения здесь

Как я могу встроить это приложение?

1 Ответ

0 голосов
/ 04 августа 2020

Мне пришлось изменить свой ответ следующим образом, а затем приложение было встроено:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width" />
    <title>Test</title>
    <link rel="stylesheet" href="https://sdks.shopifycdn.com/polaris/3.21.1/polaris.min.css" />
    <script src="https://cdn.shopify.com/s/assets/external/app.js"></script>
    <script type="text/javascript">
        ShopifyApp.init({
            forceRedirect: true,
            apiKey: 'my-api-key',
            shopOrigin: 'https://store-name.myshopify.com'
        });
        ShopifyApp.Bar.loadingOff();
    </script>
</head>
<body>
    <div class="Polaris-Page">
        <div class="Polaris-Page__Header">
            <h1 class="Polaris-DisplayText Polaris-DisplayText--sizeLarge">Settings</h1>
        </div>
        <div class="Polaris-Page__Content">
            <p>Page Content</p>
        </div>
    </div>
</body>
</html>

Эта ссылка также является хорошим ресурсом.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...