ltsecurityinc安防产品在线商城代码
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*
|
||||
*/
|
||||
namespace Magento\Widget\Model\Config;
|
||||
|
||||
/**
|
||||
* @magentoAppArea adminhtml
|
||||
*/
|
||||
class DataTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @magentoCache config disabled
|
||||
*/
|
||||
public function testGet()
|
||||
{
|
||||
$fileResolver = $this->getMockForAbstractClass(\Magento\Framework\Config\FileResolverInterface::class);
|
||||
$fileResolver->expects($this->exactly(3))->method('get')->willReturnMap([
|
||||
['widget.xml', 'global', [file_get_contents(__DIR__ . '/_files/orders_and_returns.xml')]],
|
||||
['widget.xml', 'adminhtml', []],
|
||||
['widget.xml', 'design', [file_get_contents(__DIR__ . '/_files/orders_and_returns_customized.xml')]],
|
||||
]);
|
||||
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
|
||||
$reader = $objectManager->create(\Magento\Widget\Model\Config\Reader::class, ['fileResolver' => $fileResolver]);
|
||||
/** @var \Magento\Widget\Model\Config\Data $configData */
|
||||
$configData = $objectManager->create(\Magento\Widget\Model\Config\Data::class, ['reader' => $reader]);
|
||||
$result = $configData->get();
|
||||
$expected = include '_files/expectedGlobalDesignArray.php';
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
namespace Magento\Widget\Model\Config;
|
||||
|
||||
use Magento\TestFramework\Helper\Bootstrap;
|
||||
|
||||
class ReaderTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @var \Magento\Widget\Model\Config\Reader
|
||||
*/
|
||||
private $model;
|
||||
|
||||
/**
|
||||
* @var \PHPUnit\Framework\MockObject\MockObject
|
||||
*/
|
||||
private $fileResolver;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->fileResolver = $this->getMockForAbstractClass(\Magento\Framework\Config\FileResolverInterface::class);
|
||||
$objectManager = Bootstrap::getObjectManager();
|
||||
$this->model = $objectManager->create(
|
||||
\Magento\Widget\Model\Config\Reader::class,
|
||||
['fileResolver' => $this->fileResolver]
|
||||
);
|
||||
}
|
||||
|
||||
public function testRead()
|
||||
{
|
||||
$this->fileResolver->expects($this->once())
|
||||
->method('get')
|
||||
->willReturn([file_get_contents(__DIR__ . '/_files/orders_and_returns.xml')]);
|
||||
$expected = include __DIR__ . '/_files/expectedGlobalArray.php';
|
||||
$this->assertEquals($expected, $this->model->read('global'));
|
||||
}
|
||||
|
||||
public function testReadFile()
|
||||
{
|
||||
$file = file_get_contents(__DIR__ . '/_files/orders_and_returns.xml');
|
||||
$expected = include __DIR__ . '/_files/expectedGlobalArray.php';
|
||||
$this->assertEquals($expected, $this->model->readFile($file));
|
||||
}
|
||||
|
||||
public function testMergeCompleteAndPartial()
|
||||
{
|
||||
$fileList = [
|
||||
file_get_contents(__DIR__ . '/_files/catalog_new_products_list.xml'),
|
||||
file_get_contents(__DIR__ . '/_files/orders_and_returns_customized.xml'),
|
||||
];
|
||||
$this->fileResolver->expects($this->once())
|
||||
->method('get')
|
||||
->with('widget.xml', 'global')
|
||||
->willReturn($fileList);
|
||||
$expected = include __DIR__ . '/_files/expectedMergedArray.php';
|
||||
$this->assertEquals($expected, $this->model->read('global'));
|
||||
}
|
||||
}
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<widgets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Widget:etc/widget.xsd">
|
||||
<widget id="new_products" class="Magento\Catalog\Block\Product\Widget\NewWidget" is_email_compatible="true"
|
||||
placeholder_image="Magento_Catalog::images/product_widget_new.png">
|
||||
<label translate="true">Catalog New Products List</label>
|
||||
<description translate="true">List of Products that are set as New</description>
|
||||
<parameters>
|
||||
<parameter name="display_type" xsi:type="select" required="true" visible="true">
|
||||
<label translate="true">Display Type</label>
|
||||
<description translate="true">All products - recently added products, New products - products marked as new</description>
|
||||
<options>
|
||||
<option name="default" value="all_products" selected="true">
|
||||
<label translate="true">All products</label>
|
||||
</option>
|
||||
<option name="item" value="new_products">
|
||||
<label translate="true">New products</label>
|
||||
</option>
|
||||
</options>
|
||||
</parameter>
|
||||
<parameter name="show_pager" xsi:type="select" visible="true"
|
||||
source_model="Magento\Config\Model\Config\Source\Yesno">
|
||||
<label translate="true">Display Page Control</label>
|
||||
</parameter>
|
||||
<parameter name="products_per_page" xsi:type="text" required="true" visible="true">
|
||||
<label translate="true">Number of Products per Page</label>
|
||||
<depends>
|
||||
<parameter name="show_pager" value="1" />
|
||||
</depends>
|
||||
<value>5</value>
|
||||
</parameter>
|
||||
<parameter name="products_count" xsi:type="text" required="true" visible="true">
|
||||
<label translate="true">Number of Products to Display</label>
|
||||
<value>10</value>
|
||||
</parameter>
|
||||
<parameter name="template" xsi:type="select" required="true" visible="true">
|
||||
<label translate="true">Template</label>
|
||||
<options>
|
||||
<option name="default" value="product/widget/new/content/new_grid.phtml" selected="true">
|
||||
<label translate="true">New Products Grid Template</label>
|
||||
</option>
|
||||
<option name="list" value="product/widget/new/content/new_list.phtml">
|
||||
<label translate="true">New Products List Template</label>
|
||||
</option>
|
||||
<option name="list_default"
|
||||
value="product/widget/new/column/new_default_list.phtml">
|
||||
<label translate="true">New Products Images and Names Template</label>
|
||||
</option>
|
||||
<option name="list_names"
|
||||
value="product/widget/new/column/new_names_list.phtml">
|
||||
<label translate="true">New Products Names Only Template</label>
|
||||
</option>
|
||||
<option name="list_images"
|
||||
value="product/widget/new/column/new_images_list.phtml">
|
||||
<label translate="true">New Products Images Only Template</label>
|
||||
</option>
|
||||
</options>
|
||||
</parameter>
|
||||
<parameter name="cache_lifetime" xsi:type="text" visible="true">
|
||||
<label translate="true">Cache Lifetime (Seconds)</label>
|
||||
<description translate="true">86400 by default, if not set. To refresh instantly, clear the Blocks HTML
|
||||
Output cache.
|
||||
</description>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<containers>
|
||||
<container name="left">
|
||||
<template name="default" value="list_default" />
|
||||
<template name="names_only" value="list_names" />
|
||||
<template name="images_only" value="list_images" />
|
||||
</container>
|
||||
<container name="content">
|
||||
<template name="grid" value="default" />
|
||||
<template name="list" value="list" />
|
||||
</container>
|
||||
<container name="right">
|
||||
<template name="default" value="list_default" />
|
||||
<template name="names_only" value="list_names" />
|
||||
<template name="images_only" value="list_images" />
|
||||
</container>
|
||||
</containers>
|
||||
</widget>
|
||||
</widgets>
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
return [
|
||||
'sales_widget_guestform' => [
|
||||
'@' => ['type' => \Magento\Sales\Block\Widget\Guest\Form::class],
|
||||
'is_email_compatible' => '1',
|
||||
'name' => 'Orders and Returns',
|
||||
'description' => 'Orders and Returns Search Form',
|
||||
'parameters' => [
|
||||
'title' => ['type' => 'text', 'visible' => '0', 'label' => 'Anchor Custom Title'],
|
||||
'template' => [
|
||||
'type' => 'select',
|
||||
'value' => 'hierarchy/widget/link/link_block.phtml',
|
||||
'values' => [
|
||||
'default' => [
|
||||
'value' => 'hierarchy/widget/link/link_block.phtml',
|
||||
'label' => 'CMS Page Link Block Template',
|
||||
],
|
||||
'link_inline' => [
|
||||
'value' => 'hierarchy/widget/link/link_inline.phtml',
|
||||
'label' => 'CMS Page Link Inline Template',
|
||||
],
|
||||
],
|
||||
'visible' => '0',
|
||||
],
|
||||
'link_display' => [
|
||||
'source_model' => \Magento\Config\Model\Config\Source\Yesno::class,
|
||||
'type' => 'select',
|
||||
'visible' => '1',
|
||||
'sort_order' => '10',
|
||||
'label' => 'Display a Link to Loading a Spreadsheet',
|
||||
'description' => "Defines whether a link to My Account",
|
||||
],
|
||||
'link_text' => [
|
||||
'type' => 'text',
|
||||
'value' => 'Load a list of SKUs',
|
||||
'visible' => '1',
|
||||
'required' => '1',
|
||||
'sort_order' => '20',
|
||||
'label' => 'Link Text',
|
||||
'description' => 'The text of the link to the My Account > Order by SKU page',
|
||||
'depends' => ['link_display' => ['value' => '1']],
|
||||
],
|
||||
'id_path' => [
|
||||
'type' => 'label',
|
||||
'@' => ['type' => 'complex'],
|
||||
'helper_block' => [
|
||||
'type' => \Magento\Catalog\Block\Adminhtml\Product\Widget\Chooser::class,
|
||||
'data' => ['button' => ['open' => 'Select Product...']],
|
||||
],
|
||||
'visible' => '1',
|
||||
'required' => '1',
|
||||
'sort_order' => '10',
|
||||
'label' => 'Product',
|
||||
],
|
||||
],
|
||||
'supported_containers' => [
|
||||
'0' => ['container_name' => 'left', 'template' => ['default' => 'default_template']],
|
||||
'1' => ['container_name' => 'right', 'template' => ['default' => 'default_template']],
|
||||
],
|
||||
]
|
||||
];
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
return [
|
||||
'sales_widget_guestform' => [
|
||||
'@' => ['type' => \Magento\Sales\Block\Widget\Guest\Form::class],
|
||||
'is_email_compatible' => '1',
|
||||
'name' => 'Orders and Returns',
|
||||
'description' => 'Orders and Returns Search Form',
|
||||
'parameters' => [
|
||||
'title' => ['type' => 'text', 'visible' => '0', 'label' => 'Anchor Custom Title'],
|
||||
'template' => [
|
||||
'type' => 'select',
|
||||
'value' => 'hierarchy/widget/link/link_block.phtml',
|
||||
'values' => [
|
||||
'default' => [
|
||||
'value' => 'hierarchy/widget/link/link_block.phtml',
|
||||
'label' => 'CMS Page Link Block Template',
|
||||
],
|
||||
'link_inline' => [
|
||||
'value' => 'hierarchy/widget/link/link_inline.phtml',
|
||||
'label' => 'CMS Page Link Inline Template',
|
||||
],
|
||||
],
|
||||
'visible' => '0',
|
||||
],
|
||||
'link_display' => [
|
||||
'source_model' => \Magento\Config\Model\Config\Source\Yesno::class,
|
||||
'type' => 'select',
|
||||
'visible' => '1',
|
||||
'sort_order' => '10',
|
||||
'label' => 'Display a Link to Loading a Spreadsheet',
|
||||
'description' => "Defines whether a link to My Account",
|
||||
],
|
||||
'link_text' => [
|
||||
'type' => 'text',
|
||||
'value' => 'Load a list of SKUs',
|
||||
'visible' => '1',
|
||||
'required' => '1',
|
||||
'sort_order' => '20',
|
||||
'label' => 'Link Text',
|
||||
'description' => 'The text of the link to the My Account > Order by SKU page',
|
||||
'depends' => ['link_display' => ['value' => '1']],
|
||||
],
|
||||
'id_path' => [
|
||||
'type' => 'label',
|
||||
'@' => ['type' => 'complex'],
|
||||
'helper_block' => [
|
||||
'type' => \Magento\Catalog\Block\Adminhtml\Product\Widget\Chooser::class,
|
||||
'data' => ['button' => ['open' => 'Select Product...']],
|
||||
],
|
||||
'visible' => '1',
|
||||
'required' => '1',
|
||||
'sort_order' => '10',
|
||||
'label' => 'Product',
|
||||
],
|
||||
],
|
||||
'supported_containers' => [
|
||||
'0' => ['container_name' => 'left', 'template' => ['default' => 'default_template']],
|
||||
'1' => ['container_name' => 'right', 'template' => ['default' => 'default_template']],
|
||||
],
|
||||
],
|
||||
'new_products' => [
|
||||
'@' => ['type' => \Magento\Sales\Block\Widget\Guest\Form::class],
|
||||
'is_email_compatible' => '1',
|
||||
'name' => 'Orders and Returns',
|
||||
'description' => 'Orders and Returns Search Form',
|
||||
'parameters' => [
|
||||
'title' => ['type' => 'text', 'visible' => '0', 'label' => 'Anchor Custom Title'],
|
||||
'template' => [
|
||||
'type' => 'select',
|
||||
'values' => [
|
||||
'default_template' => ['value' => 'widget/guest/form.phtml', 'label' => 'Default Template'],
|
||||
],
|
||||
'visible' => '0',
|
||||
],
|
||||
],
|
||||
'supported_containers' => [
|
||||
['container_name' => 'left', 'template' => ['default' => 'default_template']],
|
||||
['container_name' => 'right', 'template' => ['default' => 'default_template']],
|
||||
],
|
||||
]
|
||||
];
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
return [
|
||||
'new_products' => [
|
||||
'@' => ['type' => \Magento\Sales\Block\Widget\Guest\Form::class],
|
||||
'is_email_compatible' => '1',
|
||||
'placeholder_image' => 'Magento_Catalog::images/product_widget_new.png',
|
||||
'name' => 'Orders and Returns',
|
||||
'description' => 'Orders and Returns Search Form',
|
||||
'parameters' => [
|
||||
'display_type' => [
|
||||
'type' => 'select',
|
||||
'value' => 'all_products',
|
||||
'values' => [
|
||||
'default' => ['value' => 'all_products', 'label' => 'All products'],
|
||||
'item' => ['value' => 'new_products', 'label' => 'New products'],
|
||||
],
|
||||
'visible' => '1',
|
||||
'required' => '1',
|
||||
'label' => 'Display Type',
|
||||
'description' => 'All products - recently added products, New products - products marked as new',
|
||||
],
|
||||
'show_pager' => [
|
||||
'source_model' => "Magento\Config\Model\Config\Source\Yesno",
|
||||
'type' => 'select',
|
||||
'visible' => '1',
|
||||
'label' => 'Display Page Control',
|
||||
],
|
||||
'products_per_page' => [
|
||||
'type' => 'text',
|
||||
'value' => '5',
|
||||
'visible' => '1',
|
||||
'required' => '1',
|
||||
'label' => 'Number of Products per Page',
|
||||
'depends' => ['show_pager' => ['value' => '1']],
|
||||
],
|
||||
'products_count' => [
|
||||
'type' => 'text',
|
||||
'value' => '10',
|
||||
'visible' => '1',
|
||||
'required' => '1',
|
||||
'label' => 'Number of Products to Display',
|
||||
],
|
||||
'template' => [
|
||||
'type' => 'select',
|
||||
'value' => 'product/widget/new/content/new_grid.phtml',
|
||||
'values' => [
|
||||
'default' => [
|
||||
'value' => 'product/widget/new/content/new_grid.phtml',
|
||||
'label' => 'New Products Grid Template',
|
||||
],
|
||||
'list' => [
|
||||
'value' => 'product/widget/new/content/new_list.phtml',
|
||||
'label' => 'New Products List Template',
|
||||
],
|
||||
'list_default' => [
|
||||
'value' => 'product/widget/new/column/new_default_list.phtml',
|
||||
'label' => 'New Products Images and Names Template',
|
||||
],
|
||||
'list_names' => [
|
||||
'value' => 'product/widget/new/column/new_names_list.phtml',
|
||||
'label' => 'New Products Names Only Template',
|
||||
],
|
||||
'list_images' => [
|
||||
'value' => 'product/widget/new/column/new_images_list.phtml',
|
||||
'label' => 'New Products Images Only Template',
|
||||
],
|
||||
'default_template' => ['value' => 'widget/guest/form.phtml', 'label' => 'Default Template'],
|
||||
],
|
||||
'visible' => '0',
|
||||
'required' => '1',
|
||||
'label' => 'Template',
|
||||
],
|
||||
'cache_lifetime' => [
|
||||
'type' => 'text',
|
||||
'visible' => '1',
|
||||
'label' => 'Cache Lifetime (Seconds)',
|
||||
'description' => "86400 by default, if not set. To refresh instantly, clear the Blocks HTML
|
||||
Output cache.
|
||||
",
|
||||
],
|
||||
'title' => ['type' => 'text', 'visible' => '0', 'label' => 'Anchor Custom Title'],
|
||||
],
|
||||
'supported_containers' => [
|
||||
[
|
||||
'container_name' => 'left',
|
||||
'template' => [
|
||||
'default' => 'default_template',
|
||||
'names_only' => 'list_names',
|
||||
'images_only' => 'list_images',
|
||||
],
|
||||
],
|
||||
['container_name' => 'content', 'template' => ['grid' => 'default', 'list' => 'list']],
|
||||
[
|
||||
'container_name' => 'right',
|
||||
'template' => [
|
||||
'default' => 'default_template',
|
||||
'names_only' => 'list_names',
|
||||
'images_only' => 'list_images',
|
||||
]
|
||||
],
|
||||
],
|
||||
]
|
||||
];
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<widgets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Widget:etc/widget.xsd">
|
||||
<widget id="sales_widget_guestform" class="Magento\Sales\Block\Widget\Guest\Form" is_email_compatible="true" >
|
||||
<label translate="true">Orders and Returns</label>
|
||||
<description translate="true">Orders and Returns Search Form</description>
|
||||
<parameters>
|
||||
<parameter name="title" xsi:type="text" visible="false">
|
||||
<label translate="true">Anchor Custom Title</label>
|
||||
</parameter>
|
||||
<parameter name="template" xsi:type="select" visible="false">
|
||||
<options>
|
||||
<option name="default" value="hierarchy/widget/link/link_block.phtml" selected="true">
|
||||
<label translate="true">CMS Page Link Block Template</label>
|
||||
</option>
|
||||
<option name="link_inline" value="hierarchy/widget/link/link_inline.phtml">
|
||||
<label translate="true">CMS Page Link Inline Template</label>
|
||||
</option>
|
||||
</options>
|
||||
</parameter>
|
||||
<parameter name="link_display" xsi:type="select" visible="true" sort_order="10"
|
||||
source_model="Magento\Config\Model\Config\Source\Yesno">
|
||||
<label translate="true">Display a Link to Loading a Spreadsheet</label>
|
||||
<description translate="true">Defines whether a link to My Account</description>
|
||||
</parameter>
|
||||
<parameter name="link_text" xsi:type="text" required="true" visible="true" sort_order="20">
|
||||
<label translate="true">Link Text</label>
|
||||
<description translate="true">The text of the link to the My Account &gt; Order by SKU page</description>
|
||||
<depends>
|
||||
<parameter name="link_display" value="1" />
|
||||
</depends>
|
||||
<value translate="true">Load a list of SKUs</value>
|
||||
</parameter>
|
||||
<parameter name="id_path" xsi:type="block" visible="true" required="true" sort_order="10">
|
||||
<label translate="true">Product</label>
|
||||
<block class="Magento\Catalog\Block\Adminhtml\Product\Widget\Chooser">
|
||||
<data>
|
||||
<item name="button" xsi:type="array">
|
||||
<item name="open" xsi:type="string">Select Product...</item>
|
||||
</item>
|
||||
</data>
|
||||
</block>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<containers>
|
||||
<container name="left">
|
||||
<template name="default" value="default_template" />
|
||||
</container>
|
||||
<container name="right">
|
||||
<template name="default" value="default_template" />
|
||||
</container>
|
||||
</containers>
|
||||
</widget>
|
||||
</widgets>
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<widgets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Widget:etc/widget.xsd">
|
||||
<widget id="new_products" class="Magento\Sales\Block\Widget\Guest\Form" is_email_compatible="true" >
|
||||
<label translate="true">Orders and Returns</label>
|
||||
<description translate="true">Orders and Returns Search Form</description>
|
||||
<parameters>
|
||||
<parameter name="title" xsi:type="text" visible="false">
|
||||
<label translate="true">Anchor Custom Title</label>
|
||||
</parameter>
|
||||
<parameter name="template" xsi:type="select" visible="false">
|
||||
<options>
|
||||
<option name="default_template" value="widget/guest/form.phtml">
|
||||
<label translate="true">Default Template</label>
|
||||
</option>
|
||||
</options>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<containers>
|
||||
<container name="left">
|
||||
<template name="default" value="default_template" />
|
||||
</container>
|
||||
<container name="right">
|
||||
<template name="default" value="default_template" />
|
||||
</container>
|
||||
</containers>
|
||||
</widget>
|
||||
</widgets>
|
||||
Reference in New Issue
Block a user