ltsecurityinc安防产品在线商城代码

This commit is contained in:
2026-09-14 17:47:10 +08:00
parent 57d8444c15
commit 6a3c9c5bd8
14539 changed files with 1775310 additions and 0 deletions
@@ -0,0 +1,114 @@
<?xml version="1.0"?>
<!--
/**
* @author Amasty Team
* @copyright Copyright (c) Amasty (https://www.amasty.com)
* @package Hide Price (Call for Price) for Magento 2
*/-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="amasty.hideprice.adminhtml.request.grid.container">
<block class="Magento\Backend\Block\Widget\Grid" name="amasty.hideprice.adminhtml.request.grid" as="grid">
<arguments>
<argument name="id" xsi:type="string">amasty_hideprice_rule_grid</argument>
<argument name="dataSource" xsi:type="object">Amasty\HidePrice\Model\ResourceModel\Request\Collection</argument>
<argument name="default_sort" xsi:type="string">created_at</argument>
<argument name="default_dir" xsi:type="string">DESC</argument>
<argument name="save_parameters_in_session" xsi:type="string">1</argument>
</arguments>
<block class="Magento\Backend\Block\Widget\Grid\Massaction"
name="amasty.hideprice.adminhtml.request.grid.massaction" as="grid.massaction">
<arguments>
<argument name="massaction_id_field" xsi:type="string">request_id</argument>
<argument name="form_field_name" xsi:type="string">request_ids</argument>
<argument name="use_select_all" xsi:type="string">1</argument>
<argument name="options" xsi:type="array">
<item name="change_mode_onthefly" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Delete</item>
<item name="url" xsi:type="string">*/*/massDelete</item>
<item name="confirm" xsi:type="string" translate="true">Are you sure?</item>
</item>
</argument>
</arguments>
</block>
<block class="Magento\Backend\Block\Widget\Grid\ColumnSet" as="grid.columnSet"
name="amasty.hideprice.block.adminhtml.requestcolumnSet">
<arguments>
<argument name="rowUrl" xsi:type="array">
<item name="path" xsi:type="string">amasty_hideprice/*/edit</item>
<item name="extraParamsTemplate" xsi:type="array">
<item name="id" xsi:type="string">getId</item>
</item>
</argument>
</arguments>
<block class="Magento\Backend\Block\Widget\Grid\Column" as="id">
<arguments>
<argument name="header" xsi:type="string" translate="true">Request ID</argument>
<argument name="index" xsi:type="string">request_id</argument>
<argument name="type" xsi:type="string">text</argument>
<argument name="column_css_class" xsi:type="string">col-id</argument>
<argument name="header_css_class" xsi:type="string">col-id</argument>
</arguments>
</block>
<block class="Magento\Backend\Block\Widget\Grid\Column" as="name">
<arguments>
<argument name="header" xsi:type="string" translate="true">Name</argument>
<argument name="index" xsi:type="string">name</argument>
</arguments>
</block>
<block class="Magento\Backend\Block\Widget\Grid\Column" as="email">
<arguments>
<argument name="header" xsi:type="string" translate="true">Email</argument>
<argument name="index" xsi:type="string">email</argument>
</arguments>
</block>
<block class="Magento\Backend\Block\Widget\Grid\Column" as="phone">
<arguments>
<argument name="header" xsi:type="string" translate="true">Phone</argument>
<argument name="index" xsi:type="string">phone</argument>
</arguments>
</block>
<block class="Magento\Backend\Block\Widget\Grid\Column" as="product_id">
<arguments>
<argument name="header" xsi:type="string" translate="true">Product Id</argument>
<argument name="index" xsi:type="string">product_id</argument>
</arguments>
</block>
<block class="Magento\Backend\Block\Widget\Grid\Column" as="comment">
<arguments>
<argument name="header" xsi:type="string" translate="true">Comment</argument>
<argument name="index" xsi:type="string">comment</argument>
</arguments>
</block>
<block class="Magento\Backend\Block\Widget\Grid\Column\Multistore" as="store_id">
<arguments>
<argument name="header" xsi:type="string" translate="true">Store</argument>
<argument name="index" xsi:type="string">store_id</argument>
<argument name="sortable" xsi:type="string">0</argument>
<argument name="type" xsi:type="string">store</argument>
</arguments>
</block>
<block class="Magento\Backend\Block\Widget\Grid\Column" as="created_at">
<arguments>
<argument name="header" xsi:type="string" translate="true">Created</argument>
<argument name="index" xsi:type="string">created_at</argument>
<argument name="gmtoffset" xsi:type="string">1</argument>
<argument name="type" xsi:type="string">datetime</argument>
<argument name="column_css_class" xsi:type="string">col-date</argument>
<argument name="header_css_class" xsi:type="string">col-date</argument>
</arguments>
</block>
<block class="Magento\Backend\Block\Widget\Grid\Column" as="status">
<arguments>
<argument name="header" xsi:type="string" translate="true">Status</argument>
<argument name="index" xsi:type="string">status</argument>
<argument name="type" xsi:type="string">options</argument>
<argument name="options" xsi:type="options" model="Amasty\HidePrice\Model\Source\Status"/>
</arguments>
</block>
</block>
</block>
</referenceBlock>
</body>
</page>
@@ -0,0 +1,15 @@
<?xml version="1.0"?>
<!--
/**
* @author Amasty Team
* @copyright Copyright (c) Amasty (https://www.amasty.com)
* @package Hide Price (Call for Price) for Magento 2
*/-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="Amasty\HidePrice\Block\Adminhtml\Request\Edit\Info" name="reqiest_view"
template="Amasty_HidePrice::info.phtml"/>
</referenceContainer>
</body>
</page>
@@ -0,0 +1,23 @@
<?xml version="1.0"?>
<!--
/**
* @author Amasty Team
* @copyright Copyright (c) Amasty (https://www.amasty.com)
* @package Hide Price (Call for Price) for Magento 2
*/-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="amasty_hideprice_request_block"/>
<head>
<css src="Amasty_HidePrice::css/quote_request.css"/>
</head>
<body>
<referenceContainer name="content">
<block class="Amasty\HidePrice\Block\Adminhtml\Request\Comment"
template="Amasty_HidePrice::quote_comment.phtml"
before="amasty.hideprice.adminhtml.request.grid.container"/>
<block class="Amasty\HidePrice\Block\Adminhtml\Request"
name="amasty.hideprice.adminhtml.request.grid.container"/>
</referenceContainer>
</body>
</page>
@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<!--
/**
* @author Amasty Team
* @copyright Copyright (c) Amasty (https://www.amasty.com)
* @package Hide Price (Call for Price) for Magento 2
*/-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="attributes_tabs">
<block class="Amasty\HidePrice\Block\Adminhtml\Catalog\Product\Edit\Action\Attribute\Tab\HidePrice"
name="amasty_hide_price"/>
<action method="addTab">
<argument name="name" xsi:type="string">amasty_hide_price</argument>
<argument name="block" xsi:type="string">amasty_hide_price</argument>
</action>
</referenceBlock>
</body>
</page>
@@ -0,0 +1,53 @@
<?php
/**
* @author Amasty Team
* @copyright Copyright (c) Amasty (https://www.amasty.com)
* @package Hide Price (Call for Price) for Magento 2
*/
/**
* @var \Amasty\HidePrice\Block\Adminhtml\Request\Edit\Info $block
* @var \Magento\Framework\Escaper $escaper
*/
?>
<section class="admin__page-section request-view-information">
<div class="admin__page-section-title">
<span class="title"><?= $escaper->escapeHtml(__('Get a Quote Information')) ?></span>
</div>
<div class="admin__page-section-content">
<table class="admin__table-secondary request-information-table">
<?php foreach ($block->getRequestData() as $data): ?>
<tr>
<th><?= $escaper->escapeHtml($data['label']) ?></th>
<td><?= $escaper->escapeHtml($data['value'], ['a']) ?></td>
</tr>
<?php endforeach;?>
</table>
</div>
</section>
<section class="admin__page-section request-view-answer-section">
<div id="request-view-answer" class="request-view-answer">
<form action="<?= $escaper->escapeUrl($block->getSubmitUrl()) ?>" method="post">
<input name="form_key" type="hidden" value="<?= $escaper->escapeHtml($block->getFormKey()) ?>" />
<div class="request-answer-block">
<div class="admin__field field-row">
<label class="admin__field-label"
for="email_text"><?= $escaper->escapeHtml(__('Email Text')) ?></label>
<div class="admin__field-control">
<textarea name="email_text"
class="admin__control-textarea"
rows="3"
cols="5"
id="email_text"
required></textarea>
</div>
</div>
<div class="admin__field">
<div class="review-actions">
<?= $block->getChildHtml('submit_button') ?>
</div>
</div>
</div>
</form>
</div>
</section>
@@ -0,0 +1,15 @@
<?php
/**
* @author Amasty Team
* @copyright Copyright (c) Amasty (https://www.amasty.com)
* @package Hide Price (Call for Price) for Magento 2
*/
/** \Amasty\HidePrice\Block\Adminhtml\Request\Comment $block */
?>
<?php if ($block->isNeedShow()) : ?>
<div class="hide-quote-comment"><?= __(
'If you use Custom Form for Get a Quote Requests please click <a href="%1">here</a> to review the submitted data.',
$block->getLink()
) ?></div>
<?php endif; ?>
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* @author Amasty Team
* @copyright Copyright (c) Amasty (https://www.amasty.com)
* @package Hide Price (Call for Price) for Magento 2
*/-->
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<fieldset name="amasty_hide_price">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Hide Price</item>
<item name="sortOrder" xsi:type="number">100</item>
<item name="collapsible" xsi:type="boolean">true</item>
</item>
<item name="js_config" xsi:type="array">
<item name="provider" xsi:type="string">catalogstaging_category_update_form.catalogstaging_category_update_form_data_source</item>
<item name="deps" xsi:type="string">catalogstaging_category_update_form.catalogstaging_category_update_form_data_source</item>
</item>
</argument>
<container name="container_amasty_hide_price_mode">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="formElement" xsi:type="string">container</item>
<item name="component" xsi:type="string">Magento_Ui/js/form/components/group</item>
<item name="dataScope" xsi:type="string"/>
<item name="sortOrder" xsi:type="number">10</item>
</item>
</argument>
<field name="am_hide_price_mode_cat">
<argument name="data" xsi:type="array">
<item name="options" xsi:type="object">Amasty\HidePrice\Model\Source\PriceMode</item>
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Display Price Mode</item>
<item name="comment" xsi:type="string" translate="true">Leave -- Default Config -- to keep using the Stores > Configuration > Hide Price settings</item>
<item name="formElement" xsi:type="string">select</item>
<item name="scopeLabel" xsi:type="string">[STORE VIEW]</item>
<item name="dataScope" xsi:type="string">am_hide_price_mode_cat</item>
<item name="caption" xsi:type="string" translate="true">-- Default Config --</item>
</item>
</argument>
</field>
</container>
<container name="container_amasty_hide_price_customer_group">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="formElement" xsi:type="string">container</item>
<item name="component" xsi:type="string">Magento_Ui/js/form/components/group</item>
<item name="dataScope" xsi:type="string"/>
<item name="sortOrder" xsi:type="number">20</item>
</item>
</argument>
<field name="am_hide_price_customer_gr_cat">
<argument name="data" xsi:type="array">
<item name="options" xsi:type="object">Amasty\HidePrice\Model\Source\Group</item>
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Use Current Price Mode By Customer Group</item>
<item name="comment" xsi:type="string" translate="true">Enable Display Price Mode for the selected customer groups only</item>
<item name="formElement" xsi:type="string">multiselect</item>
<item name="dataScope" xsi:type="string">am_hide_price_customer_gr_cat</item>
<item name="sortOrder" xsi:type="number">30</item>
<item name="scopeLabel" xsi:type="string">[STORE VIEW]</item>
</item>
</argument>
</field>
</container>
</fieldset>
</form>
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* @author Amasty Team
* @copyright Copyright (c) Amasty (https://www.amasty.com)
* @package Hide Price (Call for Price) for Magento 2
*/-->
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<fieldset name="amasty_hide_price">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Hide Price</item>
<item name="sortOrder" xsi:type="number">100</item>
<item name="collapsible" xsi:type="boolean">true</item>
</item>
<item name="js_config" xsi:type="array">
<item name="provider" xsi:type="string">category_form.category_form_data_source</item>
<item name="deps" xsi:type="string">category_form.category_form_data_source</item>
</item>
</argument>
<container name="container_amasty_hide_price_mode">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="formElement" xsi:type="string">container</item>
<item name="component" xsi:type="string">Magento_Ui/js/form/components/group</item>
<item name="dataScope" xsi:type="string"/>
<item name="sortOrder" xsi:type="number">10</item>
</item>
</argument>
<field name="am_hide_price_mode_cat">
<argument name="data" xsi:type="array">
<item name="options" xsi:type="object">Amasty\HidePrice\Model\Source\PriceMode</item>
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Display Price Mode</item>
<item name="comment" xsi:type="string" translate="true">Leave -- Default Config -- to keep using the Stores > Configuration > Hide Price settings</item>
<item name="formElement" xsi:type="string">select</item>
<item name="scopeLabel" xsi:type="string">[STORE VIEW]</item>
<item name="dataScope" xsi:type="string">am_hide_price_mode_cat</item>
<item name="caption" xsi:type="string" translate="true">-- Default Config --</item>
</item>
</argument>
</field>
</container>
<container name="container_amasty_hide_price_customer_group">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="formElement" xsi:type="string">container</item>
<item name="component" xsi:type="string">Magento_Ui/js/form/components/group</item>
<item name="dataScope" xsi:type="string"/>
<item name="sortOrder" xsi:type="number">20</item>
</item>
</argument>
<field name="am_hide_price_customer_gr_cat">
<argument name="data" xsi:type="array">
<item name="options" xsi:type="object">Amasty\HidePrice\Model\Source\Group</item>
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Use Current Price Mode By Customer Group</item>
<item name="comment" xsi:type="string" translate="true">Enable Display Price Mode for the selected customer groups only</item>
<item name="formElement" xsi:type="string">multiselect</item>
<item name="dataScope" xsi:type="string">am_hide_price_customer_gr_cat</item>
<item name="sortOrder" xsi:type="number">30</item>
<item name="scopeLabel" xsi:type="string">[STORE VIEW]</item>
</item>
</argument>
</field>
</container>
</fieldset>
</form>
@@ -0,0 +1,69 @@
<?xml version="1.0"?>
<!--
/**
* @author Amasty Team
* @copyright Copyright (c) Amasty (https://www.amasty.com)
* @package Hide Price (Call for Price) for Magento 2
*/-->
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<fieldset name="amasty_hide_price">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataScope" xsi:type="string">data.product</item>
<item name="provider" xsi:type="string">product_form.product_form_data_source</item>
<item name="label" xsi:type="string" translate="true">Hide Price</item>
<item name="collapsible" xsi:type="boolean">true</item>
<item name="sortOrder" xsi:type="number">100</item>
</item>
</argument>
<container name="container_amasty_hide_price_mode">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="formElement" xsi:type="string">container</item>
<item name="component" xsi:type="string">Magento_Ui/js/form/components/group</item>
<item name="dataScope" xsi:type="string"/>
<item name="sortOrder" xsi:type="number">10</item>
</item>
</argument>
<field name="am_hide_price_mode">
<argument name="data" xsi:type="array">
<item name="options" xsi:type="object">Amasty\HidePrice\Model\Source\PriceMode</item>
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Display Price Mode</item>
<item name="comment" xsi:type="string" translate="true">Leave -- Default Config -- to keep using the Stores > Configuration > Hide Price settings</item>
<item name="formElement" xsi:type="string">select</item>
<item name="scopeLabel" xsi:type="string" translate="true">[STORE VIEW]</item>
<item name="dataScope" xsi:type="string">am_hide_price_mode</item>
<item name="caption" xsi:type="string" translate="true">-- Default Config --</item>
</item>
</argument>
</field>
</container>
<container name="container_amasty_hide_price_customer_group">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="formElement" xsi:type="string">container</item>
<item name="component" xsi:type="string">Magento_Ui/js/form/components/group</item>
<item name="dataScope" xsi:type="string"/>
<item name="sortOrder" xsi:type="number">20</item>
</item>
</argument>
<field name="am_hide_price_customer_gr">
<argument name="data" xsi:type="array">
<item name="options" xsi:type="object">Amasty\HidePrice\Model\Source\Group</item>
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Use Current Price Mode By Customer Group</item>
<item name="comment" xsi:type="string" translate="true">Enable Display Price Mode for the selected customer groups only</item>
<item name="formElement" xsi:type="string">multiselect</item>
<item name="dataScope" xsi:type="string">am_hide_price_customer_gr</item>
<item name="sortOrder" xsi:type="number">30</item>
<item name="scopeLabel" xsi:type="string">[STORE VIEW]</item>
</item>
</argument>
</field>
</container>
</fieldset>
</form>
@@ -0,0 +1,3 @@
.hide-quote-comment {
margin-bottom: 20px;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

@@ -0,0 +1,22 @@
<!--@subject Get a Quote Answer from {{var store_name}} @-->
<!--@vars {
"var customer_name":"Sender Name",
"var store.frontend_name":"Store Name",
"var message":"Message from Admin",
"var request":"Request Model"
} @-->
{{template config_path="design/email/header_template"}}
<table>
<tr class="email-intro">
<td valign="top">
<p><strong>{{trans "Hello %name," name=$request.name}}</strong></p>
<p>{{var message}}</p>
<p>{{trans "Sincerely, %store Team." store=$store.frontend_name}}</p>
</td>
</tr>
</table>
{{template config_path="design/email/footer_template"}}
@@ -0,0 +1,32 @@
<!--@subject Get a Quote Notification from {{var customer_name}} @-->
<!--@vars {
"var customer_name":"Sender Name",
"var request.comment":"Comment",
"var request.email":"Sender Email",
"var request.name":"Sender Name",
"var request.phone":"Sender Telephone",
"var request.product_name":"Product",
"var request.comment":"Comment"
} @-->
{{template config_path="design/email/header_template"}}
<table>
<tr class="email-intro">
<td valign="top">
<p><strong>{{trans "You have a new quote request placed by"}} {{var customer_name}},</strong></p>
<p>{{trans "Request details:"}}</p>
<p>{{trans "Name: %name" name=$request.name}}</p>
<p>{{trans "Email: %email" email=$request.email}}</p>
<p>{{trans "Phone Number: %phone" phone=$request.phone}}</p>
<p>{{trans "Product: %product" product=$request.product_name}}</p>
<p>{{trans "Comment: %comment" comment=$request.comment}}</p>
<p>{{trans "Best Regards, %store Team." store=$store.frontend_name}}</p>
</td>
</tr>
</table>
{{template config_path="design/email/footer_template"}}
@@ -0,0 +1,28 @@
<!--@subject Get a Quote from {{var store_name}} @-->
<!--@vars {
"var website_name":"Website Name",
"var store.frontend_name":"Store Name",
"var customer_name":"Customer Name",
"var request":"Request Model"
} @-->
{{template config_path="design/email/header_template"}}
<table>
<tr class="email-intro">
<td valign="top">
<p><strong>{{trans "Hello %name," name=$request.name}}</strong></p>
<p>{{trans "Thank you for contacting us!"}}</p>
<p>{{trans "Your quote request is being processed at the moment."}}</p>
<p>{{trans "We’ll get back to you as soon as possible"}}</p>
<p>{{trans "Best Regards, %store Team." store=$store.frontend_name}}</p>
</td>
</tr>
</table>
{{template config_path="design/email/footer_template"}}
@@ -0,0 +1,14 @@
<?xml version="1.0"?>
<!--
/**
* @author Amasty Team
* @copyright Copyright (c) Amasty (https://www.amasty.com)
* @package Hide Price (Call for Price) for Magento 2
*/-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<css src="Amasty_HidePrice::css/amhideprice-styles.css"/>
</head>
</page>
+20
View File
@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<!--
/**
* @author Amasty Team
* @copyright Copyright (c) Amasty (https://www.amasty.com)
* @package Hide Price (Call for Price) for Magento 2
*/-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<css src="Amasty_HidePrice::js/fancyambox/jquery.fancyambox.min.css"/>
<css src="Amasty_HidePrice::css/amhideprice.css"/>
</head>
<body>
<referenceContainer name="content">
<block after="-" name="Amasty_HidePrice_Form" class="Amasty\HidePrice\Block\Form"/>
</referenceContainer>
</body>
</page>
@@ -0,0 +1,20 @@
var config = {
map: {
'*': {
'amasty-fancyambox' : 'Amasty_HidePrice/js/fancyambox/jquery.fancyambox.min'
}
},
config: {
mixins: {
'mage/validation': {
'Amasty_HidePrice/js/validation-mixin': true
},
'Magento_Swatches/js/swatch-renderer': {
'Amasty_HidePrice/js/swatch-renderer-mixin': true
},
'Amasty_Conf/js/swatch-renderer': {
'Amasty_HidePrice/js/swatch-renderer-mixin': true
}
}
}
};
@@ -0,0 +1,87 @@
<?php
/**
* @author Amasty Team
* @copyright Copyright (c) Amasty (https://www.amasty.com)
* @package Hide Price (Call for Price) for Magento 2
*/ /** @var \Amasty\HidePrice\Block\Form $block */ ?>
<form class="amhideprice-form" id="amhideprice-form" method="post" style="display: none;" data-nofocus="true">
<span class="amhideprice-close" data-amhide-js="close-popup"></span>
<input name="form_key" type="hidden" value="<?php echo $block->escapeHtml($block->getFormKey()) ?>" />
<input name="product_id" type="hidden" value="" />
<fieldset class="fieldset">
<legend class="legend amhideprice-form-ledend">
<span><?= __('Get a Quote for') ?></span>
<span style="font-weight: bolder;" class="product-name"></span>
</legend>
<br>
<div class="field required">
<label for="amhideprice-name" class="label">
<span><?= __('Customer Name') ?></span>
</label>
<div class="control">
<input type="text" name="name" class="input-text"
id="amhideprice-name" data-validate="{required:true}">
</div>
</div>
<div class="field required">
<label for="amhideprice-email" class="label">
<span><?= __('Customer Email') ?></span>
</label>
<div class="control">
<input type="email"
name="email"
id="amhideprice-email"
autocomplete="email"
value="" class="input-text"
data-validate="{required:true, 'validate-email':true}"
aria-required="true">
</div>
</div>
<div class="field required">
<label for="amhideprice-phone" class="label">
<span><?= __('Phone Number') ?></span>
</label>
<div class="control">
<input type="text" name="phone" class="input-text "
id="amhideprice-phone" data-validate="{required:true}">
</div>
</div>
<div class="field">
<label for="amhideprice-comment" class="label">
<span><?= __('Comment') ?></span>
</label>
<div class="control">
<textarea title="<?= __('Comment') ?>"
name="comment" class="input-text"
id="amhideprice-comment"
data-validate="{'validate-no-html-tags':true}"></textarea>
</div>
</div>
<?php if ($block->isGDPREnabled()) : ?>
<div class="field required">
<label class="label" for="amhideprice-gdpr">
<input type="checkbox"
name="gdpr"
id="amhideprice-gdpr"
title="<?= __('GDPR'); ?>"
data-validate="{required:true}"
value="1">
<?= $block->getGDPRText(); ?>
</label>
</div>
<?php endif; ?>
</fieldset>
<div class="actions-toolbar">
<div class="primary">
<button type="submit" class="action submit primary"
title="<?= __('Submit') ?>">
<span><?= __('Submit') ?></span>
</button>
</div>
</div>
</form>
@@ -0,0 +1,3 @@
.amasty-hide-price-button {
margin-bottom: 40px;
}
@@ -0,0 +1,48 @@
@media all and (min-width: 768px), print {
.amhideprice-form {
max-width: 700px;
width: 40%;
}
}
@media all and (max-width: 767px), print {
.amhideprice-form {
width: 80%;
}
}
.amhideprice-form {
position: relative;
padding: 30px;
vertical-align: middle;
background: #fafafa;
}
div.message.am-hide-message {
display: inline-block;
padding: 13px 70px;
}
.fancyambox-stage .amhideprice-form .legend span {
font-size: 1.8rem;
}
.amhideprice-close {
position: absolute;
top: 10px;
right: 10px;
width: 15px;
height: 15px;
background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTMiIGhlaWdodD0iMTMiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEgMWwxMSAxMW0wLTExTDEgMTIiIHN0cm9rZT0iI0IyQjJCMiIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIvPjwvc3ZnPg==) no-repeat center;
background-size: contain;
cursor: pointer;
}
.amhideprice-close:hover {
background: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMyIgaGVpZ2h0PSIxMyIgZmlsbD0ibm9uZSI+PHJlY3Qgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIvPjxnIGNsYXNzPSJjdXJyZW50TGF5ZXIiPjxwYXRoIGQ9Ik0xIDFsMTEgMTFtMC0xMUwxIDEyIiBzdHJva2U9IiMxZGExZjIiIHN0cm9rZS13aWR0aD0iMS41IiBzdHJva2UtbGluZWNhcD0icm91bmQiIGNsYXNzPSJzZWxlY3RlZCIvPjwvZz48L3N2Zz4=) no-repeat center;
background-size: contain;
}
a.amasty-hide-price-container {
cursor: pointer;
}
@@ -0,0 +1,43 @@
define([
'jquery',
'Magento_Ui/js/modal/modal'
], function ($) {
$.widget('mage.amhideprice', {
options: {},
_create: function () {
if (this.element) {
var parent = this.element.parents(this.options['parent']).first();
if (!parent) {
return;
}
var button = parent.find(this.options['button']),
addButton = parent.find('.actions-primary form button');
if (button && button[0]
&& (this.options['hide_addtocart'] === '1' || this.options['hide_addtocart'] === '2')
) {
button[0].outerHTML = this.options['html'];
eval($('<div>').html(this.options['html']).find('script').html());
}
if (addButton.length > 0 && this.options['hide_addtocart'] === '1') {
addButton.remove();
}
if (this.options['hide_addtocart'] === '1') {
$('[data-role="all-tocart"]').remove();
}
if (this.options['hide_compare'] === '1') {
parent.find('a.tocompare').remove();
}
if (this.options['hide_wishlist'] === '1') {
parent.find('a.towishlist').remove();
}
}
}
});
return $.mage.amhideprice;
});
@@ -0,0 +1,187 @@
define([
'jquery',
'uiClass',
'amasty-fancyambox'
], function ($, Class, fancyambox) {
var amHidePriceForm = Class.extend({
products: {},
customer: null,
selectors: {
amHidePricePopup: '[data-amhide="AmastyHidePricePopup"][data-product-id="%s"]:not(.observed)',
onClickPopup: 'observed',
amHideClosePopup: '[data-amhide-js="close-popup"]',
formClass: '.amform-form.amhideprice-form',
formId: '#amhideprice-form',
fancyBoxContainer: '.fancyambox-container .amhideprice-form',
hideProductIdName: '[name="hide_product_id"]',
hideProductId: 'hide_product_id',
productName: '.product-name',
productIdAttr: 'data-product-id',
successMessage: 'success am-hide-message',
errorMessage: 'error am-hide-message',
},
initialize: function (options) {
},
addProduct: function (product) {
this.products[product['id']] = product['name'];
this.customer = product['customer'];
this.url = product['url'];
this._createButtonObserver(product['id']);
},
_createButtonObserver: function (id) {
var self = this,
popupSelector = self._getPopupSelectorById(id);
$(popupSelector).click(function (e) {
e.stopPropagation();
self._showPopup(this);
}).addClass(
self.selectors.onClickPopup
);
$(document).on('click', self.selectors.amHideClosePopup, function () {
$.fancyambox.close();
});
},
_getPopupSelectorById: function (id) {
return this.selectors.amHidePricePopup.replace(/%s/, id);
},
_showPopup: function (element) {
var id = $(element).attr(this.selectors.productIdAttr),
form = $(this.selectors.formClass);
if (!form.length) {
form = this._getFilledForm(id);
} else {
if (form.find(this.selectors.hideProductIdName).length === 0) {
form.append(
$('<input>', {
'name': this.selectors.hideProductId,
'type': 'hidden',
'value': id
})
);
}
}
if (!form) {
console.warn('We can`t find the form for displaying. Please check your module configuration.');
}
$.fancyambox.open(form, {
touch: false
});
},
_getFilledForm: function (id) {
var form = $(this.selectors.formId),
product = this.products[id];
if (!form.length) {
return false;
}
var productName = form.find(this.selectors.productName);
if (productName && product) {
productName.html(product);
}
var productId = form.find('[name="product_id"]');
if (productId) {
productId.val(id);
}
var name = form.find('[name="name"]');
if (name && this.customer.name) {
name.val(this.customer.name);
}
var phone = form.find('[name="phone"]');
if (phone && this.customer.phone) {
phone.val(this.customer.phone);
}
var email = form.find('[name="email"]');
if (email && this.customer.email) {
email.val(this.customer.email);
}
var self = this;
form.on('submit', function (e) {
e.preventDefault();
e.stopImmediatePropagation();
e.stopPropagation();
var validator = $(this).validation({ radioCheckboxClosest: '.nested'});
if (validator.valid()) {
self.submitForm($(this));
}
return false;
});
return form;
},
submitForm: function (form) {
form = $(form);
var self = this;
var data = form.serialize();
this._clearForm(form);
$.ajax({
url: self.url,
data: data,
type: 'post',
dataType: 'json',
beforeSend: function () {
$(self.selectors.fancyBoxContainer).remove();
$.fancyambox.getInstance().showLoading();
},
success: function (response) {
$.fancyambox.getInstance().hideLoading();
var result = $('<div>',
{class: 'message'}
);
var html = $('<div>');
if (response.success) {
html.html(response.success).appendTo(result);
result.addClass(self.selectors.successMessage);
}
if (response.error) {
html.html(response.error).appendTo(result);
result.addClass(self.selectors.errorMessage);
}
$.fancyambox.close();
$.fancyambox.open(result);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
$.fancyambox.getInstance().hideLoading();
$.fancyambox.close();
$.fancyambox.open(errorThrown);
}
});
},
_clearForm: function (form) {
var key = form.find('[name="form_key"]'),
value = key.val();
$(form)[0].reset();
key.val(value);
}
});
window.amHidePriceForm = amHidePriceForm();
return window.amHidePriceForm;
});
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,73 @@
/**
* Amasty swatch render mixin. Hiding simple product price that is part of configurable product
*/
define([
'jquery',
'underscore',
], function ($, _) {
'use strict';
return function (widget) {
$.widget('mage.SwatchRenderer', widget, {
options: {
selectors: {
buttons: '.box-tocart, .tocart',
dataOptionSelected: 'data-option-selected',
optionSelected: 'option-selected',
dataAttributeId: 'data-attribute-id',
attributeId: 'attribute-id'
}
},
_UpdatePrice: function () {
var $widget = this,
$selectors = $widget.options.selectors,
$product = $widget.element.parents($widget.options.selectorProduct),
$productPrice = $product.find($widget.options.selectorProductPrice),
$productButton = $product.find($selectors.buttons),
attributeClass = $widget.options.classes.attributeClass,
selectedDataOptionSelector = '.' + attributeClass + '[' + $selectors.dataOptionSelected + ']',
selectedOptionSelector = '.' + attributeClass + '[' + $selectors.optionSelected + ']',
options = _.object(_.keys($widget.optionsMap), {}),
selectedValues = [],
result,
isNotAllSelected;
$widget.element
.find(selectedDataOptionSelector + ', ' + selectedOptionSelector)
.each(function () {
var attributeId = $(this).attr($selectors.dataAttributeId)
|| $(this).attr($selectors.attributeId);
options[attributeId] = $(this).attr($selectors.dataOptionSelected)
|| $(this).attr($selectors.optionSelected);
});
for (const property in options) {
selectedValues.push(options[property]);
}
isNotAllSelected = selectedValues.some(function (element) {
return typeof element === 'undefined';
});
result = $widget._getNewPrices();
if (!isNotAllSelected) {
this._super();
}
if (result && result.finalPrice && result.finalPrice.amount === 0 && !isNotAllSelected) {
$productPrice.hide();
$productButton.hide();
} else {
$productPrice.show();
$productButton.show();
}
}
});
return $.mage.SwatchRenderer;
}
});
@@ -0,0 +1,48 @@
define([
'jquery'
], function ($) {
'use strict';
return function (widget) {
$.widget('mage.validation', widget, {
listenFormValidateHandler: function (event, validation) {
var firstActive = $(validation.errorList[0].element || []),
lastActive = $(validation.findLastActive() || validation.errorList.length && validation.errorList[0].element || []),
parent, windowHeight, successList,
noFocus = validation.currentForm.dataset.nofocus ? validation.currentForm.dataset.nofocus : false;
if (lastActive.is(':hidden')) {
parent = lastActive.parent();
windowHeight = $(window).height();
$('html, body').animate({
scrollTop: parent.offset().top - windowHeight / 2
});
}
// ARIA (removing aria attributes if success)
successList = validation.successList;
if (successList.length) {
$.each(successList, function () {
$(this)
.removeAttr('aria-describedby')
.removeAttr('aria-invalid');
});
}
// Override -- Added focus status for form to include disabling focus functionality //
if (firstActive.length && !noFocus) {
$('html, body').stop().animate({
scrollTop: firstActive.offset().top
});
firstActive.focus();
} else {
$(window).unbind('scroll');
}
// Override //
}
});
return $.mage.validation;
}
});