init
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" ?>
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<head>
|
||||
<title>
|
||||
Product Price Import
|
||||
</title>
|
||||
</head>
|
||||
<body>
|
||||
<referenceContainer name="content">
|
||||
<uiComponent name="price_import_form"/>
|
||||
<block class="Magento\Backend\Block\Template" name="import" template="Stemcell_Catalog::price/import.phtml" />
|
||||
</referenceContainer>
|
||||
</body>
|
||||
</page>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" ?>
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<head>
|
||||
<title>
|
||||
Product Price Import
|
||||
</title>
|
||||
</head>
|
||||
<body>
|
||||
<referenceContainer name="content">
|
||||
<uiComponent name="price_import_index"/>
|
||||
</referenceContainer>
|
||||
</body>
|
||||
</page>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" ?>
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<head>
|
||||
<title>
|
||||
Product Stock Import
|
||||
</title>
|
||||
</head>
|
||||
<body>
|
||||
<referenceContainer name="content">
|
||||
<uiComponent name="stock_import_form"/>
|
||||
<block class="Magento\Backend\Block\Template" name="import" template="Stemcell_Catalog::stock/import.phtml" />
|
||||
</referenceContainer>
|
||||
</body>
|
||||
</page>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" ?>
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<head>
|
||||
<title>
|
||||
Product Stock Import
|
||||
</title>
|
||||
</head>
|
||||
<body>
|
||||
<referenceContainer name="content">
|
||||
<uiComponent name="stock_import_index"/>
|
||||
</referenceContainer>
|
||||
</body>
|
||||
</page>
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/* @var $block \Magento\Backend\Block\Template */
|
||||
|
||||
use Stemcell\ProductImport\Model\Import\TypeId;
|
||||
|
||||
?>
|
||||
<div class="admin__fieldset-wrapper-content" >
|
||||
<form action="<?= $block->getUrl('stemcell_catalog/price/importPost', ['type_id'=> TypeId::PRICE->value]) ?>" method="post" enctype="multipart/form-data" >
|
||||
<input name="form_key" type="hidden" value="<?= $block->getFormKey() ?>" >
|
||||
<div class="admin__field" style="display: flex; gap: 20px;align-items: center; justify-content: center;margin-bottom: 30px">
|
||||
<label class="admin__field-label" for="stock_import">
|
||||
<span >上传产品价格文件</span>
|
||||
</label>
|
||||
|
||||
<div class="file-uploader">
|
||||
<input id="stock_import" required name="stock[import]" type="file" accept=".xlsx,.xls" />
|
||||
</div>
|
||||
</div>
|
||||
<div style="display: flex; gap: 20px;align-items: center; justify-content: center;">
|
||||
<button class="action- scalable save primary ui-button ui-corner-all ui-widget" >
|
||||
导入
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<style>
|
||||
.form-button {
|
||||
background-color: #eb5202;
|
||||
border-color: #eb5202;
|
||||
color: #ffffff;
|
||||
text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.25);
|
||||
border: 1px solid;
|
||||
border-radius: 0;
|
||||
display: inline-block;
|
||||
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
font-size: 1.4rem;
|
||||
font-weight: 600;
|
||||
line-height: 1.36;
|
||||
padding: 0.6rem 1em 0.6rem;
|
||||
text-align: center;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
.admin__field-label:after {
|
||||
color: #e22626;
|
||||
content: '*';
|
||||
display: inline-block;
|
||||
font-size: 1.6rem;
|
||||
font-weight: 500;
|
||||
line-height: 1;
|
||||
margin-left: 10px;
|
||||
margin-top: .2rem;
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/* @var $block \Magento\Backend\Block\Template */
|
||||
|
||||
use Stemcell\ProductImport\Model\Import\TypeId;
|
||||
|
||||
?>
|
||||
<div class="admin__fieldset-wrapper-content" >
|
||||
<form action="<?= $block->getUrl('stemcell_catalog/stock/importPost', ['type_id'=> TypeId::STOCK->value]); ?>" method="post" enctype="multipart/form-data" >
|
||||
<input name="form_key" type="hidden" value="<?= $block->getFormKey() ?>" >
|
||||
<div class="admin__field" style="display: flex; gap: 20px;align-items: center; justify-content: center;margin-bottom: 30px">
|
||||
<label class="admin__field-label" for="stock_import">
|
||||
<span >上传产品库存文件</span>
|
||||
</label>
|
||||
|
||||
<div class="file-uploader">
|
||||
<input id="stock_import" required name="stock[import]" type="file" accept=".xlsx,.xls" />
|
||||
</div>
|
||||
</div>
|
||||
<div style="display: flex; gap: 20px;align-items: center; justify-content: center;">
|
||||
<button class="action- scalable save primary ui-button ui-corner-all ui-widget" >
|
||||
导入
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<style>
|
||||
.form-button {
|
||||
background-color: #eb5202;
|
||||
border-color: #eb5202;
|
||||
color: #ffffff;
|
||||
text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.25);
|
||||
border: 1px solid;
|
||||
border-radius: 0;
|
||||
display: inline-block;
|
||||
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
font-size: 1.4rem;
|
||||
font-weight: 600;
|
||||
line-height: 1.36;
|
||||
padding: 0.6rem 1em 0.6rem;
|
||||
text-align: center;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
.admin__field-label:after {
|
||||
color: #e22626;
|
||||
content: '*';
|
||||
display: inline-block;
|
||||
font-size: 1.6rem;
|
||||
font-weight: 500;
|
||||
line-height: 1;
|
||||
margin-left: 10px;
|
||||
margin-top: .2rem;
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="js_config" xsi:type="array">
|
||||
<item name="provider" xsi:type="string">price_import_form.salesperson_form_data_source</item>
|
||||
<item name="deps" xsi:type="string">price_import_form.salesperson_form_data_source</item>
|
||||
</item>
|
||||
<item name="label" xsi:type="string" translate="true">Customer Information</item>
|
||||
<item name="layout" xsi:type="array">
|
||||
<item name="type" xsi:type="string">tabs</item>
|
||||
</item>
|
||||
|
||||
<item name="buttons" xsi:type="array">
|
||||
<item name="back" xsi:type="string">Stemcell\Catalog\Block\Adminhtml\Price\Import\BackButton</item>
|
||||
<item name="sample" xsi:type="string">Stemcell\Catalog\Block\Adminhtml\Price\Import\SampleButton</item>
|
||||
</item>
|
||||
</argument>
|
||||
<dataSource name="salesperson_form_data_source">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="js_config" xsi:type="array">
|
||||
<item name="component" xsi:type="string">Magento_Ui/js/form/provider</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<submitUrl path="stemcell_catalog/price/importPost"/>
|
||||
</settings>
|
||||
<aclResource>Stemcell_Catalog::salesperson_index</aclResource>
|
||||
<dataProvider class="Stemcell\Customer\Ui\Component\DataProvider\Salesperson" name="salesperson_form_data_source">
|
||||
<settings>
|
||||
<requestFieldName>id</requestFieldName>
|
||||
<primaryFieldName>import_id</primaryFieldName>
|
||||
</settings>
|
||||
</dataProvider>
|
||||
</dataSource>
|
||||
<fieldset name="stock">
|
||||
<settings>
|
||||
<label translate="true">Price</label>
|
||||
</settings>
|
||||
|
||||
</fieldset>
|
||||
</form>
|
||||
@@ -0,0 +1,98 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="js_config" xsi:type="array">
|
||||
<item name="provider" xsi:type="string">price_import_index.stemcell_import_stock_task_source</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<spinner>stock_import_columns</spinner>
|
||||
<deps>
|
||||
<dep>price_import_index.stemcell_import_stock_task_source</dep>
|
||||
</deps>
|
||||
<buttons>
|
||||
<button name="import">
|
||||
<url path="*/*/import"/>
|
||||
<class>primary</class>
|
||||
<label translate="true">Import</label>
|
||||
</button>
|
||||
</buttons>
|
||||
</settings>
|
||||
|
||||
<dataSource name="stemcell_import_stock_task_source">
|
||||
<argument name="dataProvider" xsi:type="configurableObject">
|
||||
<argument name="class" xsi:type="string">Stemcell\Catalog\Ui\DataProvider\Import\Price\DataProvider</argument>
|
||||
<argument name="name" xsi:type="string">stemcell_import_stock_task_source</argument>
|
||||
<argument name="primaryFieldName" xsi:type="string">task_id</argument>
|
||||
<argument name="requestFieldName" xsi:type="string">id</argument>
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="component" xsi:type="string">Magento_Ui/js/grid/provider</item>
|
||||
<item name="update_url" path="mui/index/render" xsi:type="url"/>
|
||||
<item name="storageConfig" xsi:type="array">
|
||||
<item name="indexField" xsi:type="string">task_id</item>
|
||||
</item>
|
||||
</item>
|
||||
</argument>
|
||||
</argument>
|
||||
</dataSource>
|
||||
|
||||
<listingToolbar name="listing_top">
|
||||
<settings>
|
||||
<sticky>true</sticky>
|
||||
</settings>
|
||||
<bookmark name="bookmarks"/>
|
||||
<columnsControls name="columns_controls"/>
|
||||
<filters name="listing_filters" />
|
||||
<filterSearch name="fulltext"/>
|
||||
<paging name="listing_paging"/>
|
||||
</listingToolbar>
|
||||
<columns name="stock_import_columns">
|
||||
<selectionsColumn name="ids" component="Magento_Sales/js/grid/columns/multiselect">
|
||||
<settings>
|
||||
<indexField>task_id</indexField>
|
||||
</settings>
|
||||
</selectionsColumn>
|
||||
<column name="file_path">
|
||||
<settings>
|
||||
<filter>text</filter>
|
||||
<label translate="true">File</label>
|
||||
</settings>
|
||||
</column>
|
||||
|
||||
<column name="status" component="Magento_Ui/js/grid/columns/select">
|
||||
<settings>
|
||||
<filter>select</filter>
|
||||
<dataType>select</dataType>
|
||||
<options class="Stemcell\Catalog\Model\Source\TaskStatus"/>
|
||||
<label translate="true">状态</label>
|
||||
</settings>
|
||||
</column>
|
||||
|
||||
<column name="message">
|
||||
<settings>
|
||||
<label>Message</label>
|
||||
</settings>
|
||||
</column>
|
||||
<column name="created_at" class="Magento\Ui\Component\Listing\Columns\Date" component="Magento_Ui/js/grid/columns/date">
|
||||
<settings>
|
||||
<dataType>date</dataType>
|
||||
<label translate="true">任务创建时间</label>
|
||||
<sorting>desc</sorting>
|
||||
</settings>
|
||||
</column>
|
||||
<column name="updated_at" class="Magento\Ui\Component\Listing\Columns\Date" component="Magento_Ui/js/grid/columns/date">
|
||||
<settings>
|
||||
<dataType>date</dataType>
|
||||
<label translate="true">任务完成时间</label>
|
||||
</settings>
|
||||
</column>
|
||||
|
||||
</columns>
|
||||
</listing>
|
||||
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="js_config" xsi:type="array">
|
||||
<item name="provider" xsi:type="string">stock_import_form.salesperson_form_data_source</item>
|
||||
<item name="deps" xsi:type="string">stock_import_form.salesperson_form_data_source</item>
|
||||
</item>
|
||||
<item name="label" xsi:type="string" translate="true">Customer Information</item>
|
||||
<item name="layout" xsi:type="array">
|
||||
<item name="type" xsi:type="string">tabs</item>
|
||||
</item>
|
||||
|
||||
<item name="buttons" xsi:type="array">
|
||||
<item name="back" xsi:type="string">Stemcell\Catalog\Block\Adminhtml\Stock\BackButton</item>
|
||||
<item name="sample" xsi:type="string">Stemcell\Catalog\Block\Adminhtml\Stock\SampleButton</item>
|
||||
</item>
|
||||
</argument>
|
||||
<dataSource name="salesperson_form_data_source">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="js_config" xsi:type="array">
|
||||
<item name="component" xsi:type="string">Magento_Ui/js/form/provider</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<submitUrl path="stemcell_catalog/stock/importPost"/>
|
||||
</settings>
|
||||
<aclResource>Stemcell_Catalog::salesperson_index</aclResource>
|
||||
<dataProvider class="Stemcell\Customer\Ui\Component\DataProvider\Salesperson" name="salesperson_form_data_source">
|
||||
<settings>
|
||||
<requestFieldName>id</requestFieldName>
|
||||
<primaryFieldName>salesperson_id</primaryFieldName>
|
||||
</settings>
|
||||
</dataProvider>
|
||||
</dataSource>
|
||||
<fieldset name="stock">
|
||||
<settings>
|
||||
<label translate="true">Stock</label>
|
||||
</settings>
|
||||
|
||||
</fieldset>
|
||||
</form>
|
||||
@@ -0,0 +1,103 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="js_config" xsi:type="array">
|
||||
<item name="provider" xsi:type="string">stock_import_index.stemcell_import_stock_task_source</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<spinner>stock_import_columns</spinner>
|
||||
<deps>
|
||||
<dep>stock_import_index.stemcell_import_stock_task_source</dep>
|
||||
</deps>
|
||||
<buttons>
|
||||
<button name="stemcell_subitem_index">
|
||||
<url path="stemcell_subitem/index/index"/>
|
||||
<class>primary</class>
|
||||
<label translate="true">小货号库存列表</label>
|
||||
</button>
|
||||
<button name="import">
|
||||
<url path="*/*/import"/>
|
||||
<class>primary</class>
|
||||
<label translate="true">Import</label>
|
||||
</button>
|
||||
</buttons>
|
||||
</settings>
|
||||
|
||||
<dataSource name="stemcell_import_stock_task_source">
|
||||
<argument name="dataProvider" xsi:type="configurableObject">
|
||||
<argument name="class" xsi:type="string">Stemcell\Catalog\Ui\DataProvider\ImportStock\DataProvider</argument>
|
||||
<argument name="name" xsi:type="string">stemcell_import_stock_task_source</argument>
|
||||
<argument name="primaryFieldName" xsi:type="string">task_id</argument>
|
||||
<argument name="requestFieldName" xsi:type="string">id</argument>
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="component" xsi:type="string">Magento_Ui/js/grid/provider</item>
|
||||
<item name="update_url" path="mui/index/render" xsi:type="url"/>
|
||||
<item name="storageConfig" xsi:type="array">
|
||||
<item name="indexField" xsi:type="string">task_id</item>
|
||||
</item>
|
||||
</item>
|
||||
</argument>
|
||||
</argument>
|
||||
</dataSource>
|
||||
|
||||
<listingToolbar name="listing_top">
|
||||
<settings>
|
||||
<sticky>true</sticky>
|
||||
</settings>
|
||||
<bookmark name="bookmarks"/>
|
||||
<columnsControls name="columns_controls"/>
|
||||
<filters name="listing_filters" />
|
||||
<filterSearch name="fulltext"/>
|
||||
<paging name="listing_paging"/>
|
||||
</listingToolbar>
|
||||
<columns name="stock_import_columns">
|
||||
<selectionsColumn name="ids" component="Magento_Sales/js/grid/columns/multiselect">
|
||||
<settings>
|
||||
<indexField>task_id</indexField>
|
||||
</settings>
|
||||
</selectionsColumn>
|
||||
<column name="file_path">
|
||||
<settings>
|
||||
<filter>text</filter>
|
||||
<label translate="true">File</label>
|
||||
</settings>
|
||||
</column>
|
||||
|
||||
<column name="status" component="Magento_Ui/js/grid/columns/select">
|
||||
<settings>
|
||||
<filter>select</filter>
|
||||
<dataType>select</dataType>
|
||||
<options class="Stemcell\Catalog\Model\Source\TaskStatus"/>
|
||||
<label translate="true">状态</label>
|
||||
</settings>
|
||||
</column>
|
||||
|
||||
<column name="message">
|
||||
<settings>
|
||||
<label>Message</label>
|
||||
</settings>
|
||||
</column>
|
||||
<column name="created_at" class="Magento\Ui\Component\Listing\Columns\Date" component="Magento_Ui/js/grid/columns/date">
|
||||
<settings>
|
||||
<dataType>date</dataType>
|
||||
<label translate="true">任务创建时间</label>
|
||||
<sorting>desc</sorting>
|
||||
</settings>
|
||||
</column>
|
||||
<column name="updated_at" class="Magento\Ui\Component\Listing\Columns\Date" component="Magento_Ui/js/grid/columns/date">
|
||||
<settings>
|
||||
<dataType>date</dataType>
|
||||
<label translate="true">任务完成时间</label>
|
||||
</settings>
|
||||
</column>
|
||||
|
||||
</columns>
|
||||
</listing>
|
||||
@@ -0,0 +1,106 @@
|
||||
define([
|
||||
'jquery',
|
||||
'Magento_Ui/js/form/element/file-uploader',
|
||||
], function ($, FileUploader) {
|
||||
'use strict';
|
||||
|
||||
return FileUploader.extend({
|
||||
defaults: {
|
||||
uploadLoaderText: 'Uploading...',
|
||||
uploadLoaderIcon: true
|
||||
},
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*/
|
||||
initialize: function () {
|
||||
this._super();
|
||||
this.initUploaderWithLoader();
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* 初始化带加载器的上传器
|
||||
*/
|
||||
initUploaderWithLoader: function () {
|
||||
var self = this;
|
||||
|
||||
// 重写上传方法
|
||||
this.upload = function (file) {
|
||||
self.showGlobalLoader();
|
||||
return self._super(file);
|
||||
};
|
||||
|
||||
// 监听 AJAX 事件
|
||||
$(document).ajaxStart(function () {
|
||||
// 如果当前是此上传器的请求,显示加载器
|
||||
if (self.isUploading) {
|
||||
self.showLoader();
|
||||
}
|
||||
});
|
||||
|
||||
$(document).ajaxStop(function () {
|
||||
self.hideLoader();
|
||||
self.isUploading = false;
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 显示全局加载器
|
||||
*/
|
||||
showGlobalLoader: function () {
|
||||
this.isUploading = true;
|
||||
$('body').loader({
|
||||
icon: this.uploadLoaderIcon,
|
||||
texts: {
|
||||
loaderText: this.uploadLoaderText
|
||||
}
|
||||
}).loader('show');
|
||||
},
|
||||
|
||||
/**
|
||||
* 显示局部加载器
|
||||
*/
|
||||
showLoader: function () {
|
||||
var $uploadArea = $('#' + this.uid + '-area');
|
||||
|
||||
if ($uploadArea.length) {
|
||||
$uploadArea.loader({
|
||||
icon: true,
|
||||
texts: {
|
||||
loaderText: this.uploadLoaderText
|
||||
}
|
||||
}).loader('show');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 隐藏加载器
|
||||
*/
|
||||
hideLoader: function () {
|
||||
$('body').loader('hide');
|
||||
|
||||
// 同时隐藏局部加载器
|
||||
var $uploadArea = $('#' + this.uid + '-area');
|
||||
if ($uploadArea.length) {
|
||||
$uploadArea.loader('hide');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 上传完成回调
|
||||
*/
|
||||
onUploadComplete: function (file, response) {
|
||||
this.hideLoader();
|
||||
return this._super(file, response);
|
||||
},
|
||||
|
||||
/**
|
||||
* 上传错误回调
|
||||
*/
|
||||
onUploadError: function (file, response) {
|
||||
this.hideLoader();
|
||||
return this._super(file, response);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
|
||||
<body>
|
||||
|
||||
<referenceBlock name="product.details.custom">
|
||||
<block class="Stemcell\Catalog\Block\Product\View\TechnicalResource" name="product_view_technical_resource" template="Stemcell_Catalog::product/view/technical_resource.phtml"/>
|
||||
<block class="Stemcell\Catalog\Block\Product\View\Publication" name="product_view_publication" template="Stemcell_Catalog::product/view/publication.phtml"/>
|
||||
</referenceBlock>
|
||||
</body>
|
||||
</page>
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
/* @var $block \Stemcell\Catalog\Block\Product\View\Publication */
|
||||
$publicationProducts = $block->getProducts();
|
||||
$currentProduct = $block->getProduct();
|
||||
$publicationProductsCount = $block->getProductsCount();
|
||||
$_helper = $this->helper(Magento\Catalog\Helper\Output::class);
|
||||
?>
|
||||
|
||||
<?php if ($publicationProductsCount): ?>
|
||||
<div class="publications-section">
|
||||
<h2 class="mobile-popup-trigger">文献 <span class="publication-count"> (<?= $publicationProductsCount ?>) </span> </h2>
|
||||
<div class="publications mobile-popup">
|
||||
<?php foreach ($publicationProducts as $publicationProduct): ?>
|
||||
<?php /* @var \Magento\Catalog\Model\Product $publicationProduct */ ?>
|
||||
<div class="row">
|
||||
<div class="publication">
|
||||
<div class="heading">
|
||||
<div class="reference-info show-abstract">
|
||||
<span class="reference-name">
|
||||
<?= $publicationProduct->getName() ?>
|
||||
</span>
|
||||
<span class="reference-author"> <?= $publicationProduct->getData('author_info') ?> </span>
|
||||
<span class="reference-data">
|
||||
<?= $publicationProduct->getData('reference_journal').' '.
|
||||
$publicationProduct->getData('reference_year').' '.
|
||||
$publicationProduct->getData('reference_month')
|
||||
?>
|
||||
</span>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<div class="show-abstract"> <i class="fa fa-plus"></i> </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="abstract">
|
||||
<h4>Abstract</h4>
|
||||
<div class="abstract-content">
|
||||
<?= $publicationProduct->getData('reference_abstract') ?>
|
||||
<div class="view-publication-div">
|
||||
<a href="<?= $publicationProduct->getData('reference_url') ?>" class="view-publication" target="_blank"> <span>View publication</span> </a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<div class="publication-list-all">
|
||||
<a class="list-all" href="<?= $block->escapeUrl($block->getPublicationListUrl()) ?>">
|
||||
View All Publications
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?php echo $_helper->productAttribute($currentProduct, $currentProduct->getData('faq'), 'faq'); ?>
|
||||
<?php endif; ?>
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
/* @var $block \Stemcell\Catalog\Block\Product\View\TechnicalResource */
|
||||
$technicalResourceProducts = $block->getProducts();
|
||||
$currentProduct = $block->getCurrentProduct();
|
||||
?>
|
||||
<?php if ($technicalResourceProducts->count()): ?>
|
||||
<h2 class="mobile-popup-trigger"> 技术资料 <span>(<?= $technicalResourceProducts->count() ?>)</span> </h2>
|
||||
<div class="swiper-container product-pdf-slider">
|
||||
<div class="materials mobile-popup swiper-wrapper">
|
||||
<?php foreach ($technicalResourceProducts as $technicalResourceProduct): ?>
|
||||
<?php /* @var \Magento\Catalog\Model\Product $technicalResourceProduct */ ?>
|
||||
<?php
|
||||
$image175 = $block->getProductImageUrl($technicalResourceProduct, 175, 100);
|
||||
$image227 = $block->getProductImageUrl($technicalResourceProduct, 227, 130);
|
||||
$image204 = $block->getProductImageUrl($technicalResourceProduct, 204, 115);
|
||||
$image303 = $block->getProductImageUrl($technicalResourceProduct, 303, 170);
|
||||
?>
|
||||
<div class="tile swiper-slide">
|
||||
<div class="material sync-height">
|
||||
<div class="material-image">
|
||||
<a href="<?= $block->escapeUrl($block->getTechnicalResourceProductUrl($technicalResourceProduct)) ?>" target="_blank">
|
||||
<div class="material-image-container">
|
||||
<picture>
|
||||
<source srcset="<?= $block->escapeUrl($image175) ?>" media="(min-width: 768px) and (max-width: 1007px)">
|
||||
<source srcset="<?= $block->escapeUrl($image227) ?>" media="(min-width: 481px) and (max-width: 767px)">
|
||||
<source srcset="<?= $block->escapeUrl($image204) ?>" media="(max-width: 480px)">
|
||||
<source srcset="<?= $block->escapeUrl($image303) ?>">
|
||||
<img loading="lazy" src="<?= $block->escapeUrl($image303) ?>" width="303" height="170" alt="<?= $block->escapeHtmlAttr($technicalResourceProduct->getName()) ?>">
|
||||
</picture>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="type-name"><?= $block->escapeHtml($technicalResourceProduct->getAttributeText('resource_type')) ?></div>
|
||||
<div class="material-name" title="<?= $technicalResourceProduct->getName() ?>">
|
||||
<a href="<?= $block->escapeUrl($block->getTechnicalResourceProductUrl($technicalResourceProduct)) ?>" target="_blank">
|
||||
<?= $technicalResourceProduct->getName() ?>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<div class="swiper-pagination"></div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?php echo $currentProduct->getData('technical_resource'); ?>
|
||||
<?php endif; ?>
|
||||
Reference in New Issue
Block a user