Commit b2c06cb4 by liumengfei

Merge branch 'developer' into production

parents a28ae9b2 1fc76e1e
<?php
/**
* Web Technology Codes
* Web Technology Codes Google Language Translator Extension
*
* @category WebTechnologyCodes
* @package WebTechnlogyCodes_GoogleLanguageTranslater
* @copyright Copyright © 2018 Web Technology Codes (https://www.webtechnologycodes.com)
* @license https://www.webtechnologycodes.com/magento-extension-license/
*/
namespace Joshine\FreeBar\Block;
use Magento\Framework\View\Element\Template;
class Index extends Template
{
/**
* Initialize
*
* @param \Magento\Framework\View\Element\Template\Context $context
* @param array $data
*/
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
array $data = []
) {
parent::__construct($context, $data);
}
/**
* Get System configuration option values
*/
public function getConfigValue($value = '') {
return $this->_scopeConfig
->getValue(
$value,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
}
/**
* Return image url
*
* @return string
*/
public function getImageValue($mobile = '')
{
if ($mobile){
$drive_type ="freebar/general/image_mobile";
}else{
$drive_type ="freebar/general/image_pc";
}
$image_url = $this->_scopeConfig->getValue($drive_type,\Magento\Store\Model\ScopeInterface::SCOPE_STORE);
return $this->getMediaUrl(). 'joshine/freebar/'.$image_url;
}
/**
* Return media path
*
* @return string
*/
public function getMediaUrl()
{
return $this->_storeManager->getStore()
->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA);
}
}
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
<acl>
<resources>
<resource id="Magento_Backend::admin">
<resource id="Magento_Backend::stores">
<resource id="Magento_Backend::stores_settings">
<resource id="Magento_Config::config">
<resource id="Joshine_FreeBar::config_system" title="Free Bar" sortOrder="1" />
</resource>
</resource>
</resource>
</resource>
</resources>
</acl>
</config>
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<section id="freebar" translate="label" type="text" sortOrder="320" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Freebar</label>
<tab>joshine</tab>
<resource>Joshine_FreeBar::config_system</resource>
<group id="general" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label><![CDATA[Top free bars]]></label>
<field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label><![CDATA[是否打开]]></label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="is_pic" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label><![CDATA[是否图片]]></label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="content" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label><![CDATA[文案内容]]></label>
<depends>
<field id="is_pic">0</field>
</depends>
</field>
<field id="content_size" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label><![CDATA[字体大小]]></label>
<comment><![CDATA[默认为14px]]></comment>
<depends>
<field id="is_pic">0</field>
</depends>
</field>
<field id="content_color" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label><![CDATA[文字颜色]]></label>
<comment><![CDATA[默认为#000]]></comment>
<depends>
<field id="is_pic">0</field>
</depends>
</field>
<field id="content_back_color" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label><![CDATA[背景颜色]]></label>
<comment><![CDATA[默认为#FFF]]></comment>
<depends>
<field id="is_pic">0</field>
</depends>
</field>
<field id="image_pc" translate="label" type="Magento\Config\Block\System\Config\Form\Field\Image" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1" >
<label>PC Image</label>
<backend_model>Magento\Config\Model\Config\Backend\Image</backend_model>
<upload_dir config="system" scope_info="1">joshine/freebar</upload_dir>
<base_url type="media" scope_info="1">joshine/freebar</base_url>
<depends>
<field id="is_pic">1</field>
</depends>
</field>
<field id="image_mobile" translate="label" type="Magento\Config\Block\System\Config\Form\Field\Image" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1" >
<label>Mobile Image</label>
<backend_model>Magento\Config\Model\Config\Backend\Image</backend_model>
<upload_dir config="system" scope_info="1">joshine/freebar</upload_dir>
<base_url type="media" scope_info="1">joshine/freebar</base_url>
<depends>
<field id="is_pic">1</field>
</depends>
</field>
</group>
</section>
</system>
</config>
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd">
<default>
<freebar_settings>
<general>
<active>1</active>
<content_size>14px</content_size>
<content_color>#FFF</content_color>
<content_back_color>#000</content_back_color>
</general>
</freebar_settings>
</default>
</config>
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Joshine_FreeBar" setup_version="1.0.0" />
</config>
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Joshine_FreeBar',
__DIR__
);
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="page.wrapper">
<block class="Joshine\FreeBar\Block\Index" name="free-shipping.bar" template="Joshine_FreeBar::free_shipping_bar.phtml" before="-" >
<arguments>
<argument name="cache_lifetime" xsi:type="number">3600</argument>
</arguments>
</block>
</referenceContainer>
</body>
</page>
<?php
/** @var $block \Joshine\FreeBar\Block\Index */
?>
<?php
$isEnable = $block->getConfigValue('freebar/general/active');
if ($isEnable):
$is_image = $block->getConfigValue('freebar/general/is_pic');
if ($is_image):
?>
<style>
.free-shipping-bar{width: 100%; height: auto;z-index: 10;}
@media (max-width: 768px) {.free-shipping-bar{position: fixed;}}
</style>
<div class="free-shipping-bar">
<picture>
<source media="(max-width: 768px)" srcset="<?=$block->getImageValue(1)?>">
<source media="(min-width: 769px)" srcset="<?=$block->getImageValue()?>">
<img src="<?=$block->getImageValue()?>" loading="lazy" >
</picture>
</div>
<?php else: ?>
<style>
.free-shipping-bar{
width: 100%;
height: 40px;
line-height: 40px;
text-align: center;
background-size: 100% 100%!important;
background-repeat: no-repeat;
background-color: <?=$block->getConfigValue('freebar/general/content_back_color') ?>;
font-size: <?=$block->getConfigValue('freebar/general/content_size') ?>;
z-index: 10;
}
@media (max-width: 768px) {.free-shipping-bar{position: fixed;}}
.free-shipping-bar span {width: 100%;height: 100%; display: block; color: <?=$block->getConfigValue('freebar/general/content_color') ?>}
</style>
<div class="free-shipping-bar">
<span><?=$block->getConfigValue('freebar/general/content') ?></p></span>
</div>
<?php endif ?>
<?php endif ?>
......@@ -133,7 +133,7 @@ class Upsell extends AbstractProduct implements IdentityInterface
$collection->addAttributeToSelect('*');
$collection->setVisibility($this->_catalogProductVisibility->getVisibleInCatalogIds());
$collection->getSelect()->order('rand()');
$collection->setPageSize(10);
$collection->setPageSize(6);
$collection->addStoreFilter($product->getStoreId());
$this->_itemCollection = $collection;
......
......@@ -34,7 +34,7 @@ class Recently extends \Magento\Framework\App\Action\Action
$productCollection->addAttributeToSelect('*')
->addFieldToFilter('status', 1)
->addAttributeToFilter('entity_id', array( 'in' => $in));
$productCollection->getSelect()->order(sprintf("field(e.entity_id,%s)", $productIds));
$productCollection->getSelect()->order(sprintf("field(e.entity_id,%s)", $productIds))->limit(6);
/** @var \Magento\CatalogInventory\Helper\Stock $stockHelper */
$stockHelper = $this->_objectManager->get('Magento\CatalogInventory\Helper\Stock');
$stockHelper->addInStockFilterToCollection($productCollection);
......
......@@ -73,6 +73,7 @@ class Onepage extends \Magento\Framework\View\Element\Template
$this->serializer = $serializerInterface ?: \Magento\Framework\App\ObjectManager::getInstance()
->get(\Magento\Framework\Serialize\Serializer\JsonHexTag::class);
$this->_scopeConfigInterface = $_scopeConfigInterface;
$this->_urlBuilder = $context->getUrlBuilder();
}
/**
......@@ -116,7 +117,13 @@ class Onepage extends \Magento\Framework\View\Element\Template
$price = $_helper->currency($full_free, true, false);
return $price;
}
public function getLogoUrl()
{
$path = $this->_scopeConfigInterface->getValue('design/header/logo_src','stores',1);
$logoUrl = $this->_urlBuilder
->getBaseUrl(['_type' => \Magento\Framework\UrlInterface::URL_TYPE_MEDIA]) .'logo/'. $path;
return $logoUrl;
}
public function getFullFreeShip()
{
return $this->_scopeConfigInterface->getValue('carriers/freeshipping/free_shipping_subtotal');
......
......@@ -90,21 +90,21 @@ class DefaultItem extends AbstractItem
$resource = $objectManager->get('Magento\Framework\App\ResourceConnection');
$connection = $resource->getConnection();
if (!empty($options)) {
foreach ($options as $key => $option) {
if ($option['label'] != 'Size') {
$tableName = $resource->getTableName('eav_attribute_option_value');
$sql = "Select * FROM " . $tableName ." where store_id=0 AND option_id=".$option['option_value'];
$result = $connection->fetchRow($sql);
$options[$key]['value'] = $result['value'];
} else {
$tableName = $resource->getTableName('eav_attribute_option_swatch');
$sql = "Select * FROM " . $tableName ." where store_id=0 AND option_id=".$option['option_value'];
$result = $connection->fetchRow($sql);
$options[$key]['value'] = $result['value'];
}
}
}
// if (!empty($options)) {
// foreach ($options as $key => $option) {
// if ($option['label'] != 'Size') {
// $tableName = $resource->getTableName('eav_attribute_option_value');
// $sql = "Select * FROM " . $tableName ." where store_id=0 AND option_id=".$option['option_value'];
// $result = $connection->fetchRow($sql);
// $options[$key]['value'] = $result['value'];
// } else {
// $tableName = $resource->getTableName('eav_attribute_option_swatch');
// $sql = "Select * FROM " . $tableName ." where store_id=0 AND option_id=".$option['option_value'];
// $result = $connection->fetchRow($sql);
// $options[$key]['value'] = $result['value'];
// }
// }
// }
return [
'options' => $options,
'qty' => $this->item->getQty() * 1,
......
......@@ -12,28 +12,8 @@
<body>
<referenceContainer name="page.bottom.container" remove="true"/>
<referenceContainer name="footer-container" remove="true"/>
<referenceBlock name="catalog.topnav" remove="true" />
<referenceBlock name="top.search" remove="true" />
<referenceBlock name="sparsh.free-shipping.bar.top" remove="true" />
<referenceBlock name="header.search.bar" remove="true" />
<referenceBlock name="header.account" remove="true" />
<referenceBlock name="header.wishlist" remove="true" />
<referenceBlock name="minicart" remove="true" />
<referenceContainer name="header.container">
<block class="Magento\Cms\Block\Block" name="cart.payment.top">
<arguments>
<argument name="block_id" xsi:type="string">cart_payment_top</argument>
</arguments>
</block>
</referenceContainer>
<referenceContainer name="columns.top">
<block class="Magento\Cms\Block\Block" name="progress.bar" before="-">
<arguments>
<argument name="block_id" xsi:type="string">progress_bar</argument>
</arguments>
</block>
</referenceContainer>
<referenceBlock name="page.main.title">
<block class="Magento\Checkout\Block\Onepage\Success" name="checkout.success.print.button" template="Magento_Checkout::button.phtml"/>
<action method="setPageTitle">
......
......@@ -9,13 +9,6 @@
?>
<div id="checkout" data-bind="scope:'checkout'" class="checkout-container">
<div id="checkout-loader" data-role="checkout-loader" class="loading-mask" data-mage-init='{"checkoutLoader": {}}'>
<div class="loader">
<img src="<?= $block->escapeUrl($block->getViewFileUrl('images/loader-1.gif')) ?>"
alt="<?= $block->escapeHtmlAttr(__('Loading...')) ?>">
</div>
</div>
<?= /* @noEscape */ $secureRenderer->renderStyleAsTag("position: absolute;", "#checkout-loader img") ?>
<!-- ko template: getTemplate() --><!-- /ko -->
<script type="text/x-magento-init">
{
......@@ -35,10 +28,8 @@ script;
<?= /* @noEscape */ $secureRenderer->renderTag('script', [], $scriptString, false) ?>
<?php $scriptString = <<<script
require([
'mage/url',
'Magento_Ui/js/block-loader'
], function(url, blockLoader) {
blockLoader("{$block->escapeJs($block->escapeUrl($block->getViewFileUrl('images/loader-1.gif')))}");
'mage/url'
], function(url) {
return url.setBaseUrl('{$block->escapeJs($block->escapeUrl($block->getBaseUrl()))}');
})
script;
......
......@@ -42,6 +42,7 @@ define([
totals = ko.observable(totalsData),
collectedTotals = ko.observable({});
return {
totals: totals,
shippingAddress: shippingAddress,
......@@ -53,7 +54,6 @@ define([
paymentMethod: paymentMethod,
paymentMethodlist:paymentMethodlist,
guestEmail: null,
/**
* @return {*}
*/
......@@ -119,12 +119,6 @@ define([
getPaymentMethod: function () {
return paymentMethod;
},
setShippingSaveMethod: function (Method) {
shippingSaveMethod(Method);
},
getShippingSaveMethod: function () {
return shippingSaveMethod;
},
setPaymentMethodList: function (MethodList) {
paymentMethodlist(MethodList);
},
......@@ -132,6 +126,15 @@ define([
return paymentMethodlist;
},
setShippingSaveMethod: function (Method) {
shippingSaveMethod(Method);
},
getShippingSaveMethod: function () {
return shippingSaveMethod;
},
/**
* @return {*}
*/
......
......@@ -57,6 +57,10 @@ define([
).done(function (result) {
var new_sh = [];
new_sh.push(result[0]);
if(result.length > 1)
{
quote.setShippingSaveMethod(result[1]);
}
rateRegistry.set(address.getCacheKey(), result);
shippingService.setShippingRates(new_sh);
}).fail(function (response) {
......
......@@ -178,14 +178,14 @@ define([
}
}
var data = setBillingAddressAction(globalMessageList);
if(data.status == 200)
{
this.isAddressDetailsVisible(true);
}
else
{
this.isAddressDetailsVisible(false);
}
// if(data.status == 200)
// {
// this.isAddressDetailsVisible(true);
// }
// else
// {
// this.isAddressDetailsVisible(false);
// }
this.updateAddresses();
......
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'jquery',
'uiComponent',
'mage/mage'
], function ($, Component) {
'use strict';
return Component.extend({
defaults: {
template: 'Magento_Checkout/checkout-index-footer'
}
});
});
......@@ -54,6 +54,7 @@ define([
isCustomerLoggedIn: customer.isLoggedIn,
forgotPasswordUrl: window.checkoutConfig.forgotPasswordUrl,
emailCheckTimeout: 0,
visible: ko.observable(window.checkoutConfig.addressVisible),
/**
* Initializes regular properties of instance.
......@@ -79,7 +80,6 @@ define([
return this;
},
/**
* Callback on changing email property
*/
......
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'jquery',
'uiComponent',
'ko',
'Magento_Checkout/js/model/quote',
'mage/mage'
], function ($, Component,ko,quote) {
'use strict';
return Component.extend({
defaults: {
template: 'Magento_Checkout/logo-nav'
},
visible: ko.observable(!quote.isVirtual()) && ko.observable(window.checkoutConfig.addressVisible),
shippingVisible: ko.observable(window.checkoutConfig.shippingVisible),
paymentVisible: ko.observable(window.checkoutConfig.paymentVisible),
getLogoSrc: function(){
return window.checkoutConfig.logosrc;
},
breadcrumbReturnToCart: function(){
$.mage.redirect(window.checkoutConfig.cartUrl);
},
isMobile: function(){
return window.checkoutConfig.isMobile;
}
});
});
......@@ -39,6 +39,8 @@ define([
activeMethod: ''
},
isVisible: ko.observable(quote.isVirtual()),
paymentVisible: ko.observable(window.checkoutConfig.paymentVisible),
isLoading: paymentService.isLoading,
quoteIsVirtual: quote.isVirtual(),
isPaymentMethodsAvailable: ko.computed(function () {
return paymentService.getAvailablePaymentMethods().length > 0;
......
......@@ -149,14 +149,15 @@ define([
}
}
).always(
function () {
self.isPlaceOrderActionAllowed(true);
}
);
function () {
self.isPlaceOrderActionAllowed(true);
}
);
return true;
}
$('.waitBtn').hide();
$('.complete-order').show();
return false;
},
......
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'jquery',
'uiComponent',
'mage/mage'
], function ($, Component) {
'use strict';
return Component.extend({
defaults: {
template: 'Magento_Checkout/paypal'
},
paypalCheckout: function(){
var returnUrl = $('input[data-action="checkout-form-submit"]').attr('data-checkout-url');
var y=(window.screen.availHeight-657);
var x=(window.screen.availWidth-535);
var mywindow = window.open(returnUrl, "_blank", "height=657,width=535,scrollbars=yes,resizable=1,modal=false,alwaysRaised=yes");
mywindow.moveTo(x/2,y/2);
}
});
});
......@@ -73,7 +73,10 @@ define([
isNewAddressAdded: ko.observable(false),
saveInAddressBook: 1,
quoteIsVirtual: quote.isVirtual(),
addressVisible: ko.observable(!quote.isVirtual() && window.checkoutConfig.addressVisible),
shippingVisible: ko.observable(window.checkoutConfig.shippingVisible),
paymentVisible: ko.observable(window.checkoutConfig.paymentVisible),
textVisible: ko.observable(false),
/**
* @return {exports}
*/
......@@ -382,6 +385,9 @@ define([
if (this.source.get('shippingAddress.custom_attributes')) {
this.source.trigger('shippingAddress.custom_attributes.data.validate');
}
},
backToCart: function(){
$.mage.redirect(window.checkoutConfig.cartUrl);
}
});
});
......@@ -72,7 +72,7 @@ define([
return priceUtils.formatPrice(price, quote.getPriceFormat());
},
getGrandTotal:function(){
return this.getFormattedPrice(this.totals['subtotal']);
return this.getFormattedPrice(this.totals['base_grand_total']);
},
/**
* Set items to observable field
......@@ -93,6 +93,9 @@ define([
*/
isItemsBlockExpanded: function () {
return quote.isVirtual() || stepNavigator.isProcessed('shipping');
},
isMobile: function(){
return window.checkoutConfig.isMobile;
}
});
});
......@@ -51,11 +51,10 @@ define([
}
if (typeof shippingMethod['method_title'] !== 'undefined') {
shippingMethodTitle = ' - ' + shippingMethod['method_title'];
shippingMethodTitle = shippingMethod['method_title'];
}
return shippingMethodTitle ?
shippingMethod['carrier_title'] + shippingMethodTitle :
return shippingMethodTitle ? shippingMethodTitle :
shippingMethod['carrier_title'];
},
getShippingSaveMethodTitle: function () {
......
......@@ -5,7 +5,7 @@
*/
-->
<div class="field field-select-billing">
<label class="label"><span data-bind="i18n: 'Billing Address'"></span></label>
<label class="label-title step-title"><span data-bind="i18n: 'Billing Address'"></span></label>
<div class="control" data-bind="if: (addressOptions.length > 1)">
<select class="select" name="billing_address_id" data-bind="
options: addressOptions,
......
<div class="trade-checkout-whole-footer__baseline sl_section--small"></div>
<div class="copyright_block" data-testid="checkout-ntfht">
<div id="shopline-section-trade/policy_description" class="shopline-section"><div class="checkout-description-footer ">
<footer id="policy-description" class="checkout_policy_description" trade-btn-event-name="trade:showPolicyModal" data-testid="checkout-dtv5i">
<ul>
<li>
<a class="custom-link-color" href="/return-exchange-policy" target="_blank">Refund Policy</a>
</li>
<li>
<a class="custom-link-color" href="/shipping-policy" target="_blank">Shipping policy</a>
</li>
<li>
<a class="custom-link-color" href="/security-privacy-policy" target="_blank">Privacy Policy</a>
</li>
<li>
<a class="custom-link-color" href="/terms-of-use" target="_blank">Terms of service</a>
</li>
</ul>
</footer>
</div>
</div>
<div id="shopline-section-trade/copy_rights" class="shopline-section"><footer class="checkout_copy_right primary-text hide" role="contentinfo">
© 2023 ChicCurve. All Rights Reserved.
</footer></div>
</div>
\ No newline at end of file
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<header class="pc_logo">
<div id="joshine-section-header_logo" class="joshine-section">
<h1 class="logo_container logo_container_checkout header_logo--img align-center pc can_click" data-logo="logo" id="trade_logo" data-testid="checkout-zhn03">
<div class="logo_inner size-medium">
<a title="" href="/" data-testid="checkout-syuyl"><img data-bind="attr: {'src': getLogoSrc()}" alt="JOSHINE"></a>
</div>
</h1>
</div>
</header>
<!-- ko if: isMobile() -->
<!-- ko foreach: getRegion('logo-nav-sidebar') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
<!--/ko-->
<header class="main__header" role="banner">
<div id="joshine-section-trade/checkout_breadcrumb" class="joshine-section"><div class="trade_checkout_breadcrumb trade_checkout_breadcrumb_checkout logo-align-center">
<button type="button" id="breadcrumb-return-to-cart"
data-step=""
trade-btn-event-name="trade:breadcrumb-return-to-cart"
class="trade_checkout_breadcrumb_button trade_checkout_step_done custom-link-color trade-checkout-btn"
data-bind="click: breadcrumbReturnToCart">
<div class="trade_checkout_steps_stepItem">
<span class="text">Cart</span>
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.96967 12.0303C5.67678 11.7374 5.67678 11.2626 5.96967 10.9697L8.93934 8L5.96967 5.03033C5.67678 4.73744 5.67678 4.26256 5.96967 3.96967C6.26256 3.67678 6.73744 3.67678 7.03033 3.96967L10.5303 7.46967C10.8232 7.76256 10.8232 8.23744 10.5303 8.53033L7.03033 12.0303C6.73744 12.3232 6.26256 12.3232 5.96967 12.0303Z" fill="#959595"></path>
</svg>
</div>
</button>
<button type="button"
id="breadcrumb-fill-info"
data-step="contact_information"
trade-btn-event-name="trade:breadcrumb-fill-info"
class="trade_checkout_breadcrumb_button trade_checkout_step_doing primary-text trade-checkout-btn"
data-bind="css: { trade_checkout_step_waiting: !visible() }">
<div class="trade_checkout_steps_stepItem"><span class="text">Information</span>
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.96967 12.0303C5.67678 11.7374 5.67678 11.2626 5.96967 10.9697L8.93934 8L5.96967 5.03033C5.67678 4.73744 5.67678 4.26256 5.96967 3.96967C6.26256 3.67678 6.73744 3.67678 7.03033 3.96967L10.5303 7.46967C10.8232 7.76256 10.8232 8.23744 10.5303 8.53033L7.03033 12.0303C6.73744 12.3232 6.26256 12.3232 5.96967 12.0303Z" fill="#959595"></path>
</svg>
</div>
</button>
<button type="button"
id="breadcrumb-logistics"
data-step="shipping_method"
trade-btn-event-name="trade:breadcrumb-logistics"
class="trade_checkout_breadcrumb_button shipping-btn primary-text trade-checkout-btn"
data-bind="css: { trade_checkout_step_waiting: !shippingVisible() }">
<div class="trade_checkout_steps_stepItem"><span class="text" data-text="Shipping">Shipping</span>
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.96967 12.0303C5.67678 11.7374 5.67678 11.2626 5.96967 10.9697L8.93934 8L5.96967 5.03033C5.67678 4.73744 5.67678 4.26256 5.96967 3.96967C6.26256 3.67678 6.73744 3.67678 7.03033 3.96967L10.5303 7.46967C10.8232 7.76256 10.8232 8.23744 10.5303 8.53033L7.03033 12.0303C6.73744 12.3232 6.26256 12.3232 5.96967 12.0303Z" fill="#959595"></path>
</svg>
</div>
</button>
<button type="button"
id="breadcrumb-payment"
data-step="payment_method"
trade-btn-event-name="trade:breadcrumb-payment"
class="trade_checkout_breadcrumb_button primary-text trade-checkout-btn"
data-bind="css: { trade_checkout_step_waiting: !paymentVisible() }">
<div class="trade_checkout_steps_stepItem"><span class="text">Payment</span>
</div>
</button>
</div></div>
</header>
\ No newline at end of file
......@@ -9,6 +9,16 @@
<div repeat="foreach: paymentGroupsList, item: '$group'"
class="payment-group">
<each args="data: getRegion($group().displayArea), as: 'method'" render=""></each>
<div class="group-item-body payment__body KlarnaBNPL has_content payment__body--online" ><div>
<svg width="143" height="100" viewBox="0 0 200 140" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M175 70V24C175 20.6863 172.314 18 169 18H15C11.6863 18 9 20.6863 9 24V116C9 119.314 11.6863 122 15 122H169C172.314 122 175 119.314 175 116V84.9259" stroke="currentColor" stroke-width="3"></path>
<path d="M9 36H175" stroke="currentColor" stroke-width="3"></path>
<circle cx="18" cy="27" r="3" fill="currentColor"></circle>
<circle cx="28" cy="27" r="3" fill="currentColor"></circle>
<circle cx="38" cy="27" r="3" fill="currentColor"></circle>
<path d="M146.5 77H197M197 77L189 69M197 77L189 85" stroke="currentColor" stroke-width="3"></path>
</svg>
<div>After clicking 'Complete Order', you will be redirected to the payment page to securely complete the payment.</div></div></div>
</div>
</div>
<div ifnot="isPaymentMethodsAvailable()"
......
......@@ -4,12 +4,12 @@
* See COPYING.txt for license details.
*/
-->
<li id="payment" role="presentation" class="checkout-payment-method">
<li id="payment" role="presentation" class="checkout-payment-method payment-three" data-bind="fadeVisible: paymentVisible(), blockLoader: isLoading" style="order:4;">
<div id="checkout-step-payment"
class="step-content"
data-role="content"
role="tabpanel"
aria-hidden="false">
aria-hidden="false" >
<!-- ko if: (quoteIsVirtual) -->
<!-- ko foreach: getRegion('customer-email') -->
<!-- ko template: getTemplate() --><!-- /ko -->
......@@ -18,15 +18,12 @@
<form id="co-payment-form" class="form payments" novalidate="novalidate">
<input data-bind='attr: {value: getFormKey()}' type="hidden" name="form_key"/>
<fieldset class="fieldset">
<p class="step-title no-border">
<!-- ko ifnot: (quoteIsVirtual) -->
<span class="number">
<span translate="'3'" />
</span>
<!--/ko-->
<span translate="'Payment Method'" />
<p class="step-title no-border label-title">
<span translate="'Payment Method'"/>
</p>
<h5 class="block-select-subtitle">
All transactions are secure and encrypted.
</h5>
<!-- ko foreach: getRegion('beforeMethods') -->
......@@ -42,7 +39,7 @@
</div>
<!--/ko-->
<!-- ko ifnot: (quoteIsVirtual) -->
<div id="checkout-payment-method-load" class="opc-payment dispay-solid" data-bind="visible: isPaymentMethodsAvailable">
<div id="checkout-payment-method-load" class="opc-payment" data-bind="visible: isPaymentMethodsAvailable">
<!-- ko foreach: getRegion('payment-methods-list') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
......
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<div id="trade-checkout-smartpay" class="address-one">
<div id="trade-paypal-express">
<h2 class="trade_checkout__exp__title">
Express Checkout
</h2>
<div data-label="or" class="paypal checkout after paypal-logo">
<div class="checkout-logo-medium" data-bind="click: paypalCheckout">
<input type="image" data-action="checkout-form-submit" data-checkout-url="/paypal/express/start/button/1/" src="/static/frontend/Joshine/breeze/en_US/Magento_Paypal/images/paypal.png" alt="Checkout with PayPal" title="Checkout with PayPal">
<div class="checkout-txt" style="display:contents;"></div>
</div>
</div>
<div class="trade_checkout__exp__line">
<span class="lineLeft"></span>
<span class="lineText">
OR
</span>
<span class="lineRight"></span>
</div>
</div>
</div>
\ No newline at end of file
......@@ -5,6 +5,9 @@
*/
-->
<div id="opc-sidebar">
<!-- ko foreach: getRegion('estimation') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
<!-- ko foreach: getRegion('summary') -->
<!-- ko template: getTemplate() --><!-- /ko -->
......
......@@ -5,7 +5,6 @@
*/
-->
<div class="opc-block-summary" data-bind="blockLoader: isLoading">
<span data-bind="i18n: 'Order Summary'" class="title"></span>
<!-- ko foreach: elems() -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
......
......@@ -91,7 +91,11 @@ define([
$form.trigger('submit');
} else {
$.mage.redirect(returnUrl);
var y=(window.screen.availHeight-657);
var x=(window.screen.availWidth-535);
var mywindow = window.open(returnUrl, "_blank", "height=657,width=535,scrollbars=yes,resizable=1,modal=false,alwaysRaised=yes");
mywindow.moveTo(x/2,y/2);
//$.mage.redirect(returnUrl);
}
}
});
......
......@@ -13,29 +13,29 @@
<item name="components" xsi:type="array">
<item name="checkout" xsi:type="array">
<item name="children" xsi:type="array">
<!--<item name="steps" xsi:type="array">
<item name="logo-nav" xsi:type="array">
<item name="children" xsi:type="array">
<item name="billing-step" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="logo-nav-sidebar" xsi:type="array">
<item name="children" xsi:type="array">
<item name="payment" xsi:type="array">
<item name="summary" xsi:type="array">
<item name="children" xsi:type="array">
<item name="afterMethods" xsi:type="array">
<item name="discount" xsi:type="array">
<item name="component" xsi:type="string">Magento_SalesRule/js/view/payment/discount</item>
<item name="children" xsi:type="array">
<item name="errors" xsi:type="array">
<item name="sortOrder" xsi:type="string">4</item>
<item name="component" xsi:type="string">Magento_SalesRule/js/view/payment/discount-messages</item>
<item name="displayArea" xsi:type="string">messages</item>
</item>
</item>
</item>
<item name="totals" xsi:type="array">
<item name="children" xsi:type="array">
<item name="discount" xsi:type="array">
<item name="component" xsi:type="string">Magento_SalesRule/js/view/payment/discount</item>
<item name="children" xsi:type="array">
<item name="errors" xsi:type="array">
<item name="sortOrder" xsi:type="string">0</item>
<item name="component" xsi:type="string">Magento_SalesRule/js/view/payment/discount-messages</item>
<item name="displayArea" xsi:type="string">messages</item>
</item>
<item name="captcha" xsi:type="array">
<item name="component" xsi:type="string">Magento_SalesRule/js/view/payment/captcha</item>
<item name="displayArea" xsi:type="string">captcha</item>
<item name="formId" xsi:type="string">sales_rule_coupon_request</item>
<item name="configSource" xsi:type="string">checkoutConfig</item>
</item>
<item name="component" xsi:type="string">Magento_SalesRule/js/view/summary/discount</item>
<item name="config" xsi:type="array">
<item name="title" xsi:type="string" translate="true">Discount</item>
</item>
</item>
</item>
......@@ -45,7 +45,7 @@
</item>
</item>
</item>
</item>-->
</item>
<item name="sidebar" xsi:type="array">
<item name="children" xsi:type="array">
<item name="summary" xsi:type="array">
......
......@@ -7,7 +7,19 @@
<?php
/** @var $block \Magento\Swatches\Block\Product\Renderer\Configurable */
/** @var \Magento\Swatches\ViewModel\Product\Renderer\Configurable $configurableViewModel */
$configurableViewModel = $block->getConfigurableViewModel()
$configurableViewModel = $block->getConfigurableViewModel();
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$chartBlock = $objectManager->get(\Magepow\Sizechart\Block\Product\Sizechart::class);
$sizeChart = $chartBlock->getSizeChart();
$chartTableArray = [];
if ($sizeChart != null) {
$chartTable = $sizeChart->getData('custom_size');
$chartTableArray = $chartTable;
}
$chartTableArray = json_encode($chartTableArray, true);
?>
<div class="swatch-opt" data-role="swatch-options"></div>
......@@ -20,7 +32,8 @@ $configurableViewModel = $block->getConfigurableViewModel()
"mediaCallback": "<?= $block->escapeJs($block->escapeUrl($block->getMediaCallback())) ?>",
"gallerySwitchStrategy": "<?= $block->escapeJs($block->getVar('gallery_switch_strategy', 'Magento_ConfigurableProduct')) ?: 'replace'; ?>",
"jsonSwatchImageSizeConfig": <?= /* @noEscape */ $block->getJsonSwatchSizeConfig() ?>,
"showTooltip": <?= $block->escapeJs($configurableViewModel->getShowSwatchTooltip()) ?>
"showTooltip": <?= $block->escapeJs($configurableViewModel->getShowSwatchTooltip()) ?>,
"sizeChartData": <?= $chartTableArray ?>
}
},
"*" : {
......
......@@ -12,7 +12,6 @@
<?= /* @noEscape */ $headAdditional ?>
</head>
<body data-container="body"
data-mage-init='{"loaderAjax": {}, "loader": { "icon": "<?= /* @noEscape */ $loaderIcon ?>"}}'
<?= /* @noEscape */ $bodyAttributes ?>>
<?= /* @noEscape */ $layoutContent ?>
</body>
......
......@@ -16,14 +16,12 @@ var config = {
'dropdownDialog': 'mage/dropdown',
'dropdown': 'mage/dropdowns',
'accordion': 'mage/accordion',
'loader': 'mage/loader',
'tooltip': 'mage/tooltip',
'deletableItem': 'mage/deletable-item',
'itemTable': 'mage/item-table',
'fieldsetControls': 'mage/fieldset-controls',
'fieldsetResetControl': 'mage/fieldset-controls',
'redirectUrl': 'mage/redirect-url',
'loaderAjax': 'mage/loader',
'menu': 'mage/menu',
'popupWindow': 'mage/popup-window',
'validation': 'mage/validation/validation',
......
......@@ -491,5 +491,13 @@ define([
isCheckoutIndex: function () {
return $('body').hasClass('checkout-index-index');
}
,
isSelectIndex: function () {
if(this.elementTmpl.indexOf("select") != -1)
{
return true;
}
return false;
}
});
});
......@@ -343,6 +343,13 @@ define([
});
return _.flatten(result);
},
isMobile: function(){
if(/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
return true;
} else {
return false;
}
}
});
});
......@@ -4,7 +4,6 @@
* See COPYING.txt for license details.
*/
-->
<!-- ko ifnot: isCheckoutIndex() -->
<select class="select" data-bind="
attr: {
name: inputName,
......@@ -26,32 +25,4 @@
ko.applyBindingsToNode(option, {attr: {disabled: true}}, item);
}
}"
></select>
<!-- /ko -->
<!-- ko if: isCheckoutIndex() -->
<input class="input-text select-input" type="text" data-bind="value: getPreview(),attr: {
'aria-required': required
}" required readonly="readonly"/>
<select class="select check-select" data-bind="
attr: {
name: inputName,
id: uid,
disabled: disabled,
'aria-describedby': getDescriptionId(),
'aria-required': required,
'aria-invalid': error() ? true : 'false',
placeholder: placeholder
},
hasFocus: focused,
optgroup: options,
value: value,
optionsCaption: caption,
optionsValue: 'value',
optionsText: 'label',
optionsAfterRender: function(option, item) {
if (item && item.disabled) {
ko.applyBindingsToNode(option, {attr: {disabled: true}}, item);
}
}"></select>
<!-- /ko -->
\ No newline at end of file
></select>
\ No newline at end of file
......@@ -13,43 +13,43 @@
<div class="control" data-bind="css: {'_with-tooltip': element.tooltip}">
<!-- ko ifnot: element.hasAddons() -->
<!-- ko template: element.elementTmpl --><!-- /ko -->
<!-- ko template: element.elementTmpl --><!-- /ko -->
<!-- /ko -->
<!-- ko if: element.hasAddons() -->
<div class="control-addon">
<!-- ko template: element.elementTmpl --><!-- /ko -->
<div class="control-addon">
<!-- ko template: element.elementTmpl --><!-- /ko -->
<!-- ko if: element.addbefore -->
<label class="addon-prefix" data-bind="attr: { for: element.uid }"><span data-bind="text: element.addbefore"></span></label>
<!-- /ko -->
<!-- ko if: element.addbefore -->
<label class="addon-prefix" data-bind="attr: { for: element.uid }"><span data-bind="text: element.addbefore"></span></label>
<!-- /ko -->
<!-- ko if: element.addafter -->
<label class="addon-suffix" data-bind="attr: { for: element.uid }"><span data-bind="text: element.addafter"></span></label>
<!-- /ko -->
</div>
<!-- ko if: element.addafter -->
<label class="addon-suffix" data-bind="attr: { for: element.uid }"><span data-bind="text: element.addafter"></span></label>
<!-- /ko -->
</div>
<!-- /ko -->
<!-- ko if: element.tooltip -->
<!-- ko template: element.tooltipTpl --><!-- /ko -->
<!-- ko template: element.tooltipTpl --><!-- /ko -->
<!-- /ko -->
<!-- ko if: element.notice -->
<div class="field-note" data-bind="attr: { id: element.noticeId }">
<span data-bind="text: element.notice"></span>
</div>
<div class="field-note" data-bind="attr: { id: element.noticeId }">
<span data-bind="text: element.notice"></span>
</div>
<!-- /ko -->
<!-- ko if: element.error() -->
<div class="field-error" data-bind="attr: { id: element.errorId }" generated="true">
<span data-bind="text: element.error"></span>
</div>
<div class="field-error" data-bind="attr: { id: element.errorId }" generated="true">
<span data-bind="text: element.error"></span>
</div>
<!-- /ko -->
<!-- ko if: element.warn() -->
<div role="alert" class="message warning" data-bind="attr: { id: element.warningId }" generated="true">
<span data-bind="text: element.warn"></span>
</div>
<div role="alert" class="message warning" data-bind="attr: { id: element.warningId }" generated="true">
<span data-bind="text: element.warn"></span>
</div>
<!-- /ko -->
</div>
</div>
......@@ -57,10 +57,16 @@
<!-- ko if: isCheckoutIndex() -->
<div class="field" data-bind="visible: visible, attr: {'name': element.dataScope}, css: additionalClasses">
<!-- ko if: isSelectIndex() -->
<label class="label" data-bind="attr: { for: element.uid },css: {'fouse-label':true}">
<!-- ko if: element.label --><span translate="element.label"></span><!-- /ko -->
</label>
<!-- /ko -->
<!-- ko ifnot: isSelectIndex() -->
<label class="label" data-bind="attr: { for: element.uid },css: {'fouse-label': element.value}">
<!-- ko if: element.label --><span translate="element.label"></span><!-- /ko -->
</label>
<!-- /ko -->
<div class="control" data-bind="css: {'_with-tooltip': element.tooltip}">
<!-- ko ifnot: element.hasAddons() -->
<!-- ko template: element.elementTmpl --><!-- /ko -->
......
<?php
namespace Magepow\Sizechart\Api\Data;
interface SizechartInterface
{
const ENTITY_ID = 'entity_id';
const CATEGORY_ID = 'category_id';
const SUB_CATEGORY_ID = 'sub_category_id';
const TYPE_DISPLAY = 'type_display';
const IS_ACTIVE = 'is_active';
const DESCRIPTION = 'description';
const SIZECHART_INFO = 'sizechart_info';
const UPDATED_AT = 'updated_at';
const CREATED_AT = 'created_at';
const TEMPLATE_CSS = 'template_css';
const CONDITIONS = 'conditions_serialized';
const STORE = 'stores';
public function getEntityId();
public function setEntityId($entityId);
public function getCategoryId();
public function setCategoryId($categoryId);
public function getSubCategoryId();
public function setSubCategoryId($subCategoryId);
public function getIsActive();
public function setIsActive($isActive);
public function getTypeDisplay();
public function setTypeDisplay($typeDisplay);
public function getDescription();
public function setDescription($description);
public function getSizeChartInfo();
public function setSizeChartInfo($sizeChartInfo);
public function getUpdatedAt();
public function setUpdatedAt($updatedAt);
public function getCreatedAt();
public function setCreatedAt($createdAt);
public function getTemplateCss();
public function setTemplateCss($templateCss);
public function getConditions();
public function setConditions($conditions);
public function getStoreView();
public function setStoreView($stores);
}
\ No newline at end of file
<?php
namespace Magepow\Sizechart\Block\Adminhtml\Sizechart;
class AddRow extends \Magento\Backend\Block\Widget\Form\Container
{
protected $_coreRegistry = null;
public function __construct(
\Magento\Backend\Block\Widget\Context $context,
\Magento\Framework\Registry $registry,
array $data = []
) {
$this->_coreRegistry = $registry;
parent::__construct($context, $data);
}
protected function _construct()
{
$this->_objectId = 'row_id';
$this->_blockGroup = 'Magepow_Sizechart';
$this->_controller = 'adminhtml_sizechart';
parent::_construct();
if ($this->_isAllowedAction('Magepow_Sizechart::add_row')) {
$this->buttonList->update('save', 'label', __('Save'));
$this->buttonList->add(
'saveandcontinue',
[
'label' => __('Save and Continue Edit'),
'class' => 'save',
'data_attribute' => [
'mage-init' => [
'button' => [
'event' => 'saveAndContinueEdit',
'target' => '#edit_form'
]
]
]
]
);
} else {
$this->buttonList->remove('save');
}
// $this->buttonList->remove('reset');
}
public function getHeaderText()
{
return __('Add Size Chart Rule');
}
protected function _isAllowedAction($resourceId)
{
return $this->_authorization->isAllowed($resourceId);
}
public function getFormActionUrl()
{
if ($this->hasFormActionUrl()) {
return $this->getData('form_action_url');
}
return $this->getUrl('*/*/save');
}
}
\ No newline at end of file
<?php
namespace Magepow\Sizechart\Block\Adminhtml\Sizechart;
use Joshine\Review\Model\Repository\VoteRepository;
use Magento\Framework\View\Element\Template;
use Magepow\Sizechart\Model\SizechartFactory;
class ChartTable extends Template
{
protected $_template = 'Magepow_Sizechart::chartTable.phtml';
/**
* @var SizechartFactory
*/
private $chartFactory;
public function __construct(
Template\Context $context,
SizechartFactory $chartFactory,
array $data = []
) {
$this->chartFactory = $chartFactory;
parent::__construct($context, $data);
}
public function getCustomSizeData()
{
$id = $this->getRequest()->getParam('id');
if (!$id) {
return [];
}
return $this->chartFactory->create()->load($id);
}
}
\ No newline at end of file
<?php
namespace Magepow\Sizechart\Block\Adminhtml\Sizechart;
use Magento\Framework\View\Element\Template;
use Magepow\Sizechart\Model\SizechartFactory;
class ColumLabel extends Template
{
protected $_template = 'Magepow_Sizechart::columnLabel.phtml';
/**
* @var SizechartFactory
*/
private $chartFactory;
public function __construct(
Template\Context $context,
SizechartFactory $chartFactory,
array $data = []
) {
$this->chartFactory = $chartFactory;
parent::__construct($context, $data);
}
public function getCustomSizeData()
{
$id = $this->getRequest()->getParam('id');
if (!$id) {
return [];
}
return $this->chartFactory->create()->load($id);
}
}
\ No newline at end of file
<?php
namespace Magepow\Sizechart\Block\Adminhtml\Sizechart\Edit;
class Form extends \Magento\Backend\Block\Widget\Form\Generic
{
/**
* Prepare form.
*
* @return $this
*/
protected function _prepareForm()
{
$dateFormat = $this->_localeDate->getDateFormat(\IntlDateFormatter::SHORT);
$model = $this->_coreRegistry->registry('row_data');
$form = $this->_formFactory->create(
[
'data' => [
'id' => 'edit_form',
'enctype' => 'multipart/form-data',
'action' => $this->getData('action'),
'method' => 'post'
]
]
);
$form->setValues($model->getData());
$form->setUseContainer(true);
$this->setForm($form);
return parent::_prepareForm();
}
}
\ No newline at end of file
<?php
namespace Magepow\Sizechart\Block\Adminhtml\Sizechart\Edit\Tab;
use Magento\Backend\Block\Widget\Form\Generic;
use Magento\Backend\Block\Widget\Tab\TabInterface;
class Condition extends Generic implements TabInterface
{
protected $_renderFieldSet;
protected $_conditions;
protected $_ruleFactory;
public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\Framework\Registry $registry,
\Magento\Framework\Data\FormFactory $formFactory,
\Magento\Store\Model\System\Store $systemStore,
\Magento\Framework\ObjectManagerInterface $objectManager,
\Magento\Rule\Block\Conditions $conditions,
\Magento\CatalogWidget\Model\RuleFactory $ruleFactory,
\Magento\Backend\Block\Widget\Form\Renderer\Fieldset $rendererFieldset,
array $data = []
) {
$this->_conditions = $conditions;
$this->_ruleFactory = $ruleFactory;
$this->_renderFieldSet = $rendererFieldset;
parent::__construct($context, $registry, $formFactory, $data);
}
protected function _prepareForm()
{
$model = $this->_coreRegistry->registry('row_data');
$form = $this->_formFactory->create();
$form->setHtmlIdPrefix('wkgrid_');
$fieldsetId = 'conditions_fieldset';
$formName = 'catalog_rule_form';
$widgetParameters = $model->getParameters();
$modelConditions = $this->_ruleFactory->create();
if (is_array($widgetParameters)) {
$modelConditions->loadPost($widgetParameters);
$modelConditions->getConditions()->setJsFormObject($fieldsetId);
}
$newChildUrl = $this->getUrl(
'catalog_rule/promo_catalog/newConditionHtml/form/' . $fieldsetId,
['form_namespace' => $fieldsetId]
);
$renderer = $this->_renderFieldSet->setTemplate('Magento_CatalogRule::promo/fieldset.phtml')
->setNewChildUrl($newChildUrl)
->setFieldSetId($fieldsetId);
$fieldset = $form->addFieldset(
$fieldsetId,
['legend' => __('Conditions (don\'t add conditions if rule is applied to all products)')]
)->setRenderer($renderer);
$fieldset->addField(
'conditions',
'text',
[
'name' => 'conditions',
'label' => __('Conditions'),
'title' => __('Conditions'),
'required' => false,
'data-form-parts' => $formName
]
)->setRule($modelConditions)->setRenderer($this->_conditions);
$form->setValues($model->getData());
$this->setForm($form);
return parent::_prepareForm();
}
public function getTabLabel()
{
return __('Condition apply for products');
}
public function getTabTitle()
{
return __('Condition apply for products');
}
/**
* Can show tab in tabs
*
* @return boolean
* @api
*/
public function canShowTab()
{
return true;
}
/**
* Tab is hidden
*
* @return boolean
* @api
*/
public function isHidden()
{
return false;
}
}
\ No newline at end of file
<?php
namespace Magepow\Sizechart\Block\Adminhtml\Sizechart\Edit\Tab;
use Magento\Backend\Block\Widget\Form\Generic;
use Magento\Backend\Block\Widget\Tab\TabInterface;
use Magepow\Sizechart\Block\Adminhtml\Sizechart\ChartTable;
use Magepow\Sizechart\Block\Adminhtml\Sizechart\CustomerSize;
use Magepow\Sizechart\Block\Adminhtml\Sizechart\Field\FieldChartTable;
use Magepow\Sizechart\Block\Adminhtml\Sizechart\Field\FieldColumnLabel;
class Main extends Generic implements TabInterface
{
protected $_systemStore;
protected $_objectManager;
public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\Framework\Registry $registry,
\Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig,
\Magento\Framework\Data\FormFactory $formFactory,
\Magento\Framework\ObjectManagerInterface $objectManager,
\Magepow\Sizechart\Model\Status $options,
\Magento\Store\Model\System\Store $systemStore,
\Magepow\Sizechart\Model\TypeDisplay $typeDisplay,
array $data = []
) {
$this->_systemStore = $systemStore;
$this->_options = $options;
$this->_wysiwygConfig = $wysiwygConfig;
$this->_typeDisplay = $typeDisplay;
$this->_systemStore = $systemStore;
$this->_objectManager = $context->getStoreManager();
parent::__construct($context, $registry, $formFactory, $data);
}
protected function _prepareForm()
{
$dateFormat = $this->_localeDate->getDateFormat(\IntlDateFormatter::SHORT);
$model = $this->_coreRegistry->registry('row_data');
$form = $this->_formFactory->create();
$form->setHtmlIdPrefix('wkgrid_');
if ($model->getEntityId()) {
$fieldset = $form->addFieldset(
'base_fieldset',
['legend' => __('Edit Size Chart Rule'), 'class' => 'fieldset-wide']
);
// $fieldset->addField('entity_id', 'hidden', ['name' => 'entity_id']); // not use will conflict entity_id ofcondition product
$fieldset->addField('sizechart_id', 'hidden', ['name' => 'sizechart_id']);
} else {
$fieldset = $form->addFieldset(
'base_fieldset',
['legend' => __('Add Size Chart Rule'), 'class' => 'fieldset-wide']
);
}
$fieldset->addField(
'name',
'text',
[
'name' => 'name',
'label' => __('Name'),
'id' => 'name',
'title' => __('Name'),
'class' => 'required_entry',
'required' => true,
]
);
if (!$this->_storeManager->isSingleStoreMode()) {
$field = $fieldset->addField(
'stores',
'multiselect',
[
'name' => 'stores[]',
'label' => __('Store View'),
'title' => __('Store View'),
'required' => true,
'values' => $this->_systemStore->getStoreValuesForForm(false, true)
]
);
$renderer = $this->getLayout()->createBlock(
'Magento\Backend\Block\Store\Switcher\Form\Renderer\Fieldset\Element'
);
$field->setRenderer($renderer);
} else {
$fieldset->addField(
'stores',
'hidden',
['name' => 'stores[]', 'value' => $this->_storeManager->getStore(true)->getId()]
);
$model->setStoreId($this->_storeManager->getStore(true)->getId());
}
$fieldset->addField(
'description',
'textarea',
[
'name' => 'description',
'label' => __('Description'),
'id' => 'description',
'title' => __('Description'),
'style' => 'height:10em',
'required' => false,
]
);
$wysiwygConfig = $this->_wysiwygConfig->getConfig(['tab_id' => $this->getTabId()]);
$fieldset->addField(
'sizechart_info',
'editor',
[
'name' => 'sizechart_info',
'label' => __('Size Chart Information'),
'wysiwyg' => true,
'required' => true,
'config' => $wysiwygConfig
]
);
$fieldset->addType(
'column_label',
FieldColumnLabel::class
);
$fieldset->addType(
'chart_table',
FieldChartTable::class
);
$fieldset->addField(
'column_label',
'column_label',
[
'name' => 'column_label',
'label' => __('Column Label'),
'id' => 'column_label',
'title' => __('Column Label'),
'required' => true,
]
);
$fieldset->addField(
'chart_table',
'chart_table',
[
'name' => 'chart_table',
'label' => __('Chart Table(英尺)'),
'id' => 'chart_table',
'title' => __('Chart Table'),
'required' => false,
]
);
$fieldset->addField(
'category',
'text',
[
'name' => 'category',
'label' => __('分类ID(多个用,隔开不要空格)'),
'id' => 'category',
'title' => __('分类ID(多个用,隔开不要空格)'),
'required' => false,
]
);
$fieldset->addField(
'type_display',
'hidden',
[
'name' => 'type_display',
'label' => __('Type Display'),
'id' => 'type_display',
'title' => __('Type Display'),
'value' => 1,
'required' => false,
]
);
$fieldset->addField(
'is_active',
'select',
[
'name' => 'is_active',
'label' => __('Status'),
'id' => 'is_active',
'title' => __('Status'),
'values' => $this->_options->getOptionArray(),
'value' => 1,
'required' => true,
]
);
$form->addValues($model->getData());
$this->setForm($form);
return parent::_prepareForm();
}
public function getTabLabel()
{
return __('General Information');
}
public function getTabTitle()
{
return __('General Information');
}
/**
* Can show tab in tabs
*
* @return boolean
* @api
*/
public function canShowTab()
{
return true;
}
/**
* Tab is hidden
*
* @return boolean
* @api
*/
public function isHidden()
{
return false;
}
}
\ No newline at end of file
<?php
namespace Magepow\Sizechart\Block\Adminhtml\Sizechart\Edit;
use Magento\Backend\Block\Widget\Tabs as WidgetTabs;
class Tabs extends WidgetTabs
{
/**
* Class constructor
*
* @return void
*/
protected function _construct()
{
parent::_construct();
$this->setId('sizechart_tabs');
$this->setDestElementId('edit_form');
$this->setTitle(__('Size Chart Information'));
}
/**
* @return $this
*/
protected function _beforeToHtml()
{
$this->addTab(
'main_section',
[
'label' => __('General Information'),
'title' => __('General Information'),
'content' => $this->getLayout()->createBlock(
'Magepow\Sizechart\Block\Adminhtml\Sizechart\Edit\Tab\Main'
)->toHtml(),
]
);
/* $this->addTab(
'category',
[
'label' => __('Condition apply for products'),
'title' => __('Condition apply for products'),
'content' => $this->getLayout()->createBlock(
'Magepow\Sizechart\Block\Adminhtml\Sizechart\Edit\Tab\Condition'
)->toHtml(),
]
);*/
return parent::_beforeToHtml();
}
}
\ No newline at end of file
<?php
namespace Magepow\Sizechart\Block\Adminhtml\Sizechart\Field;
use Magento\Framework\Escaper;
use Magepow\Sizechart\Block\Adminhtml\Sizechart\ChartTable;
class FieldChartTable extends \Magento\Framework\Data\Form\Element\AbstractElement
{
protected $_blockFactory;
public function __construct(
\Magento\Framework\Data\Form\Element\Factory $factoryElement,
\Magento\Framework\Data\Form\Element\CollectionFactory $factoryCollection,
Escaper $escaper,
\Magento\Framework\View\Element\BlockFactory $_blockFactory,
$data = []
) {
$this->_blockFactory = $_blockFactory;
parent::__construct($factoryElement, $factoryCollection, $escaper, $data);
}
/**
* Get the after element html.
*
* @return mixed
*/
public function getElementHtml() {
$customDiv = $this->_blockFactory
->createBlock(ChartTable::class)
->toHtml();
return $customDiv;
}
}
\ No newline at end of file
<?php
namespace Magepow\Sizechart\Block\Adminhtml\Sizechart\Field;
use Magento\Framework\Escaper;
use Magepow\Sizechart\Block\Adminhtml\Sizechart\ChartTable;
use Magepow\Sizechart\Block\Adminhtml\Sizechart\ColumLabel;
class FieldColumnLabel extends \Magento\Framework\Data\Form\Element\AbstractElement
{
protected $_blockFactory;
public function __construct(
\Magento\Framework\Data\Form\Element\Factory $factoryElement,
\Magento\Framework\Data\Form\Element\CollectionFactory $factoryCollection,
Escaper $escaper,
\Magento\Framework\View\Element\BlockFactory $_blockFactory,
$data = []
) {
$this->_blockFactory = $_blockFactory;
parent::__construct($factoryElement, $factoryCollection, $escaper, $data);
}
/**
* Get the after element html.
*
* @return mixed
*/
public function getElementHtml() {
$customDiv = $this->_blockFactory
->createBlock(ColumLabel::class)
->toHtml();
return $customDiv;
}
}
\ No newline at end of file
<?php
namespace Magepow\Sizechart\Block\Product;
use Magento\Store\Model\ScopeInterface;
class Sizechart extends \Magento\Catalog\Block\Product\AbstractProduct
{
/**
* Product collection factory
*
* @var \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory
*/
protected $_ruleFactory;
/**
* Product collection factory
*
* @var \Magiccart\Magicproduct\Model\Magicproduct
*/
protected $_sizechartFactory;
protected $_limit; // Limit Product
protected $_parameters; // Condition Product
protected $_request;
protected $_abstractProduct;
protected $json;
protected $_filter;
/**
* @param Context $context
* @param \Magento\Framework\ObjectManagerInterface $objectManager
* @param \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory
* @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility
* @param array $data
*/
public function __construct(
\Magento\Catalog\Block\Product\Context $context,
\Magento\CatalogWidget\Model\RuleFactory $ruleFactory,
\Magepow\Sizechart\Model\SizechartFactory $sizechartFactory,
\Magepow\Sizechart\Serialize\Serializer\Json $json,
\Magento\Cms\Model\Template\FilterProvider $filter,
array $data = []
) {
$this->_ruleFactory = $ruleFactory;
$this->_filter = $filter;
$this->json = $json;
$this->_sizechartFactory = $sizechartFactory;
parent::__construct($context, $data);
}
public function getSizeChartCollection()
{
$store = $this->_storeManager->getStore()->getStoreId();;
$collection = $this->_sizechartFactory->create()->getCollection()
->addFieldToSelect('*')
->addFieldToFilter('is_active', 1)
->addFieldToFilter('stores', array(array('finset' => 0), array('finset' => $store)))
->setOrder('sort_order', 'ASC');
return $collection;
}
public function getSizeChart()
{
if (!$this->hasData('size_chart')) {
$collection = $this->getSizeChartCollection();
$product = $this->getProduct();
$sizeChart = '';
foreach ($collection as $item) {
//$config = $item->getConditionsSerialized();
//$data = $this->json->unserialize($config);
//$parameters = $data['parameters'];
//$rule = $this->getRule($parameters);
//$validate = $rule->getConditions()->validate($product);
/* if ($validate) {
$sizeChart = $item;
break;
}*/
$category = $item->getCategory();
if (empty($category)) {
continue;
}
$categoryIds = explode(',',$category);
$pids = $product->getCategoryIds();
if (count(array_intersect($categoryIds, $pids)) > 0 ) {
$sizeChart = $item;
break;
}
}
$this->setData('size_chart', $sizeChart);
}
return $this->getData('size_chart');
}
public function getContentFromStaticBlock($content)
{
return $this->_filter->getBlockFilter()->filter($content);
}
public function getClass($typeDisplay)
{
$type = 'sizechart-customtab';
if ($typeDisplay == 1) {
$type = 'sizechart-inline';
} elseif ($typeDisplay == 2) {
$type = 'sizechart-popup';
}
return $type;
}
protected function getRule($conditions)
{
$rule = $this->_ruleFactory->create();
if (is_array($conditions)) $rule->loadPost($conditions);
return $rule;
}
public function getMedia($img = null)
{
$urlMedia = $this->_storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA);
if ($img) return $urlMedia . "magepow/sizechart/" . $img;
return $urlMedia;
}
public function isEnabled()
{
return $this->_scopeConfig
->getValue(
'magepow_sizechart/general/enabled',
ScopeInterface::SCOPE_STORE
);
}
static public function getChartJson()
{
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$chartBlock = $objectManager->create(\Magepow\Sizechart\Block\Product\Sizechart::class);
$sizeChart = $chartBlock->getSizeChart();
$chartTableArray = [];
if ($sizeChart != null) {
$chartTable = $sizeChart->getData('custom_size');
$chartTableArray = $chartTable;
}
return json_encode($chartTableArray, true);
}
}
\ No newline at end of file
<?php
namespace Magepow\Sizechart\Controller\Adminhtml;
abstract class Action extends \Magento\Backend\App\Action
{
/**
* Core registry
*
* @var \Magento\Framework\Registry
*/
protected $coreRegistry = null;
/**
* @var \Magento\Framework\App\Response\Http\FileFactory
*/
protected $fileFactory;
/**
* @var \Magento\Framework\Stdlib\DateTime\Filter\Date
*/
protected $dateFilter;
protected $_sizechartFactory;
/**
* @var \Psr\Log\LoggerInterface
*/
protected $logger;
/**
* @param \Magento\Backend\App\Action\Context $context
* @param \Magento\Framework\Registry $coreRegistry
* @param \Magento\Framework\App\Response\Http\FileFactory $fileFactory
* @param \Magento\Framework\Stdlib\DateTime\Filter\Date $dateFilter
* @param \Psr\Log\LoggerInterface $logger
*/
public function __construct(
\Magento\Backend\App\Action\Context $context,
\Magento\Framework\Registry $coreRegistry,
\Magento\Framework\App\Response\Http\FileFactory $fileFactory,
\Magento\Framework\Stdlib\DateTime\Filter\Date $dateFilter,
\Magepow\Sizechart\Model\SizechartFactory $sizechartFactory,
\Psr\Log\LoggerInterface $logger
) {
parent::__construct($context);
$this->coreRegistry = $coreRegistry;
$this->fileFactory = $fileFactory;
$this->dateFilter = $dateFilter;
$this->_sizechartFactory = $sizechartFactory;
$this->logger = $logger;
}
/**
* Initiate rule
*
* @return void
*/
protected function _initRule()
{
$rule = $this->_sizechartFactory->create();
$id = (int)$this->getRequest()->getParam('id');
if (!$id && $this->getRequest()->getParam('entity_id')) {
$id = (int)$this->getRequest()->getParam('entity_id');
}
}
protected function _initAction()
{
$this->_view->loadLayout();
$this->_setActiveMenu('Magepow_Sizechart::magepow_sizechart')
->_addBreadcrumb(__('Magepow Sizechart'), __('Magepow Sizechart'));
return $this;
}
/**
* Returns result of current user permission check on resource and privilege
*
* @return bool
*/
protected function _isAllowed()
{
return $this->_authorization->isAllowed('Magepow_Sizechart::sizechart');
}
}
\ No newline at end of file
<?php
namespace Magepow\Sizechart\Controller\Adminhtml\Sizechart;
use Magento\Framework\Controller\ResultFactory;
class AddRow extends \Magento\Backend\App\Action
{
private $coreRegistry;
private $sizechartFactory;
protected $json;
public function __construct(
\Magento\Backend\App\Action\Context $context,
\Magento\Framework\Registry $coreRegistry,
\Magepow\Sizechart\Model\SizechartFactory $sizechartFactory,
\Magepow\Sizechart\Serialize\Serializer\Json $json
) {
parent::__construct($context);
$this->coreRegistry = $coreRegistry;
$this->sizechartFactory = $sizechartFactory;
$this->json = $json;
}
public function execute()
{
$rowId = (int) $this->getRequest()->getParam('id');
$storeViewId = $this->getRequest()->getParam('stores');
$rowData = $this->sizechartFactory->create();
if ($rowId) {
// $rowData->setStoreViewId($storeViewId)->load($rowId);
$rowData = $rowData->setStoreViewId($storeViewId)->load($rowId);
$rowTitle = $rowData->getTitle();
if (!$rowData->getEntityId()) {
$this->messageManager->addError(__('row data no longer exist.'));
$this->_redirect('magepow_sizechart/sizechart/rowdata');
return;
} else {
//$tmp = $this->json->unserialize($rowData->getConditionsSerialized());
$tmp = $this->json->unserialize('{}');
if (is_array($tmp)) {
unset($tmp['form_key']);
unset($tmp['entity_id']);
$rowData->addData($tmp);
}
$rowData->setData('sizechart_id', $rowData->getEntityId()); // fix conflict entity_id in product condition
}
}
$this->coreRegistry->register('row_data', $rowData);
$resultPage = $this->resultFactory->create(ResultFactory::TYPE_PAGE);
$title = $rowId ? __('Edit Size chart') . $rowTitle : __('Add Size chart');
$resultPage->getConfig()->getTitle()->prepend($title);
return $resultPage;
}
}
\ No newline at end of file
<?php
namespace Magepow\Sizechart\Controller\Adminhtml\Sizechart;
class Index extends \Magento\Backend\App\Action
{
protected $resultPageFactory = false;
public function __construct(
\Magento\Backend\App\Action\Context $context,
\Magento\Framework\View\Result\PageFactory $resultPageFactory
) {
parent::__construct($context);
$this->resultPageFactory = $resultPageFactory;
}
public function execute()
{
$resultPage = $this->resultPageFactory->create();
$resultPage->getConfig()->getTitle()->prepend((__('Size Chart')));
return $resultPage;
}
}
\ No newline at end of file
<?php
namespace Magepow\Sizechart\Controller\Adminhtml\Sizechart;
use Magento\Framework\Controller\ResultFactory;
use Magento\Backend\App\Action\Context;
use Magento\Ui\Component\MassAction\Filter;
use Magepow\Sizechart\Model\ResourceModel\Sizechart\CollectionFactory;
class MassDelete extends \Magento\Backend\App\Action
{
/**
* Massactions filter.
* @var Filter
*/
protected $_filter;
/**
* @var CollectionFactory
*/
protected $_collectionFactory;
public function __construct(
Context $context,
Filter $filter,
CollectionFactory $collectionFactory
) {
$this->_filter = $filter;
$this->_collectionFactory = $collectionFactory;
parent::__construct($context);
}
public function execute()
{
$collection = $this->_filter->getCollection($this->_collectionFactory->create());
$recordDeleted = 0;
foreach ($collection->getItems() as $record) {
$record->setId($record->getEntityId());
$record->delete();
$recordDeleted++;
}
$this->messageManager->addSuccess(__(
'A total of %1 record(s) have been deleted.',
$recordDeleted
));
return $this->resultFactory->create(ResultFactory::TYPE_REDIRECT)->setPath('*/*/index');
}
protected function _isAllowed()
{
return $this->_authorization->isAllowed('Magepow_Sizechart::row_data_delete');
}
}
\ No newline at end of file
<?php
namespace Magepow\Sizechart\Controller\Adminhtml\Sizechart;
class Save extends \Magento\Backend\App\Action
{
protected $_sizechartFactory;
public function __construct(
\Magento\Backend\App\Action\Context $context,
\Magepow\Sizechart\Model\SizechartFactory $sizechartFactory
) {
parent::__construct($context);
$this->_sizechartFactory = $sizechartFactory;
}
public function serialize($data)
{
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$serializer = $objectManager->create(\Magento\Framework\Serialize\SerializerInterface::class);
return $serializer->serialize($data);
}
public function execute()
{
$resultRedirect = $this->resultRedirectFactory->create();
// check if data sent
$data = $this->getRequest()->getPostValue();
if ($data) {
$id = $this->getRequest()->getParam('sizechart_id');
if ($id) $data['entity_id'] = $id; // fix conflict entity_id in product condition
$model = $this->_sizechartFactory->create();
$storeViewId = $this->getRequest()->getParam('stores');
$model->load($id);
if (!$model->getId() && $id) {
$this->messageManager->addError(__('This item no longer exists.'));
return $resultRedirect->setPath('*/*/');
}
//$data['conditions_serialized'] = $this->serialize(['parameters' => $data['parameters']]);
if (isset($data['custom_size'])) {
$data['custom_size'] = json_encode($data['custom_size'], true);
}
if (isset($data['stores'])) $data['stores'] = implode(',', $data['stores']);
$model->setData($data)->setStoreViewId($storeViewId);;
// try to save it
try {
$model->save();
// display success message
$this->messageManager->addSuccess(__('You saved the item.'));
if ($this->getRequest()->getParam('back')) {
$this->_redirect('*/*/addrow', ['id' => $model->getId(), '_current' => true]);
return;
}
// go to grid
return $resultRedirect->setPath('*/*/index');
} catch (\Exception $e) {
// display error message
$this->messageManager->addError($e->getMessage());
// save data in session
$this->_objectManager->get('Magento\Backend\Model\Session')->setFormData($data);
// redirect to edit form
return $resultRedirect->setPath('*/*/addrow', ['id' => $this->getRequest()->getParam('id')]);
}
}
return $resultRedirect->setPath('*/*/index');
}
}
\ No newline at end of file
<?php
namespace Magepow\Sizechart\Controller\Index;
class Index extends \Magento\Framework\App\Action\Action
{
protected $_pageFactory;
protected $_sizechartFactory;
public function __construct(
\Magento\Framework\App\Action\Context $context,
\Magento\Framework\View\Result\PageFactory $pageFactory,
\Magepow\Sizechart\Model\SizechartFactory $sizechartFactory
) {
$this->_pageFactory = $pageFactory;
$this->_sizechartFactory = $sizechartFactory;
return parent::__construct($context);
}
public function execute()
{
$page = $this->_pageFactory->create();
$pageFactory = $page->getLayout()->getBlock('Magepow\Sizechart\Block\Product\Sizechart');
//We are using HTTP headers to control various page caches (varnish, fastly, built-in php cache)
$pageFactory->setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, max-age=0', true);
return $pageFactory;
}
}
\ No newline at end of file
<?php
namespace Magepow\Sizechart\Helper;
class Cache extends \Magento\Framework\App\Helper\AbstractHelper
{
protected $cacheTypeList;
protected $cacheFrontendPool;
/**
* Cache constructor.
* @param \Magento\Framework\App\Helper\Context $context
* @param \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList
* @param \Magento\Framework\App\Cache\Frontend\Pool $cacheFrontendPool
*/
public function __construct(
\Magento\Framework\App\Helper\Context $context,
\Magento\Framework\App\Cache\TypeListInterface $cacheTypeList,
\Magento\Framework\App\Cache\Frontend\Pool $cacheFrontendPool
) {
parent::__construct($context);
$this->cacheTypeList = $cacheTypeList;
$this->cacheFrontendPool = $cacheFrontendPool;
}
/**
*
* Flush Cache Action
*
*/
public function flushCache()
{
$types = [
'config',
'layout',
'block_html',
'collections',
'reflection',
'db_ddl',
'eav',
'config_integration',
'config_integration_api',
'full_page',
'translate',
'config_webservice'
];
foreach ($types as $type) {
$this->cacheTypeList->cleanType($type);
}
foreach ($this->cacheFrontendPool as $cacheFrontend) {
$cacheFrontend->getBackend()->clean();
}
}
}
\ No newline at end of file
<?php
namespace Magepow\Sizechart\Helper;
use Magento\Framework\App\Helper\AbstractHelper;
use Magento\Store\Model\ScopeInterface;
class Data extends AbstractHelper
{
protected $configModule;
protected $_moduleManager;
public function __construct(
\Magento\Framework\App\Helper\Context $context,
\Magento\Framework\Module\Manager $moduleManager
) {
parent::__construct($context);
$this->configModule = $this->getConfig(strtolower($this->_getModuleName()));
$this->_moduleManager = $moduleManager;
}
public function getConfig($cfg = '')
{
if ($cfg) return $this->scopeConfig->getValue($cfg, \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
return $this->scopeConfig;
}
public function getConfigModule($cfg = '', $value = null)
{
$values = $this->configModule;
if (!$cfg) return $values;
$config = explode('/', (string) $cfg);
$end = count($config) - 1;
foreach ($config as $key => $vl) {
if (isset($values[$vl])) {
if ($key == $end) {
$value = $values[$vl];
} else {
$values = $values[$vl];
}
}
}
return $value;
}
public function isModuleEnabled($moduleName)
{
return $this->_moduleManager->isEnabled($moduleName);
}
}
\ No newline at end of file
<?php
namespace Magepow\Sizechart\Model;
use Magento\Backend\App\Action\Context;
use Magento\Backend\App\Action;
use Magento\Framework\App\Cache\Manager as CacheManager;
use Magento\Framework\App\Cache\TypeListInterface as CacheTypeListInterface;
class Cron
{
public function __construct(
\Magento\Framework\Model\Context $context,
\Magento\Framework\App\Cache\TypeListInterface $cacheTypeList,
\Magento\Framework\App\Cache\Frontend\Pool $cacheFrontendPool
) {
$this->_cacheTypeList = $cacheTypeList;
$this->_cacheFrontendPool = $cacheFrontendPool;
}
public function flushCache()
{
$types = [
'config',
'layout',
'block_html',
'collections',
'reflection',
'db_ddl',
'eav',
'config_integration',
'config_integration_api',
'full_page',
'translate',
'config_webservice'
];
foreach ($types as $type) {
$this->cacheTypeList->cleanType($type);
}
foreach ($this->cacheFrontendPool as $cacheFrontend) {
$cacheFrontend->getBackend()->clean();
}
}
}
\ No newline at end of file
<?php
namespace Magepow\Sizechart\Model\ResourceModel;
class Sizechart extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
{
public function __construct(
\Magento\Framework\Model\ResourceModel\Db\Context $context
) {
parent::__construct($context);
}
protected function _construct()
{
$this->_init('sizechart_management', 'entity_id');
}
}
\ No newline at end of file
<?php
namespace Magepow\Sizechart\Model\ResourceModel\Sizechart;
class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
{
protected $_idFieldName = 'entity_id';
/**
* Define resource model
*
* @return void
*/
protected function _construct()
{
$this->_init(
'Magepow\Sizechart\Model\Sizechart',
'Magepow\Sizechart\Model\ResourceModel\Sizechart'
);
}
}
\ No newline at end of file
<?php
namespace Magepow\Sizechart\Model;
use Magepow\Sizechart\Api\Data\SizechartInterface;
class Sizechart extends \Magento\Framework\Model\AbstractModel implements SizechartInterface
{
const CACHE_TAG = 'sizechart_management';
protected $_cacheTag = 'sizechart_management';
protected $_eventPrefix = 'sizechart_management';
protected function _construct()
{
$this->_init('Magepow\Sizechart\Model\ResourceModel\Sizechart');
}
public function getIdentities()
{
return [self::CACHE_TAG . '_' . $this->getId()];
}
public function getDefaultValues()
{
$values = [];
return $values;
}
public function getEntityId()
{
return $this->getData(self::ENTITY_ID);
}
public function setEntityId($entityId)
{
return $this->setData(self::ENTITY_ID, $entityId);
}
public function getCategoryId()
{
return $this->getData(self::CATEGORY_ID);
}
public function setCategoryId($categoryId)
{
return $this->setData(self::CATEGORY_ID, $categoryId);
}
public function getSubCategoryId()
{
return $this->getData(self::SUB_CATEGORY_ID);
}
public function setSubCategoryId($subCategoryId)
{
return $this->setData(self::SUB_CATEGORY_ID, $subCategoryId);
}
public function getTypeDisplay()
{
return $this->getData(self::TYPE_DISPLAY);
}
public function setTypeDisplay($typeDisplay)
{
return $this->setData(self::TYPE_DISPLAY, $typeDisplay);
}
public function getDescription()
{
return $this->getData(self::DESCRIPTION);
}
public function setDescription($description)
{
return $this->setData(self::DESCRIPTION, $description);
}
public function getSizeChartInfo()
{
return $this->getData(self::SIZECHART_INFO);
}
public function setSizeChartInfo($sizeChartInfo)
{
return $this->setData(self::SIZECHART_INFO, $sizeChartInfo);
}
public function getUpdatedAt()
{
return $this->getData(self::UPDATED_AT);
}
public function setUpdatedAt($updatedAt)
{
return $this->setData(self::UPDATED_AT, $updatedAt);
}
public function getCreatedAt()
{
return $this->getData(self::CREATED_AT);
}
public function setCreatedAt($createdAt)
{
return $this->setData(self::CREATED_AT, $createdAt);
}
public function getIsActive()
{
return $this->getData(self::IS_ACTIVE);
}
public function setIsActive($isActive)
{
return $this->setData(self::IS_ACTIVE, $isActive);
}
public function getTemplateCss()
{
return $this->getData(self::TEMPLATE_CSS);
}
public function setTemplateCss($templateCss)
{
return $this->setData(self::TEMPLATE_CSS, $templateCss);
}
public function getConditions()
{
return $this->getData(self::CONDITIONS);
}
public function setConditions($conditions)
{
return $this->setData(self::CONDITIONS, $conditions);
}
public function getStoreView()
{
return $this->getData(self::STORES);
}
public function setStoreView($stores)
{
return $this->setData(self::STORES, $stores);
}
}
\ No newline at end of file
<?php
namespace Magepow\Sizechart\Model;
use Magento\Framework\Data\OptionSourceInterface;
class Status implements OptionSourceInterface
{
public function getOptionArray()
{
$options = ['1' => __('Enabled'), '0' => __('Disabled')];
return $options;
}
/**
* Get Grid row status labels array with empty value for option element.
*
* @return array
*/
public function getAllOptions()
{
$res = $this->getOptions();
array_unshift($res, ['value' => '', 'label' => '']);
return $res;
}
/**
* Get Grid row type array for option element.
* @return array
*/
public function getOptions()
{
$res = [];
foreach ($this->getOptionArray() as $index => $value) {
$res[] = ['value' => $index, 'label' => $value];
}
return $res;
}
/**
* {@inheritdoc}
*/
public function toOptionArray()
{
return $this->getOptions();
}
}
\ No newline at end of file
<?php
namespace Magepow\Sizechart\Model;
use Magento\Framework\Data\OptionSourceInterface;
class TypeDisplay implements OptionSourceInterface
{
public function getOptionArray()
{
$options = ['1' => __('Inline'), '2' => __('Pop Up'), '3' => __('Custom Tab')];
return $options;
}
/**
* Get Grid row status labels array with empty value for option element.
*
* @return array
*/
public function getAllOptions()
{
$res = $this->getOptions();
array_unshift($res, ['value' => '', 'label' => '']);
return $res;
}
/**
* Get Grid row type array for option element.
* @return array
*/
public function getOptions()
{
$res = [];
foreach ($this->getOptionArray() as $index => $value) {
$res[] = ['value' => $index, 'label' => $value];
}
return $res;
}
/**
* {@inheritdoc}
*/
public function toOptionArray()
{
return $this->getOptions();
}
}
\ No newline at end of file
[<img src="https://github.com/magepow/themeforest/blob/master/shopify/shopify_affiliate.jpg" >](https://shopify.pxf.io/VyL446)
## Magento 2 Size Chart
Magento 2 Sizechart is a module allows admin to show their size chart diagram below product images on product page which helps customers choose the most suitable size for them.
Displaying exact product sizes on the website makes it easy for customers to choose the right product for their needs.
Product size will vary depending on the brand, each country. Therefore, adding a product-specific size chart on your e-commerce website is essential.
### Benefits
- Create size chart according to product characteristics: clothes, shoes, electronic devices, furniture, accessories...
- Show size chart inline, custom tab, popup.
- Add linked text, images or labels.
- Save time for the project
- Apply precedence rule to size chart
- Manage size rules in the backend
- Avoid customers returning products due to size problems
- Works well on mobile devices
## How does Site Chart work for Magento
- Detail Description: [Magento 2 Size Chart](https://magepow.com/magento-2-size-chart.html)
- [DOCUMENTATION](https://docs.magepow.com/sizechart/)
[![Latest Stable Version](https://poser.pugx.org/magepow/sizechart/v/stable)](https://packagist.org/packages/magepow/sizechart)
[![Total Downloads](https://poser.pugx.org/magepow/sizechart/downloads)](https://packagist.org/packages/magepow/sizechart)
[![Daily Downloads](https://poser.pugx.org/magepow/sizechart/d/daily)](https://packagist.org/packages/magepow/sizechart)
## Download Magento 2 Sizechart Extension
### Install via composer (recommend)
Run the following commands in Magento 2 root folder:
```
composer require magepow/sizechart
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy -f
```
## Step 2: How to use Magento 2 Sizechart?
### 1. General configuration
Login to magento admin, choose `stores->configuration->magepow->Sizechart`
![Image of magento admin config](https://github.com/magepow/magento2-sizechart/blob/master/media/config.png)
Select `yes` to enable the module
### 2. Details Configuration
In `stores->configuration->magepow->sizechart` we set:
* Display text link : Show text link if user sets popup for displaying size chart.
* Image icon : Select image icon (only using when user sets popup for displaying size chart)
![Image of magento backend](https://github.com/magepow/magento2-sizechart/blob/master/media/config-popup.png)
### 3. Add Sizechart
Choose `Magepow->Size chart Management->Add New Size Chart Rule`.
![Image of magento backend](https://github.com/magepow/magento2-sizechart/blob/master/media/add-content1.png)
![Image of magento backend](https://github.com/magepow/magento2-sizechart/blob/master/media/add-content2.png)
![Image of magento backend](https://github.com/magepow/magento2-sizechart/blob/master/media/add-content3.png)
* Name: Name of your size chart management rule
* Store View : Define which store view you wish to show
* Description : Introduce about your size chart
* Size chart Information : Details about your size chart : you can write your diagram, image as you want
* Sort order : This part is used for the priority. If there is any rule have the same information. then the one which lower number will have the higher priority.
* Type Display : You can choose 3 types of displaying included: Inline, Custom Tab, Popup.
* Status: Select Enable/Disable for turning on/off the size chart rule.
### 4. Edit Sizechart
![Image of magento backend](https://github.com/magepow/magento2-sizechart/blob/master/media/edit.png)
### 5. Delete Sizechart
![Image of magento backend](https://github.com/magepow/magento2-sizechart/blob/master/media/delete.png)
### 6. Product Rule
Choose `Magepow->Size chart Management->Add New Size Chart Rule` and set number for sort order
This part is used for the priority of size chart. The rule on this part will be prioritized to show. This is for prevent the conflict when multiple rule are applied on one product or rally of products.
Run the following command:
```
php bin/magento cache:clean
```
### 3. Result
![Image of magento store front](https://github.com/magepow/magento2-sizechart/blob/master/media/result.png)
## Donation
If this project help you reduce time to develop, you can give me a cup of coffee :)
[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/paypalme/alopay)
**[Our Magento 2 Extensions](https://magepow.com/magento-2-extensions.html)**
* [Magento 2 Recent Sales Notification](https://magepow.com/magento-2-recent-order-notification.html)
* [Magento 2 Categories Extension](https://magepow.com/magento-categories-extension.html)
* [Magento 2 Sticky Cart](https://magepow.com/magento-sticky-cart.html)
* [Magento 2 Ajax Contact](https://magepow.com/magento-ajax-contact-form.html)
* [Magento 2 Lazy Load](https://magepow.com/magento-lazy-load.html)
* [Magento 2 Mutil Translate](https://magepow.com/magento-multi-translate.html)
* [Magento 2 Instagram Integration](https://magepow.com/magento-2-instagram.html)
* [Magento 2 Lookbook Pin Products](https://magepow.com/lookbook-pin-products.html)
* [Magento 2 Product Slider](https://magepow.com/magento-product-slider.html)
* [Magento 2 Product Banner](https://magepow.com/magento-2-banner-slider.html)
**[Our Magento 2 services](https://magepow.com/magento-services.html)**
* [PSD to Magento 2 Theme Conversion](https://alothemes.com/psd-to-magento-theme-conversion.html)
* [Magento 2 Speed Optimization Service](https://magepow.com/magento-speed-optimization-service.html)
* [Magento 2 Security Patch Installation](https://magepow.com/magento-security-patch-installation.html)
* [Magento 2 Website Maintenance Service](https://magepow.com/website-maintenance-service.html)
* [Magento 2 Professional Installation Service](https://magepow.com/professional-installation-service.html)
* [Magento 2 Upgrade Service](https://magepow.com/magento-upgrade-service.html)
* [Magento 2 Customization Service](https://magepow.com/customization-service.html)
* [Hire Magento 2 Developer](https://magepow.com/hire-magento-developer.html)
**[Our Magento 2 Themes](https://alothemes.com/)**
* [Expert Multipurpose Responsive Magento 2 Theme](https://1.envato.market/c/1314680/275988/4415?u=https://themeforest.net/item/expert-premium-responsive-magento-2-and-1-support-rtl-magento-2-/21667789)
* [Gecko Premium Responsive Magento 2 Theme](https://1.envato.market/c/1314680/275988/4415?u=https://themeforest.net/item/gecko-responsive-magento-2-theme-rtl-supported/24677410)
* [Milano Fashion Responsive Magento 2 Theme](https://1.envato.market/c/1314680/275988/4415?u=https://themeforest.net/item/milano-fashion-responsive-magento-1-2-theme/12141971)
* [Electro 2 Responsive Magento 2 Theme](https://1.envato.market/c/1314680/275988/4415?u=https://themeforest.net/item/electro2-premium-responsive-magento-2-rtl-supported/26875864)
* [Electro Responsive Magento 2 Theme](https://1.envato.market/c/1314680/275988/4415?u=https://themeforest.net/item/electro-responsive-magento-1-2-theme/17042067)
* [Pizzaro Food responsive Magento 2 Theme](https://1.envato.market/c/1314680/275988/4415?u=https://themeforest.net/item/pizzaro-food-responsive-magento-1-2-theme/19438157)
* [Biolife organic responsive Magento 2 Theme](https://1.envato.market/c/1314680/275988/4415?u=https://themeforest.net/item/biolife-organic-food-magento-2-theme-rtl-supported/25712510)
* [Market responsive Magento 2 Theme](https://1.envato.market/c/1314680/275988/4415?u=https://themeforest.net/item/market-responsive-magento-2-theme/22997928)
* [Kuteshop responsive Magento 2 Theme](https://1.envato.market/c/1314680/275988/4415?u=https://themeforest.net/item/kuteshop-multipurpose-responsive-magento-1-2-theme/12985435)
* [Bencher - Responsive Magento 2 Theme](https://1.envato.market/c/1314680/275988/4415?u=https://themeforest.net/item/bencher-responsive-magento-1-2-theme/15787772)
* [Supermarket Responsive Magento 2 Theme](https://1.envato.market/c/1314680/275988/4415?u=https://themeforest.net/item/supermarket-responsive-magento-1-2-theme/18447995)
**[Our Shopify Themes](https://themeforest.net/user/alotheme)**
* [Dukamarket - Multipurpose Shopify Theme](https://1.envato.market/c/1314680/275988/4415?u=https://themeforest.net/item/dukamarket-multipurpose-shopify-theme/36158349)
* [Ohey - Multipurpose Shopify Theme](https://1.envato.market/c/1314680/275988/4415?u=https://themeforest.net/item/ohey-multipurpose-shopify-theme/34624195)
* [Flexon - Multipurpose Shopify Theme](https://1.envato.market/c/1314680/275988/4415?u=https://themeforest.net/item/flexon-multipurpose-shopify-theme/33461048)
**[Our Shopify App](https://apps.shopify.com/partners/maggicart)**
* [Magepow Infinite Scroll](https://apps.shopify.com/magepow-infinite-scroll)
* [Magepow Promotionbar](https://apps.shopify.com/magepow-promotionbar)
* [Magepow Size Chart](https://apps.shopify.com/magepow-size-chart)
**[Our WordPress Theme](https://themeforest.net/user/alotheme/portfolio)**
* [SadesMarket - Multipurpose WordPress Theme](https://1.envato.market/c/1314680/275988/4415?u=https://themeforest.net/item/sadesmarket-multipurpose-wordpress-theme/35369933)
<?php
namespace Magepow\Sizechart\Serialize\Serializer;
class Json extends \Magento\Framework\Serialize\Serializer\Json
{
public function unserialize($string)
{
if ($this->is_serialized($string)) {
$string = $this->serialize($string);
}
$result = json_decode($string, true);
if (json_last_error() !== JSON_ERROR_NONE) {
throw new \InvalidArgumentException('Unable to unserialize value.');
}
return $result;
}
function is_serialized($value, &$result = null)
{
// Bit of a give away this one
if (!is_string($value)) {
return false;
}
// Serialized false, return true. unserialize() returns false on an
// invalid string or it could return false if the string is serialized
// false, eliminate that possibility.
if ($value === 'b:0;') {
$result = false;
return true;
}
$length = strlen($value);
$end = '';
switch ($value[0]) {
case 's':
if ($value[$length - 2] !== '"') {
return false;
}
case 'b':
case 'i':
case 'd':
// This looks odd but it is quicker than isset()ing
$end .= ';';
case 'a':
case 'O':
$end .= '}';
if ($value[1] !== ':') {
return false;
}
switch ($value[2]) {
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
break;
default:
return false;
}
case 'N':
$end .= ';';
if ($value[$length - 1] !== $end[0]) {
return false;
}
break;
default:
return false;
}
if (($result = json_decode($value)) === false) {
$result = null;
return false;
}
return true;
}
}
\ No newline at end of file
<?php
namespace Magepow\Sizechart\Setup;
use Magento\Framework\DB\Ddl\Table;
use Magento\Framework\DB\Adapter\AdapterInterface;
use Magento\Framework\Setup\InstallSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
class InstallSchema implements InstallSchemaInterface
{
public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$installer = $setup;
$installer->startSetup();
if (!$installer->tableExists('sizechart_management')) {
$table = $installer->getConnection()
->newTable($installer->getTable('sizechart_management'));
$table->addColumn(
'entity_id',
Table::TYPE_INTEGER,
null,
[
'identity' => true,
'unsigned' => true,
'nullable' => false,
'primary' => true
],
'ENTITY ID'
)->addColumn(
'name',
Table::TYPE_TEXT,
'2M',
[],
'Name'
)
->addColumn(
'category',
Table::TYPE_TEXT,
null,
[],
'category'
)
->addColumn(
'type_display',
Table::TYPE_INTEGER,
null,
['nullable' => false, 'default' => 1],
'Size chart size display'
)
->addColumn(
'is_active',
Table::TYPE_INTEGER,
null,
[
'nullable' => false,
'default' => '1',
],
'Is Active status'
)
->addColumn(
'description',
Table::TYPE_TEXT,
'64k',
[],
'Description'
)
->addColumn(
'sizechart_info',
Table::TYPE_TEXT,
'2M',
[],
'Size Chart Information'
)->addColumn(
'conditions_serialized',
Table::TYPE_TEXT,
'2M',
[],
'Conditions Serialized'
)
->addColumn(
'sort_order',
Table::TYPE_INTEGER,
null,
['nullable' => false, 'default' => '0'],
'Sort Order'
)
->addColumn(
'updated_at',
\Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
null,
['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE],
'Updated At'
)
->addColumn(
'created_at',
\Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
null,
['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT],
'Creation Time'
);
$installer->getConnection()->createTable($table);
$installer->getConnection()->addIndex(
$installer->getTable('sizechart_management'),
$setup->getIdxName(
$installer->getTable('sizechart_management'),
['name', 'description', 'sizechart_info'],
\Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_FULLTEXT
),
['name', 'description', 'sizechart_info'],
\Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_FULLTEXT
);
}
$installer->endSetup();
}
}
\ No newline at end of file
<?php
namespace Magepow\Sizechart\Setup;
use Magento\Framework\Setup\UpgradeSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
use Magento\Framework\DB\Ddl\Table;
class UpgradeSchema implements UpgradeSchemaInterface
{
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$setup->startSetup();
$tableName = $setup->getTable('sizechart_management');
if (version_compare($context->getVersion(), '2.0.0', '<')) {
if ($setup->getConnection()->isTableExists($tableName) == true) {
$connection = $setup->getConnection();
$connection->addColumn(
$setup->getTable($tableName),
'template_css',
[
'type' => Table::TYPE_TEXT,
'length' => '2M',
'nullable' => true,
'comment' => 'template css'
]
);
}
}
if (version_compare($context->getVersion(), '2.3.0', '<')) {
if ($setup->getConnection()->isTableExists($tableName) == true) {
$connection = $setup->getConnection();
$connection->addColumn(
$setup->getTable($tableName),
'stores',
[
'type' => Table::TYPE_TEXT,
'length' => '2M',
'nullable' => false,
'comment' => 'Store Views'
]
);
}
}
if (version_compare($context->getVersion(), '2.5.2', '<')) {
if ($setup->getConnection()->isTableExists($tableName) == true) {
$connection = $setup->getConnection();
$connection->addColumn(
$setup->getTable($tableName),
'custom_size',
[
'type' => Table::TYPE_TEXT,
'nullable' => false,
'comment' => 'custom size'
]
);
$connection->addColumn(
$setup->getTable($tableName),
'column_label',
[
'type' => Table::TYPE_TEXT,
'nullable' => false,
'comment' => 'column label'
]
);
}
}
}
}
\ No newline at end of file
<?php
namespace Magepow\Sizechart\Ui\Component\Listing\Sizechart\Column;
use Magento\Framework\View\Element\UiComponent\ContextInterface;
use Magento\Framework\View\Element\UiComponentFactory;
use Magento\Ui\Component\Listing\Columns\Column;
use Magento\Framework\UrlInterface;
class Action extends Column
{
/** Url path */
const ROW_EDIT_URL = 'magepow_sizechart/sizechart/addrow';
/** @var UrlInterface */
protected $_urlBuilder;
/**
* @var string
*/
private $_editUrl;
/**
* @param ContextInterface $context
* @param UiComponentFactory $uiComponentFactory
* @param UrlInterface $urlBuilder
* @param array $components
* @param array $data
* @param string $editUrl
*/
public function __construct(
ContextInterface $context,
UiComponentFactory $uiComponentFactory,
UrlInterface $urlBuilder,
array $components = [],
array $data = [],
$editUrl = self::ROW_EDIT_URL
) {
$this->_urlBuilder = $urlBuilder;
$this->_editUrl = $editUrl;
parent::__construct($context, $uiComponentFactory, $components, $data);
}
/**
* Prepare Data Source.
*
* @param array $dataSource
*
* @return array
*/
public function prepareDataSource(array $dataSource)
{
if (isset($dataSource['data']['items'])) {
foreach ($dataSource['data']['items'] as &$item) {
$name = $this->getData('name');
if (isset($item['entity_id'])) {
$item[$name]['edit'] = [
'href' => $this->_urlBuilder->getUrl(
$this->_editUrl,
['id' => $item['entity_id']]
),
'label' => __('Edit'),
];
}
}
}
return $dataSource;
}
}
{
"name": "magepow/sizechart",
"description": "Size chart extension for Magento helps you create size charts for products on your website.",
"require": {
"magepow/core": "^1.0.0"
},
"type": "magento2-module",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"authors": [
{
"name": "Magepow",
"email": "support@magepow.com",
"homepage": "https://magepow.com",
"role": "Technical Support"
}
],
"autoload": {
"files": [
"registration.php"
],
"psr-4": {
"Magepow\\Sizechart\\": ""
}
}
}
\ No newline at end of file
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
<acl>
<resources>
<resource id="Magento_Backend::admin">
<resource id="Magepow_Sizechart::magepow" title="Size Chart" sortOrder="10">
<resource id="Magepow_Sizechart::sizechart" title="Size Chart Management" sortOrder="50" />
</resource>
<resource id="Magento_Backend::stores">
<resource id="Magento_Backend::stores_settings">
<resource id="Magento_Config::config">
<resource id="Magepow_Sizechart::config" title="Size Chart"/>
</resource>
</resource>
</resource>
</resource>
</resources>
</acl>
</config>
\ No newline at end of file
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
<menu>
<update id="magepow" title="SizChart" module="Magepow_Sizechart" sortOrder="10" resource="Magepow_Sizechart::magepow" />
<add id="Magepow_Sizechart::magepow" title="Size Chart" module="Magepow_Sizechart" sortOrder="10" parent="magepow" resource="Magepow_Sizechart::magepow" />
<add id="Magepow_Sizechart::sizechart" title="Size Chart Management" module="Magepow_Sizechart" parent="Magepow_Sizechart::magepow" sortOrder="20" action="magepow_sizechart/sizechart" resource="Magepow_Sizechart::sizechart"/>
<add id="Magepow_Sizechart::config" title="Configuration" module="Magepow_Sizechart" parent="Magepow_Sizechart::magepow" sortOrder="30" action="adminhtml/system_config/edit/section/magepow_sizechart" resource="Magepow_Sizechart::sizechart_configuration"/>
</menu>
</config>
\ No newline at end of file
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="admin">
<route id="magepow_sizechart" frontName="magepow_sizechart">
<module name="Magepow_Sizechart"/>
</route>
</router>
</config>
\ No newline at end of file
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<section id="magepow_sizechart" translate="label" sortOrder="130" showInDefault="1" showInWebsite="1" showInStore="1">
<class>separator-top</class>
<label>Size Chart</label>
<tab>joshine</tab>
<resource>Magepow_Sizechart::config</resource>
<group id="general" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
<label><![CDATA[General]]></label>
<field id="enabled" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="1" canRestore="1">
<label>Module Enable</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="display_text" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="1" canRestore="1">
<label>Display Text Link</label>
<comment>This text will display the link for showing popup sizechart</comment>
<depends>
<field id="enabled">1</field>
</depends>
</field>
<field id="image_icon" translate="label" type="image" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1">
<label>Image Icon</label>
<comment>This section will display the icon for showing popup sizechart</comment>
<backend_model>Magento\Config\Model\Config\Backend\Image</backend_model>
<upload_dir config="system/filesystem/media" scope_info="1">magepow/sizechart</upload_dir>
<base_url type="media" scope_info="1">magepow/sizechart</base_url>
<depends>
<field id="enabled">1</field>
</depends>
</field>
</group>
</section>
</system>
</config>
\ No newline at end of file
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<magepow_sizechart>
<general>
<enabled>1</enabled>
<display_text>Size Chart</display_text>
</general>
</magepow_sizechart>
</default>
</config>
\ No newline at end of file
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
<preference for="Magepow\Sizechart\Api\Data\SizechartInterface" type="Magepow\Sizechart\Model\Sizechart" />
<preference for="Magento\Framework\Serialize\Serializer\Json" type="Magepow\Sizechart\Serialize\Serializer\Json" />
<type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
<arguments>
<argument name="collections" xsi:type="array">
<item name="magepow_sizechart_sizechart_listing_data_source" xsi:type="string">Magepow\Sizechart\Model\ResourceModel\Sizechart\Grid\Collection</item>
</argument>
</arguments>
</type>
<virtualType name="Magepow\Sizechart\Model\ResourceModel\Sizechart\Grid\Collection" type="Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult">
<arguments>
<argument name="mainTable" xsi:type="string">sizechart_management</argument>
<argument name="resourceModel" xsi:type="string">Magepow\Sizechart\Model\ResourceModel\Sizechart</argument>
</arguments>
</virtualType>
</config>
\ No newline at end of file
<?xml version="1.0"?>
<!--
/**
* Copyright © 2016 ExtensionsMall All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magepow_Sizechart" setup_version="2.5.2"/>
<sequence>
<module name="Magento_Catalog"/>
</sequence>
</config>
\ No newline at end of file
<?php
/**
* Copyright © 2016 ExtensionsMall. All rights reserved.
* See COPYING.txt for license details.
*/
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Magepow_Sizechart',
__DIR__
);
<?xml version="1.0"?>
<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>
<referenceContainer name="left">
<block class="Magepow\Sizechart\Block\Adminhtml\Sizechart\Edit\Tabs" name="tabs"/>
</referenceContainer>
<referenceContainer name="content">
<block class="Magepow\Sizechart\Block\Adminhtml\Sizechart\AddRow" name="add_row" />
</referenceContainer>
</body>
</page>
\ No newline at end of file
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<uiComponent name="magepow_sizechart_sizechart_listing"/>
</referenceContainer>
</body>
</page>
\ No newline at end of file
<?php
/**
* @var $block \Magepow\Sizechart\Block\Adminhtml\Sizechart\ChartTable
*/
?>
<div class="admin__control" id="content_single_field">
<input id="content" name="column_label" data-ui-id="adminhtml-sizechart-edit-tab-main-0-fieldset-element-text-name"
value="<?= $block->getCustomSizeData()['column_label'] ?? '' ?>" title="Name" class="required_entry input-text admin__control-text required-entry _required"
type="text" aria-required="true">
<p class="note">
<span>The sizechart table head</span>
<br>
<span id="comment"></span>
</p>
<input class="btn btn-info pull-left add-record" id="register" name="register" value="Add Data" type="button">
<input class="pull-right add-record" id="csvfile" name="csvfile" value="Add Data" type="file" style="display: none;">
</div>
<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">magepow_sizechart_sizechart_listing.magepow_sizechart_sizechart_listing_data_source</item>
<item name="deps" xsi:type="string">magepow_sizechart_sizechart_listing.magepow_sizechart_sizechart_listing_data_source</item>
</item>
<item name="spinner" xsi:type="string">spinner_columns</item>
<item name="buttons" xsi:type="array">
<item name="add" xsi:type="array">
<item name="name" xsi:type="string">add</item>
<item name="label" xsi:type="string" translate="true">Add New Size Chart Rule </item>
<item name="class" xsi:type="string">primary</item>
<item name="url" xsi:type="string">magepow_sizechart/sizechart/addrow</item>
</item>
</item>
</argument>
<dataSource name="magepow_sizechart_sizechart_listing_data_source">
<argument name="dataProvider" xsi:type="configurableObject">
<argument name="class" xsi:type="string">Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider</argument>
<argument name="name" xsi:type="string">magepow_sizechart_sizechart_listing_data_source</argument>
<argument name="primaryFieldName" xsi:type="string">entity_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" xsi:type="url" path="mui/index/render"/>
<item name="storageConfig" xsi:type="array">
<item name="indexField" xsi:type="string">entity_id</item>
</item>
</item>
</argument>
</argument>
</dataSource>
<listingToolbar name="listing_top">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="sticky" xsi:type="boolean">true</item>
</item>
</argument>
<bookmark name="bookmarks"/>
<columnsControls name="columns_controls"/>
<exportButton name="export_button"/>
<filters name="listing_filters" />
<filterSearch name="fulltext"/>
<massaction name="listing_massaction">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="component" xsi:type="string">Magento_Ui/js/grid/tree-massactions</item>
</item>
</argument>
<action name="delete">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="type" xsi:type="string">delete</item>
<item name="label" xsi:type="string" translate="true">Delete</item>
<item name="url" xsi:type="url" path="magepow_sizechart/sizechart/massdelete"/>
<item name="confirm" xsi:type="array">
<item name="title" xsi:type="string" translate="true">Delete Size Chart Rule</item>
<item name="message" xsi:type="string" translate="true">Are you sure you want to delete selected items?</item>
</item>
</item>
</argument>
</action>
</massaction>
<paging name="listing_paging"/>
</listingToolbar>
<columns name="spinner_columns">
<selectionsColumn name="ids">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="resizeEnabled" xsi:type="boolean">false</item>
<item name="resizeDefaultWidth" xsi:type="string">55</item>
<item name="indexField" xsi:type="string">entity_id</item>
</item>
</argument>
</selectionsColumn>
<column name="entity_id">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="filter" xsi:type="string">textRange</item>
<item name="sorting" xsi:type="string">asc</item>
<item name="label" xsi:type="string" translate="true">ID</item>
</item>
</argument>
</column>
<column name="name">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="filter" xsi:type="string">textRange</item>
<item name="sorting" xsi:type="string">asc</item>
<item name="label" xsi:type="string" translate="true">Name</item>
</item>
</argument>
</column>
<column name="is_active" >
<argument name="data" xsi:type="array">
<item name="options" xsi:type="object">Magepow\Sizechart\Model\Status</item>
<item name="config" xsi:type="array">
<item name="filter" xsi:type="string">select</item>
<item name="component" xsi:type="string">Magento_Ui/js/grid/columns/select</item>
<item name="dataType" xsi:type="string">select</item>
<item name="label" xsi:type="string" translate="true">Is Active</item>
</item>
</argument>
</column>
<column name="created_at" class="Magento\Ui\Component\Listing\Columns\Date">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="filter" xsi:type="string">dateRange</item>
<item name="component" xsi:type="string">Magento_Ui/js/grid/columns/date</item>
<item name="dataType" xsi:type="string">date</item>
<item name="label" xsi:type="string" translate="true">Created</item>
</item>
</argument>
</column>
<actionsColumn name="actions" class = "Magepow\Sizechart\Ui\Component\Listing\Sizechart\Column\Action">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="resizeEnabled" xsi:type="boolean">false</item>
<item name="resizeDefaultWidth" xsi:type="string">107</item>
<item name="indexField" xsi:type="string">id</item>
</item>
</argument>
</actionsColumn>
</columns>
</listing>
\ No newline at end of file
......@@ -75,7 +75,136 @@
'description'
);
$chartBlock = $objectManager->create(\Magepow\Sizechart\Block\Product\Sizechart::class);
$sizeChart = $chartBlock->getSizeChart();
$chartTableArray = [];
$chartInfo = '';
$chartEnabled = 1;
$sizeDesc = '';
if ($sizeChart != null) {
$chartTable = $sizeChart->getData('custom_size');
$sizeDesc = $sizeChart->getData('description');
$chartTableArray = json_decode($chartTable, true);
$chartInfo = $sizeChart->getData('sizechart_info');
}
?>
#chart-image {
margin: 0 0 0 0;
border-collapse: collapse;
width: 30%;
float: left;
}
.swatch-attribute.size .swatch-attribute-selected-option{
font-size: .95rem !important;
}
#chart-details {
border-collapse: collapse;
width: 100%;
overflow: auto;
}
#chart-details .tbody .td:first-child {
font-weight: bold;
}
#fme_sizechart_table {
margin: 0 0 0 0;
border-collapse: collapse;
width: 100%;
}
#fme_sizechart_table_th {
background: #111;
border: 1px solid #111;
padding:8px 0;
color: #fff;
/*
font-weight: 600 !important;
*/
}
#fme_sizechart_table .td {
border: 1px solid #f8f8f8;
}
#fme_sizechart_table .td.bold {
/*
font-weight:600 !important;
*/
}
#fme_sizechart_table .th, .table .td {
font-size: .9rem;
padding: .33rem !important;
text-align: center;
}
#fme_sizechart_table .tr:nth-child(2n) {
background: #f8f8f8 ;
}
.scrollable_content {
width:100%;
overflow:auto;
}
@media only screen and (max-width:768px){
#chart-image {
margin: 0 0 0 0;
border-collapse: collapse;
width: 100%;
}
#chart-details {
margin: 0 0 0 0;
border-collapse: collapse;
width: 100%;
overflow: auto;
}
}
.sizechart_icon{
width: 30px;
display: inline-block;
margin-bottom: 0;
font-weight: normal;
text-align: center;
vertical-align: middle;
-ms-touch-action: manipulation;
touch-action: manipulation;
cursor: pointer;
background-image: none;
border: 1px solid transparent;
white-space: nowrap;
padding: 6px 12px;
font-size: 14px;
line-height: 1.42857143;
border-radius: 4px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.chart-details {
margin-top: 20px;
}
.chart-size-switch {
margin: 10px 10px 10px 0;
}
.chart-size-switch .chart-size-switch-item{
display: inline-block;
padding: 0 0.9rem;
line-height: 1.99rem;
height: 2rem;
border: 1px solid #f3f3f3;
color: #666;
cursor: pointer;
}
.chart-size-switch-item.-active {
background-color: #111;
color: white;
}
</style>
<script>
......@@ -171,23 +300,93 @@
}
return mobile_flag;
}
$('.chart-size-switch-item').click(function(data) {
if ($(this).hasClass('-active')) {
return;
}
var currentType = $('.chart-size-switch-item.-active').data('size-type');
$(this).addClass('-active').siblings().removeClass('-active');
var type = $(this).data('size-type');
var percent = 2.54;
if (currentType == type) {
return;
}
$.each($(".size-item"), function (x) {
var current = $(this).data('size-item-inc');
if (currentType == 'inc' && type == 'cm') {
var data = (current * percent - 0).toFixed(2);
} else {
var data = $(this).data('size-item-inc');
}
$(this).html(data);
});
});
$(document).ready(function () {
$('.chart-size-switch-item-cm').click();
});
});
</script>
<li class="lis" style="display: none;">
<section id="areaLayer" class="express-area-box">
<section id="areaLayer" style="z-index: 996;" class="express-area-box">
<article id="areaBox">
<ul class="remen" id="remen">
<li class="lastli lastli-left"></li>
<li class="lastli lastli-right" style="cursor:pointer">X</li>
</ul>
<div class="area-content">
<div id="size-chart" style="display: none;">
<div id="size-chart" style="display: none;padding: 1.6em;">
<?php if ($chartBlock->isEnabled() && (count($chartTableArray) > 1)): ?>
<h4 class="joshine-text-center">Size Guide</h4>
<div id="chart-details">
<div class="chart-size-switch ">
<input type="hidden" value="">
<span class="chart-size-switch-item chart-size-switch-item-cm" data-size-type="cm"><?= __('cm'); ?></span>
<span data-size-type="inc" class="chart-size-switch-item -active"><?= __('Inch'); ?></span>
</div>
<!--全局table已被污染,请使用div模拟表格-->
<div class="table" id="fme_sizechart_table" style="display: table;">
<div style="display: table-header-group;" class="thead">
<?php if(isset($chartTableArray[0])): ?>
<div id="fme_sizechart_table_th" class="tr" style="display: table-row;">
<?php foreach ($chartTableArray[0] as $head): ?>
<div style="display: table-cell;" class="th"><?= $head ?></div>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
<div style="display: table-row-group" class="tbody">
<?php if(isset($chartTableArray)): ?>
<?php foreach ($chartTableArray as $key => $body): ?>
<?php
if ($key == 0) {
continue;
}
?>
<div style="display: table-row" class="tr">
<?php foreach ($body as $key2 => $item): ?>
<div style="display: table-cell" class="td <?php if($key2 != 0) { echo 'size-item'; } ?> " data-size-item-inc="<?= $item ?>"><?= $item ?> </div>
<?php endforeach; ?>
</div>
<?php endforeach; ?>
<?php endif; ?>
</div>
</div>
</div>
<?php if($sizeDesc): ?>
<span class="size-desc"><?= $sizeDesc ?></span>
<?php endif; ?>
<?php echo $chartBlock->getContentFromStaticBlock($chartInfo);?>
<?php else: ?>
<?php
$productCharTemplate = $block->getProduct()->getAttributeText("sizeTemplate");
if (empty($block->getProduct()->getAttributeText("sizeTemplate"))){
$productCharTemplate = "product-size-chart-default";
}
echo $block->getLayout()->createBlock('Magento\Cms\Block\Block')->setBlockId($productCharTemplate)->toHtml();?>
echo $block->getLayout()->createBlock('Magento\Cms\Block\Block')->setBlockId($productCharTemplate)->toHtml();
?>
<? endif; ?>
</div>
<div id="free-return" style="display: none;">
<?php echo $block->getLayout()->createBlock('Magento\Cms\Block\Block')->setBlockId('product-intro-free-return')->toHtml();?>
......@@ -209,11 +408,21 @@
<div id="areaMask" class="mask"></div>
</li>
<style>
.size-chart {
padding-right: 20px !important;
padding-left: 20px !important;
}
.size-desc {
font-size: .85em;
color: #9E9E9E;
display: inline-block;
margin-bottom: 1em;
}
#product-intro__freeshipping-more-3{
display: revert;
color: #2d68a;
float: right;
margin-top: 0px;
margin-top: 0;
font-size: .9em;
text-decoration: underline;
}
......@@ -242,13 +451,13 @@
height: auto;
background-color: #fff;
position: fixed;
left: 0px;
bottom: 0px;
left: 0;
bottom: 0;
z-index: 100;
padding: 5px;
display: list-item;
list-style: none;
box-shadow: 0px 0px 16px;
box-shadow: 0 0 16px;
}
.lastli-right{
width: 20%;
......
......@@ -18,40 +18,25 @@ $canApplyMsrp = $helper->isShowBeforeOrderConfirm($product) && $helper->isMinima
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$mobileDetect = $objectManager->get(\Joshine\Common\Lib\MobileDetect\MobileDetect::class);
$priceBlock = $objectManager->get(\Magento\Catalog\Block\Product\AbstractProduct::class);
$_options = $block->getOptionList();
$resource = $objectManager->get('Magento\Framework\App\ResourceConnection');
$connection = $resource->getConnection();
foreach ($_options as $key=>$_option) {
if ($_option['label'] != 'Size') {
$tableName = $resource->getTableName('eav_attribute_option_value');
$sql = "Select value FROM " . $tableName ." where store_id=0 AND option_id=".$_option['option_value'];
} else {
$tableName = $resource->getTableName('eav_attribute_option_swatch');
$sql = "Select value FROM " . $tableName ." where store_id=0 AND option_id=".$_option['option_value'];
}
$result = $connection->fetchRow($sql);
$_options[$key]['value'] = $result['value'];
}
?>
<div class="cart item is_mobile">
<div class="item-info">
<div class="item-info-left item-image">
<?php if ($block->hasProductUrl()) :?>
<a href="<?= $block->escapeUrl($block->getProductUrl()) ?>"
<a href="<?= $block->escapeUrl($block->getProductUrl()) ?>"
title="<?= $block->escapeHtml($block->getProductName()) ?>"
tabindex="-1"
class="product-item-photo">
<?php else :?>
<?php else :?>
<span class="product-item-photo">
<?php endif;?>
<?= $block->getImage($block->getProductForThumbnail(), 'cart_page_product_thumbnail')->toHtml() ?>
<?= $block->getImage($block->getProductForThumbnail(), 'cart_page_product_thumbnail')->toHtml() ?>
<?php if ($block->hasProductUrl()) :?>
</a>
<?php else :?>
</span>
<?php endif; ?>
</a>
<?php else :?>
</span>
<?php endif; ?>
</div>
<div class="item-info-right item-info-detail">
<!----------------------------item name start----------------------------------->
......@@ -66,18 +51,25 @@ foreach ($_options as $key=>$_option) {
</p>
<!----------------------------item name end------------------------------------->
<!----------------------------item option start--------------------------------->
<?php if ($_options) :?>
<?php if ($_options = $block->getOptionList()) :?>
<div class="item-options-meta">
<?php foreach ($_options as $key=>$_option) :?>
<strong style="font-weight: 600;margin-right: 10px;"><?= $block->escapeHtml($_option['label']) ?> :</strong>
<?php foreach ($_options as $_option) :?>
<span class="item-options-line">
<?= $block->escapeHtml($_option['value']) ?>
</span><br />
<?php $_formatedOptionValue = $block->getFormatedOptionValue($_option) ?>
<strong style="font-weight: 600;margin-right: 10px;"><?= $block->escapeHtml($_option['label']) ?>:</strong>
<?php if (isset($_formatedOptionValue['full_view'])) :?>
<?= $block->escapeHtml($_formatedOptionValue['full_view']) ?>
<?php else :?>
<?= $block->escapeHtml($_formatedOptionValue['value'], ['span', 'a']) ?>
<?php endif; ?>
</span><br />
<?php endforeach; ?>
</div>
<?php endif;?>
<div style="max-width: 100%;width: 100%;height: 40px;">
<!----------------------------item handle start--------------------------------->
<div class="item-handle" style="width: 16%;float:left;position: inherit;font-size: 16px;">
<div class="item-quantity">
......@@ -114,14 +106,14 @@ foreach ($_options as $key=>$_option) {
<!----------------------------item handle end----------------------------------->
<!----------------------------item option end----------------------------------->
<div style="float: right;padding-right: 15%;width: 40%;font-size: 18px;">
<?php if ($canApplyMsrp) :?>
<span class="cart msrp subtotal">--</span>
<?php else :?>
<?= $block->getRowTotalHtml($_item) ?>
<?php endif; ?>
</div>
<!----------------------------item option end----------------------------------->
<div style="float: right;padding-right: 15%;width: 40%;font-size: 18px;">
<?php if ($canApplyMsrp) :?>
<span class="cart msrp subtotal">--</span>
<?php else :?>
<?= $block->getRowTotalHtml($_item) ?>
<?php endif; ?>
</div>
</div>
</div>
</div>
......
......@@ -2,11 +2,6 @@
$copyrightBlock = $block->getLayout()->createBlock('Magento\Theme\Block\Html\Footer');
?>
<footer class="page-footer">
<div data-block-id="shopping_footer_why_choose_us">
<div class="choose-us">
<?= __("WHY CHOOSE US") ?>
</div>
<?php echo $block->getLayout()->createBlock('Magento\Cms\Block\Block')->setBlockId('why_choose_us')->toHtml();?>
<div class="footer-mini-copyright-content"><?= $block->escapeHtml($copyrightBlock->getCopyright()) ?></div>
</footer>
<script>
......
......@@ -7,10 +7,12 @@
<li id="shipping" class="checkout-shipping-address" data-bind="fadeVisible: visible()">
<!--<div class="step-title" translate="'Shipping Address'" data-role="title" />-->
<p class="step-title">
<!--
<span class="number">
<span translate="'1'" />
</span>
<span translate="'Delivery Details'" />
-->
<span translate="'Shipping address'" />
</p>
<div id="checkout-step-shipping"
class="step-content"
......
......@@ -12,12 +12,12 @@
}
</style>
<div class="authentication-wrapper" data-block="authentication" data-bind="visible: isActive()">
<span class="login-q-reg" data-bind="i18n: 'Already Registered?'"></span>
<span class="login-q-reg" data-bind="i18n: 'Already have an account?'"></span>
<button
type="button"
class="action action-auth-toggle"
data-trigger="authentication">
<span data-bind="i18n: 'Sign In'"></span>
<span data-bind="i18n: 'Log In'"></span>
</button>
<div class="block-authentication"
style="display: none"
......
......@@ -9,62 +9,73 @@
<!-- ko foreach: getRegion('before-login-form') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
<form class="form form-login" data-role="email-with-possible-login"
data-bind="submit:login"
method="post">
<fieldset id="customer-email-fieldset" class="fieldset" data-bind="blockLoader: isLoading">
<div class="field required">
<label class="label" for="customer-email" data-bind="css:{'fouse-label': email}">
<span data-bind="i18n: 'Email Address'"></span>
<!-- ko template: 'ui/form/element/helper/tooltip' --><!-- /ko -->
</label>
<div class="control _with-tooltip">
<input class="input-text"
type="email"
data-bind="
textInput: email,
hasFocus: emailFocused,
afterRender: emailHasChanged,
mageInit: {'mage/trim-input':{}},
css:{'virtual-email': quoteIsVirtual}"
name="username"
data-validate="{required:true, 'validate-email':true}"
id="customer-email" />
<div class="email-box address-one" data-bind="fadeVisible:visible">
<div class="label-title">
<span data-bind="i18n: 'Contact information'" class="contact-title"></span>
<!-- ko foreach: getRegion('authentication') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
<span class="note" data-bind="fadeVisible: isPasswordVisible() == false"><!-- ko i18n: 'You can create an account after checkout.'--><!-- /ko --></span>
</div>
</div>
</div>
<form class="form form-login" data-role="email-with-possible-login"
data-bind="submit:login"
method="post">
<fieldset id="customer-email-fieldset" class="fieldset" data-bind="blockLoader: isLoading">
<div class="field required">
<label class="label" for="customer-email" data-bind="css:{'fouse-label': email}">
<span data-bind="i18n: 'Email Address'"></span>
</label>
<!--Hidden fields -->
<fieldset class="fieldset hidden-fields" data-bind="fadeVisible: isPasswordVisible">
<div class="field">
<label class="label" for="customer-password"><span data-bind="i18n: 'Password'"></span></label>
<div class="control">
<div class="control _with-tooltip">
<input class="input-text"
type="password"
name="password"
id="customer-password"
data-validate="{required:true}" autocomplete="off"/>
<span class="note" data-bind="i18n: 'You already have an account with us. Sign in or continue as guest.'"></span>
</div>
type="email"
data-bind="
textInput: email,
hasFocus: emailFocused,
afterRender: emailHasChanged,
mageInit: {'mage/trim-input':{}},
css:{'virtual-email': quoteIsVirtual}"
name="username"
data-validate="{required:true, 'validate-email':true}"
id="customer-emails" />
</div>
<span class="note email-note" data-bind="fadeVisible: isPasswordVisible() == false"><!-- ko i18n: 'You can create an account after checkout.'--><!-- /ko --></span>
</div>
<!-- ko foreach: getRegion('additional-login-form-fields') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
<div class="actions-toolbar">
<input name="context" type="hidden" value="checkout" />
<div class="primary">
<button type="submit" class="action login primary" data-action="checkout-method-login"><span data-bind="i18n: 'Login'"></span></button>
<!--Hidden fields -->
<fieldset class="fieldset hidden-fields" data-bind="fadeVisible: isPasswordVisible">
<div class="field">
<label class="label" for="customer-password"><span data-bind="i18n: 'Password'"></span></label>
<div class="control">
<input class="input-text"
type="password"
name="password"
id="customer-password"
data-validate="{required:true}" autocomplete="off"/>
<span class="note" data-bind="i18n: 'You already have an account with us. Sign in or continue as guest.'"></span>
</div>
</div>
<div class="secondary">
<a class="action remind" data-bind="attr: { href: forgotPasswordUrl }">
<span data-bind="i18n: 'Forgot Your Password?'"></span>
</a>
<!-- ko foreach: getRegion('additional-login-form-fields') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
<div class="actions-toolbar">
<input name="context" type="hidden" value="checkout" />
<div class="primary">
<button type="submit" class="action login primary" data-action="checkout-method-login"><span data-bind="i18n: 'Login'"></span></button>
</div>
<div class="secondary">
<a class="action remind" data-bind="attr: { href: forgotPasswordUrl }">
<span data-bind="i18n: 'Forgot Your Password?'"></span>
</a>
</div>
</div>
</div>
</fieldset>
<!--Hidden fields -->
</fieldset>
<!--Hidden fields -->
</fieldset>
</form>
</form>
</div>
<!-- /ko -->
\ No newline at end of file
......@@ -4,46 +4,50 @@
* See COPYING.txt for license details.
*/
-->
<div class="right-fill"></div>
<div class="content content_wrapper">
<div class="trade_wrapper">
<div class="payment-left">
<!-- ko foreach: getRegion('progressBar') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
<div class="payment-left">
<!-- ko foreach: getRegion('progressBar') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
<!-- ko foreach: getRegion('authentication') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
<!-- ko foreach: getRegion('estimation') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
<!-- ko foreach: getRegion('messages') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
<div class="opc-wrapper">
<ol class="opc" id="checkoutSteps">
<!-- ko foreach: getRegion('steps') -->
<!-- ko foreach: getRegion('logo-nav') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
</ol>
</div>
</div>
<div class="payment-right">
<div class="slip-div">
<!-- ko foreach: getRegion('sidebar') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
<!-- ko foreach: getRegion('placeOrder') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
<!-- ko foreach: getRegion('security') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
<!-- ko foreach: getRegion('paypal') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
<!-- ko foreach: getRegion('customer-email') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
<!-- ko foreach: getRegion('messages') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
<div class="opc-wrapper">
<ol class="opc" id="checkoutSteps">
<!-- ko foreach: getRegion('steps') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
</ol>
</div>
<!-- ko foreach: getRegion('checkout-footer') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
</div>
<div class="payment-right">
<!-- ko ifnot: isMobile() -->
<!-- ko foreach: getRegion('sidebar') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
<!--/ko-->
</div>
</div>
</div>
......@@ -13,16 +13,18 @@
vertical-align: revert;
}
</style>
<li id="shipping" class="checkout-shipping-address" data-bind="fadeVisible: visible()">
<li id="shipping" class="checkout-shipping-address address-one" data-bind="fadeVisible: addressVisible" style="order:1;">
<!--<div class="step-title" translate="'Shipping Address'" data-role="title" />-->
<p class="step-title">
<!--
<span class="number">
<span translate="'1'" />
</span>
<span translate="'Delivery Details'" />
-->
<span translate="'Shipping address'" />
</p>
<div id="checkout-step-shipping"
class="step-content"
class="step-content address-one"
data-role="content" style="margin-bottom: 1rem;">
<each if="!quoteIsVirtual" args="getRegion('customer-email')" render="" />
......@@ -51,52 +53,82 @@
</div>
<div id="shipping-text">
<div class="confirmed-address">
<div class="main-address shipping-address">
</li>
<li style="order:2;" data-bind="fadeVisible: !addressVisible" class="payment-content">
<div class="trade_info-preview form-primary-text trade_info-preact-dom sl_section--normal show-text">
<div id="email-text" data-bind="fadeVisible: shippingVisible" class="checkout-top-page">
<div class="trade_info-preview-item mian-text-line">
<div class="trade_info-preview-item_content">
<span class="left-title left-email trade_info-preview-item_label">
<!-- ko i18n: 'Contact'--><!-- /ko -->
</span>
<div class="main-text main-email trade_info-preview-item_text">
</div>
</div>
<button class="right-handle right-email trade_info-preview-item_button custom-link-color">
<span data-bind="i18n: 'Modify'"></span>
</button>
</div>
</div>
</div>
<div class="billing-address-form">
<each args="getRegion('after-shipping-method-form')" render="" />
</div>
<div id="next-shipping">
<span><!-- ko i18n: 'Save & Continue'--><!-- /ko --></span>
</div>
<div id="edit-shipping" style="display:none;">
<a href="javascript:;" id="editLink" style="color:#000;">
<span><!-- ko i18n: 'Edit'--><!-- /ko --></span>
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24">
<path d="M19.769 9.923l-12.642 12.639-7.127 1.438 1.438-7.128 12.641-12.64 5.69 5.691zm1.414-1.414l2.817-2.82-5.691-5.689-2.816 2.817 5.69 5.692z"></path>
</svg>
</a>
</div>
<div id="shipping-text" data-bind="fadeVisible: shippingVisible" class="checkout-top-page">
<div class="trade_info-preview-item">
<div class="trade_info-preview-item_content">
<span class="left-title left-address trade_info-preview-item_label">
<!-- ko i18n: 'Ship to'--><!-- /ko -->
</span>
<div class="main-text main-address shipping-address trade_info-preview-item_text">
</div>
</div>
<button class="right-handle right-address trade_info-preview-item_button custom-link-color">
<span data-bind="i18n: 'Modify'"></span>
</button>
</div>
</li>
</div>
<div id="method-text" data-bind="fadeVisible: paymentVisible" class="checkout-top-page payment-three">
<div class="trade_info-preview-item">
<div class="trade_info-preview-item_content">
<span class="left-title left-method trade_info-preview-item_label">
<!-- ko i18n: 'Method'--><!-- /ko -->
</span>
<div class="main-text main-method trade_info-preview-item_text">
</div>
</div>
<button class="right-handle right-method trade_info-preview-item_button custom-link-color">
<span data-bind="i18n: 'Modify'"></span>
</button>
</div>
</div>
</div>
</li>
<!--Shipping method template-->
<li id="opc-shipping_method"
class="checkout-shipping-method"
data-bind="fadeVisible: visible(), blockLoader: isLoading"
role="presentation">
class="checkout-shipping-method shipping-two"
data-bind="fadeVisible: shippingVisible, blockLoader: isLoading"
role="presentation" style="order:3;">
<div class="checkout-shipping-method">
<!--<div class="step-title"
translate="'Shipping Methods'"
data-role="title" />-->
<p class="step-title no-border">
<span class="number">
<span translate="'2'" />
</span>
<!--
<span class="number">
<span translate="'2'" />
</span>
-->
<span translate="'Shipping Methods'" />
</p>
<each args="getRegion('before-shipping-method-form')" render="" />
<div id="checkout-step-shipping_method"
class="step-content"
class="step-content shipping-two"
data-role="content"
role="tabpanel"
aria-hidden="false">
aria-hidden="shippingVisible()">
<form id="co-shipping-method-form"
class="form methods-shipping"
if="rates().length"
......@@ -127,3 +159,45 @@
</div>
</div>
</li>
<li class="billing-address-li payment-three" data-bind="fadeVisible: paymentVisible" style="order:5;">
<div class="billing-address-form">
<each args="getRegion('after-shipping-method-form')" render="" />
</div>
</li>
<li class="handle-line" style="order:6;">
<div id="next-shipping">
<button class="handle-btn custom-link-color">
<span>
<span class="svg-left" >
<svg width="16" height="16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M8.003 8.483L4.52 5.436l-.988 1.128 4.465 3.907 4.512-3.904-.982-1.134-3.524 3.05z" fill="currentColor"></path>
</svg>
</span>
<span data-bind="click: backToCart,fadeVisible: addressVisible" class="address-one">
<!-- ko i18n: 'Return to cart'--><!-- /ko -->
</span>
<span data-bind="fadeVisible: shippingVisible" class="shipping-two back-to-information">
<!-- ko i18n: 'Return to Information'--><!-- /ko -->
</span>
<span data-bind="fadeVisible: paymentVisible" class="payment-three back-to-shipping">
<!-- ko i18n: 'Return to Shipping'--><!-- /ko -->
</span>
</span>
</button>
<span class="save-continue continue-shipping address-one" data-bind="fadeVisible: addressVisible"><!-- ko i18n: 'Continue to Shipping'--><!-- /ko --></span>
<span class="save-continue continue-payment shipping-two" data-bind="fadeVisible: shippingVisible"><!-- ko i18n: 'Continue to Payment'--><!-- /ko --></span>
<span class="save-continue complete-order payment-three " data-bind="fadeVisible: paymentVisible">
<span class="coBtn"><!-- ko i18n: 'Complete Order'--><!-- /ko --></span>
</span>
<span class="save-continue waitBtn" style="display: none;">
<span class="wait-loop"><!-- ko i18n: 'Please wait'--><!-- /ko --><div class="jkl"></div></span>
</span>
</div>
</li>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment