Commit 90c6d153 by lmf

Merge branch 'developer' into production

parents 81e51bfa 17d0c5f5
<?php
namespace Joshine\Review\Block;
use Joshine\Review\Model\ResourceModel\Images\Collection;
use Joshine\Review\Helper\ImageHelper;
use Magento\Framework\View\Element\Template;
use Joshine\Review\Model\ResourceModel\Images\CollectionFactory;
/**
* Class Images
* @package Amasty\AdvancedReview\Block
*/
class Images extends \Magento\Framework\View\Element\Template
{
//评论缩略图宽度
const REVIEW_COVER_WIDTH = 200;
/**
* @var string
*/
protected $_template = 'Joshine_Review::images.phtml';
private $reviewId;
private $productId;
/**
* @var int
*/
/**
* @var \Magento\Framework\Json\EncoderInterface
*/
private $jsonEncoder;
/**
* @var CollectionFactory
*/
private $collectionFactory;
/**
* @var ImageHelper
*/
private $imageHelper;
public function __construct(
Template\Context $context,
CollectionFactory $collectionFactory,
\Magento\Framework\Json\EncoderInterface $jsonEncoder,
ImageHelper $imageHelper,
array $data = []
) {
parent::__construct($context, $data);
$this->jsonEncoder = $jsonEncoder;
$this->collectionFactory = $collectionFactory;
$this->imageHelper = $imageHelper;
}
/**
* @return int
*/
public function getReviewId(): int
{
return $this->reviewId;
}
/**
* @param $reviewId
*
* @return $this
*/
public function setReviewId($reviewId): Images
{
$this->reviewId = $reviewId;
return $this;
}
public function setProductId($productId): Images
{
$this->productId = $productId;
return $this;
}
public function getProductId()
{
return $this->productId;
}
public function getCollection() {
/** @var Collection $collection */
$collection = $this->collectionFactory->create()
->addFieldToSelect('*')
->addFieldToFilter('review_id', $this->getReviewId());
return $collection;
}
public function getFullImagePath($item): string
{
return $this->imageHelper->getFullPath($item->getPath());
}
/**
* @param $item
* @return string
* @throws \Magento\Framework\Exception\NoSuchEntityException
*/
public function getResizedImagePath($item): string
{
return $this->imageHelper->resize($item->getPath(), self::REVIEW_COVER_WIDTH);
}
/**
* @param $item
* @return string
* @throws \Magento\Framework\Exception\NoSuchEntityException
*/
public function getResizedImagePathByLimit($item, $width): string
{
return $this->imageHelper->resize($item->getPath(), $width);
}
}
<?php
namespace Joshine\Review\Block;
use Joshine\Review\Model\ResourceModel\Images\Collection;
use Joshine\Review\Helper\ImageHelper;
use Magento\Framework\View\Element\Template;
use Joshine\Review\Model\ResourceModel\Images\CollectionFactory;
/**
* Class Images
* @package Amasty\AdvancedReview\Block
*/
class Images extends \Magento\Framework\View\Element\Template
{
//评论缩略图宽度
const REVIEW_COVER_WIDTH = 200;
/**
* @var string
*/
protected $_template = 'Joshine_Review::images.phtml';
private $reviewId;
private $productId;
/**
* @var int
*/
/**
* @var \Magento\Framework\Json\EncoderInterface
*/
private $jsonEncoder;
/**
* @var CollectionFactory
*/
private $collectionFactory;
/**
* @var ImageHelper
*/
private $imageHelper;
public function __construct(
Template\Context $context,
CollectionFactory $collectionFactory,
\Magento\Framework\Json\EncoderInterface $jsonEncoder,
ImageHelper $imageHelper,
array $data = []
) {
parent::__construct($context, $data);
$this->jsonEncoder = $jsonEncoder;
$this->collectionFactory = $collectionFactory;
$this->imageHelper = $imageHelper;
}
/**
* @return int
*/
public function getReviewId()
{
return $this->reviewId;
}
/**
* @param $reviewId
*
* @return $this
*/
public function setReviewId($reviewId)
{
$this->reviewId = $reviewId;
return $this;
}
public function setProductId($productId)
{
$this->productId = $productId;
return $this;
}
public function getProductId()
{
return $this->productId;
}
public function getCollection() {
/** @var Collection $collection */
$collection = $this->collectionFactory->create()
->addFieldToSelect('*')
->addFieldToFilter('review_id', $this->getReviewId());
return $collection;
}
public function getFullImagePath($item)
{
return $this->imageHelper->getFullPath($item->getPath());
}
/**
* @param $item
* @return string
* @throws \Magento\Framework\Exception\NoSuchEntityException
*/
public function getResizedImagePath($item)
{
return $this->imageHelper->resize($item->getPath(), self::REVIEW_COVER_WIDTH);
}
/**
* @param $item
* @return string
* @throws \Magento\Framework\Exception\NoSuchEntityException
*/
public function getResizedImagePathByLimit($item, $width)
{
return $this->imageHelper->resize($item->getPath(), $width);
}
}
......@@ -2,6 +2,7 @@
namespace Joshine\Sales\Plugin;
use \Magento\Catalog\Helper\Image as ImageHelper;
use Magento\Sales\Block\Adminhtml\Order\View\Items\Renderer\DefaultRenderer;
class DefaultRendererPlugin {
......@@ -40,4 +41,13 @@ class DefaultRendererPlugin {
return $result;
}
public function afterGetColumns(DefaultRenderer $subject, $result)
{
if (isset($result['image'])) {
unset($result['image']);
$result = array_merge(['image'=>'col-image'], $result);
}
return $result;
}
}
\ No newline at end of file
<?php
namespace Joshine\Sales\Plugin;
use \Magento\Catalog\Helper\Image as ImageHelper;
use Magento\Sales\Block\Adminhtml\Order\View\Items;
class ItemsSortPlugin {
public function afterGetColumns(Items $subject, $result)
{
if (isset($result['image'])) {
unset($result['image']);
$result = array_merge(['image'=>'Product Image'], $result);
}
return $result;
}
}
......@@ -3,4 +3,7 @@
<type name="Magento\Sales\Block\Adminhtml\Order\View\Items\Renderer\DefaultRenderer">
<plugin name="order-view-image" type="Joshine\Sales\Plugin\DefaultRendererPlugin" sortOrder="1" />
</type>
<type name="\Magento\Sales\Block\Adminhtml\Order\View\Items">
<plugin name="order-item-sort" type="Joshine\Sales\Plugin\ItemsSortPlugin" sortOrder="1" />
</type>
</config>
\ No newline at end of file
......@@ -14,6 +14,7 @@ use Magento\Framework\View\Element\Template\Context;
use Magento\Customer\Model\Session as CustomerSession;
use Magento\Checkout\Model\Session as CheckoutSession;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\App\Config\ScopeConfigInterface;
/**
* Cart Shipping Block
......@@ -43,7 +44,8 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart
* @var JsonHexTag
*/
private $jsonHexTagSerializer;
protected $_scopeConfigInterface;
protected $_quote;
/**
* @param Context $context
* @param CustomerSession $customerSession
......@@ -55,6 +57,7 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart
* @param JsonHexTag|null $jsonHexTagSerializer
* @throws \RuntimeException
*/
public function __construct(
Context $context,
CustomerSession $customerSession,
......@@ -63,14 +66,17 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart
array $layoutProcessors = [],
array $data = [],
Json $serializer = null,
JsonHexTag $jsonHexTagSerializer = null
JsonHexTag $jsonHexTagSerializer = null,
ScopeConfigInterface $_scopeConfigInterface
) {
$this->configProvider = $configProvider;
$this->layoutProcessors = $layoutProcessors;
$this->_quote = $checkoutSession->getQuote();
parent::__construct($context, $customerSession, $checkoutSession, $data);
$this->_isScopePrivate = true;
$this->serializer = $serializer ?: ObjectManager::getInstance()->get(Json::class);
$this->jsonHexTagSerializer = $jsonHexTagSerializer ?: ObjectManager::getInstance()->get(JsonHexTag::class);
$this->_scopeConfigInterface = $_scopeConfigInterface;
}
/**
......@@ -83,7 +89,10 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart
{
return $this->configProvider->getConfig();
}
public function getCountryId() {
$shippingAddress = $this->_quote->getShippingAddress();
return $shippingAddress->getCountryId();
}
/**
* Retrieve serialized JS layout configuration ready to use in template
*
......@@ -119,6 +128,10 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart
{
return $this->jsonHexTagSerializer->serialize($this->getCheckoutConfig());
}
public function getFlatratePrice()
{
return $this->_scopeConfigInterface->getValue('carriers/flatrate/price');
}
public function getCountryHtmlSelect($defValue = null, $name = 'country_id', $id = 'country', $title = 'Country') {
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
/** @var \Magento\Directory\Block\Data $block */
......
......@@ -42,6 +42,7 @@ class Onepage extends \Magento\Framework\View\Element\Template
* @var \Magento\Framework\Serialize\SerializerInterface
*/
private $serializer;
private $_scopeConfigInterface;
/**
* @param \Magento\Framework\View\Element\Template\Context $context
......@@ -60,7 +61,8 @@ class Onepage extends \Magento\Framework\View\Element\Template
array $layoutProcessors = [],
array $data = [],
\Magento\Framework\Serialize\Serializer\Json $serializer = null,
\Magento\Framework\Serialize\SerializerInterface $serializerInterface = null
\Magento\Framework\Serialize\SerializerInterface $serializerInterface = null,
\Magento\Framework\App\Config\ScopeConfigInterface $_scopeConfigInterface
) {
parent::__construct($context, $data);
$this->formKey = $formKey;
......@@ -70,6 +72,7 @@ class Onepage extends \Magento\Framework\View\Element\Template
$this->layoutProcessors = $layoutProcessors;
$this->serializer = $serializerInterface ?: \Magento\Framework\App\ObjectManager::getInstance()
->get(\Magento\Framework\Serialize\Serializer\JsonHexTag::class);
$this->_scopeConfigInterface = $_scopeConfigInterface;
}
/**
......@@ -105,7 +108,10 @@ class Onepage extends \Magento\Framework\View\Element\Template
{
return $this->configProvider->getConfig();
}
public function getFlatratePrice()
{
return $this->_scopeConfigInterface->getValue('carriers/flatrate/price');
}
/**
* Get base url for block.
*
......
......@@ -180,7 +180,6 @@
<container name="checkout.cart.methods" as="methods" label="Payment Methods After Checkout Button">
<block class="Magento\Checkout\Block\Onepage\Link" name="checkout.cart.methods.onepage.bottom" template="Magento_Checkout::onepage/link.phtml" />
<block class="Magento\Checkout\Block\QuoteShortcutButtons" name="checkout.cart.shortcut.buttons" />
<block class="Magento\Framework\View\Element\Template" name="checkout.cart.we_accept" template="Magento_Checkout::cart/we_accept.phtml" />
</container>
</block>
</container>
......
......@@ -17,54 +17,73 @@
white-space: nowrap;
}
</style>
<div class="checkout methods items checkout-methods-items">
<div class="item checkout-now">
<button type="button" data-role="proceed-to-checkout" title="Checkout Now" class="action primary checkout">
<span class="secure"><img alt="" src="/media/wysiwyg/secure.png"></span>
<span>Checkout Now</span>
</button>
</div>
<div class="checkout methods items checkout-methods-items" style="background-color: #f2f2f2;">
<div style="background-color: #fff;width:100%;gap: 1rem;">
<div class="item checkout-now" style="margin:10px 0px 20px 0px;">
<button type="button" data-role="proceed-to-checkout" title="Checkout Now" class="action primary checkout">
<span class="secure"><img alt="" src="/media/wysiwyg/secure.png"></span>
<span>Checkout Now</span>
</button>
</div>
<div class="item">
<style type="text/css">
.displayno{
display: none;
}
</style>
<div class="item">
<style type="text/css">
.displayno{
display: none;
}
</style>
<div class="or-checkout-with" style="display: flex;width:100%;line-height: 1.2rem;"><span>OR CHECKOUT WITH</span></div>
<div class="or-checkout-with" style="display: flex;width:100%;line-height: 1.2rem;"><span>OR CHECKOUT WITH</span></div>
<div data-label="or" class="paypal checkout after paypal-logo
ec_shortcut_jjTyyXrRb0sVUXZkA5EduNvUofEEqeuO">
<div class="checkout-logo-medium">
<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-color.svg" alt="Checkout with PayPal" title="Checkout with PayPal">
<div class="checkout-txt">Checkout</div>
<div data-label="or" class="paypal checkout after paypal-logo
ec_shortcut_jjTyyXrRb0sVUXZkA5EduNvUofEEqeuO">
<div class="checkout-logo-medium">
<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-color.svg" alt="Checkout with PayPal" title="Checkout with PayPal">
<div class="checkout-txt">Checkout</div>
</div>
</div>
</div>
<style type="text/css">
.displayno{
display: none;
}
</style>
<div data-label="or" class="paypal checkout after paypal-logo
ec_shortcut_bml_uk4wcxXNp0BvGHWy4ZWUMx397QbCJKdp">
<div class="paypal-credit displayno">
<input type="image" data-action="checkout-form-submit" data-checkout-url="/paypal/bml/start/button/1/" src="/static/frontend/Joshine/breeze/en_US/Magento_Paypal/images/paypal-credit.png" alt="Checkout with PayPal" title="Checkout with PayPal">
<a href="https://www.securecheckout.billmelater.com/paycapture-content/fetch?hash=AU826TU8&amp;content=/bmlweb/ppwpsiw.html">
<img src="https://www.paypalobjects.com/webstatic/en_US/btn/btn_bml_text.png">
</a>
<div class="checkout-txt">Checkout</div>
<style type="text/css">
.displayno{
display: none;
}
</style>
<div data-label="or" class="paypal checkout after paypal-logo
ec_shortcut_bml_uk4wcxXNp0BvGHWy4ZWUMx397QbCJKdp">
<div class="paypal-credit displayno">
<input type="image" data-action="checkout-form-submit" data-checkout-url="/paypal/bml/start/button/1/" src="/static/frontend/Joshine/breeze/en_US/Magento_Paypal/images/paypal-credit.png" alt="Checkout with PayPal" title="Checkout with PayPal">
<a href="https://www.securecheckout.billmelater.com/paycapture-content/fetch?hash=AU826TU8&amp;content=/bmlweb/ppwpsiw.html">
<img src="https://www.paypalobjects.com/webstatic/en_US/btn/btn_bml_text.png">
</a>
<div class="checkout-txt">Checkout</div>
</div>
</div>
</div>
</div>
<style>
#we-accept{
text-align: center;
background: #ffffff;
padding: 10px 20px;
}
#we-accept .title{
font-size: 24px;
font-weight: bold;
margin-bottom: 10px;
}
</style>
<div id="we-accept">
<div class="title">We Accept</div>
<img src="/media/wysiwyg/we_accept.png" alt="">
</div>
</div>
<?php endif; ?>
<script>
......
......@@ -7,7 +7,10 @@
?>
<?php /** @var $block \Magento\Checkout\Block\Cart\Shipping */ ?>
<?php /** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */ ?>
<?php
$selectedCountryId = $block->getCountryId();
$flatraPrice = $block->getFlatratePrice();
?>
<div id="block-shipping" class="block shipping">
<div id="block-summary" style="display: none;">
<form method="post" id="shipping-zip-form">
......@@ -27,6 +30,7 @@
$scriptString = <<<script
window.checkoutConfig = {$serializedCheckoutConfig};
window.checkoutConfig.flatrate_price = {$flatraPrice};
window.customerData = window.checkoutConfig.customerData;
window.isCustomerLoggedIn = window.checkoutConfig.isCustomerLoggedIn;
require([
......@@ -41,5 +45,10 @@
script;
?>
<?= /* @noEscape */ $secureRenderer->renderTag('script', [], $scriptString, false) ?>
<script>
require(['jquery'], function($) {
$('#shipping_country_id').val('<?= $selectedCountryId?>');
});
</script>
</div>
</div>
......@@ -18,6 +18,7 @@ define([
this._super();
var address={};
address.countryId = window.checkoutConfig.defaultCountryId;
address.postcode = window.checkoutConfig.postcode;
getAddress.getRates(address);
}
......
......@@ -93,10 +93,14 @@ define([
price = this.totals()['shipping_amount'];
if(price == 0)
{
if(quote.shippingSaveMethod())
if(quote.shippingSaveMethod() && quote.shippingSaveMethod()['amount'] != 0)
{
return this.getFormattedPrice(quote.shippingSaveMethod()['amount']);
}
else
{
return this.getFormattedPrice(window.checkoutConfig.flatrate_price);
}
}
return this.getFormattedPrice(price);
},
......@@ -109,12 +113,16 @@ define([
price = this.totals()['shipping_amount'];
if(price == 0)
{
if(quote.shippingSaveMethod())
if(quote.shippingSaveMethod() && quote.shippingSaveMethod()['amount'] != 0)
{
return '-'+this.getFormattedPrice(quote.shippingSaveMethod()['amount']);
}
return 0;
else
{
return '-'+this.getFormattedPrice(window.checkoutConfig.flatrate_price);
}
}
return 0;
},
/**
......
......@@ -7,6 +7,9 @@
/** @var $block \Magento\Checkout\Block\Onepage */
/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
?>
<?php
$flatraPrice = $block->getFlatratePrice();
?>
<style type="text/css">
.payment-method._active{
border: 1px solid #1979c3 !important;
......@@ -777,6 +780,7 @@
<?php $serializedCheckoutConfig = /* @noEscape */ $block->getSerializedCheckoutConfig();
$scriptString = <<<script
window.checkoutConfig = {$serializedCheckoutConfig};
window.checkoutConfig.flatrate_price = {$flatraPrice};
// Create aliases for customer.js model from customer module
window.isCustomerLoggedIn = window.checkoutConfig.isCustomerLoggedIn;
window.customerData = window.checkoutConfig.customerData;
......
......@@ -450,7 +450,7 @@ define([
}
if (item.label.toLowerCase() == "size") {
// Create new control
var sizeContent = '<div class="swatch-attribute-selected-option-size-content" style="margin-top: 0.13333rem;padding: 0.26667rem;background-color: #f7f7f7;display: none;"><div style="font-size:.32rem;color:#999999;">Product Measurements</div>'+'<span style="color:#0a0a0a;" class="'+classes.attributeSelectedOptionLabelClass + '"></span></div>';
var sizeContent = '<div class="swatch-attribute-selected-option-size-content" ><div style="font-size:.32rem;color:#999999;">Product Size Describe</div>'+'<span style="color:#0a0a0a;" class="'+classes.attributeSelectedOptionLabelClass + '"></span></div>';
container.append(
'<div class="' + classes.attributeClass + ' ' + item.code + '" ' +
......
......@@ -166,17 +166,12 @@
.swatch-option {
display: block;
font-family: Outfit-Regular;
width: 40px;
height: 40px;
line-height: 40px;
color: #222222;
font-size: 12px;
font-weight: 500;
text-align: center;
background-color: #f1f1f1;
border-radius: 10%;
padding: 0;
border: 0;
}
.swatch-option-link-layered .swatch-option .color{
......@@ -436,9 +431,6 @@ button, input, optgroup, select, textarea{
}
#product-options-wrapper .swatch-option.image:hover{
border: 2px solid #000;
}
.product.info .review-add + .review-list, .product.info #product-review-container {
......@@ -2183,15 +2175,7 @@ button.action.submit.primary {
white-space: nowrap;
}
@media (max-width: 768px){
.swatch-attribute-selected-option-size-content span.swatch-attribute-selected-option{
margin-left: 0!important;
line-height:.53333rem;
font-size: .32rem;
text-transform:capitalize;
color: #0a0a0a;
}
}
#product-intro__freeshipping-more-3{
display: inline-block;
......@@ -2256,18 +2240,58 @@ button.action.submit.primary {
}
.swatch-option.color, .swatch-option.image{
width: 40px !important;
height: 40px !important;
border: 1px solid #000008;
width: 40px;
height: 40px;
background-clip: content-box!important;
padding: 5px;
margin-left: 3%;
}
.swatch-option.color.selected{
border: 2px solid black;
}
.swatch-option.image.selected{
border: 2px solid black;
}
.swatch-option.text{
width: auto!important;
padding: calc( 8.5px) calc( 11px);
line-height:22px!important;
line-height:10px!important;
min-width: 40px;
text-align: center;
font-size: 15px;
background: none!important;
border:2px solid rgba(23, 23, 23, 0.3);
border-radius: 15px;
margin-left: 10px;
}
.swatch-option.text.selected{
border:2px solid black;
}
.swatch-attribute.size .swatch-attribute-selected-option{
font-size: 15px;
color: rgba(23, 23, 23, 0.6) !important;
}
.swatch-attribute-selected-option-size-content{
margin-top: 0.53333rem;
padding: 0.26667rem;
background-color: #f8f8f8!important;
display: none;
}
@media (max-width: 768px){
.swatch-attribute-selected-option-size-content span.swatch-attribute-selected-option{
margin-left: 0!important;
line-height:0.53333rem;
font-size: 12px;
text-transform:capitalize;
color: #0a0a0a;
}
}
.block-minicart .block-content>.actions .action.checkout{
......@@ -2280,24 +2304,18 @@ button.action.submit.primary {
margin: 0 !important;
}
//色块强制大小
#product-options-wrapper .swatch-option.image{
width: 40px !important;;
height: 40px !important;;
border-radius: 50% !important;;
}
//颜色提示强制关闭
.breeze .field-tooltip-content, .breeze .tooltip.wrapper .tooltip.content, .breeze .map-popup, .breeze .swatch-option-tooltip {
display: none !important;
}
@media (max-width: 1024px){
#product-options-wrapper .swatch-option.color,#product-options-wrapper .swatch-option.image{
width: 30px !important;
height: 30px !important;
border: 1px solid #000008;
border-radius: 50% !important;
line-height: 30px;
}
......@@ -2360,10 +2378,6 @@ button.action.submit.primary {
background-color: #000;
}
//产品色块选中错位处理
#product-options-wrapper .swatch-option.image:hover{
border: none;
}
//评论列表距离顶部
.product.info.detailed, .block.related {
......@@ -2855,6 +2869,10 @@ tr.grand.totals {
}
.swatch-option.selected:before{
box-shadow:none;
}
div#shipping-method-buttons-container {
display: none;
}
......@@ -3018,6 +3036,7 @@ strong#block-related-heading,strong#block-upsell-heading{ font-weight: 600; colo
}
/*导入Joshine工具类*/
@import "./_joshine_col";
@import "./_joshine_utils";
......
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