Commit 98f5d87c by liumengfei

Merge branch 'developer' into production

parents 8c0a8e3c 31a3293a
......@@ -77,7 +77,6 @@
}
.joshine-review-container .joshine-review-list-item .joshine-review-nickname {
width: 100%;
white-space: nowrap;
margin-bottom: 15px;
}
......
<?php
namespace Joshine\Script\Console\Command;
use Joshine\Script\Model\ImageQueryResource;
use Magento\Catalog\Api\ProductRepositoryInterface;
use Magento\Framework\Api\SearchCriteriaBuilder;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class ProductFirstImageAsBaseFixer extends Command
{
protected $imageQueryResource;
protected $productRepository;
protected $searchCriteriaBuilder;
public function __construct(
ImageQueryResource $imageQueryResource,
ProductRepositoryInterface $productRepository,
SearchCriteriaBuilder $searchCriteriaBuilder,
string $name = null)
{
$this->imageQueryResource = $imageQueryResource;
$this->searchCriteriaBuilder = $searchCriteriaBuilder;
$this->productRepository = $productRepository;
parent::__construct($name);
}
protected function configure()
{
$this->setName('joshine:fix-base-image')->setDescription('设置第一张产品图为base image');
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$collection = $objectManager->create('Magento\Catalog\Model\ResourceModel\Product\Collection')->addFilter('type_id', 'configurable', 'eq');
foreach ($collection as $item) {
$pid = $item->getId();
$this->fixBaseImage($input, $output, $pid);
}
}
protected function fixBaseImage($input, $output, $productId)
{
$mainImage = $this->imageQueryResource->getProductMainImage($productId);
$firstImage = $this->imageQueryResource->getFirstImages($productId);
$output->writeln('first image' . $firstImage);
$output->writeln("main image".$mainImage);
if (empty($firstImage)) {
$output->writeln('first image is null, break');
return;
}
if (empty($mainImage)) {
$output->writeln('base image is null, break');
return;
}
if ($mainImage != $firstImage) {
$output->writeln('fix product ' . $mainImage . ' product id: ' . $productId);
//change main image
$this->imageQueryResource->changeBaseImageTo($productId, $firstImage);
}
}
}
\ No newline at end of file
<?php
namespace Joshine\Script\Model;
use Magento\Framework\App\ResourceConnection;
class ImageQueryResource
{
/**
* @var ResourceConnection
*/
private $resourceConnection;
/**
* @var \Magento\Eav\Model\Config
*/
private $config;
public function __construct(
ResourceConnection $resourceConnection,
\Magento\Eav\Model\Config $config
) {
$this->resourceConnection = $resourceConnection;
$this->config = $config;
}
public function getProductMainImage(int $productId)
{
$mainImageAttribute = $this->config->getAttribute(\Magento\Catalog\Model\Product::ENTITY, 'image');
$select = $this->resourceConnection->getConnection()->select();
$select->from($this->resourceConnection->getTableName('catalog_product_entity_' . $mainImageAttribute->getBackendType()));
$select->where('entity_id=?', $productId);
$select->where('attribute_id=?', $mainImageAttribute->getId());
$select->reset(\Magento\Framework\DB\Select::COLUMNS);
$select->columns(['value']);
return $this->resourceConnection->getConnection()->fetchOne($select);
}
/**
* @param int $productId
* select * from catalog_product_entity_media_gallery_value as v
inner join catalog_product_entity_media_gallery as g on g.value_id=v.value_id
where entity_id=1802
order by position
*/
public function getAllImages(int $productId)
{
$select = $this->resourceConnection->getConnection()->select();
$select->from(['v' => $this->resourceConnection->getTableName('catalog_product_entity_media_gallery_value')]);
$select->join(
['g' => 'catalog_product_entity_media_gallery'],
'g.value_id=v.value_id',
[]
);
$select->where('entity_id=?', $productId);
$select->reset(\Magento\Framework\DB\Select::COLUMNS);
$select->columns(['v.value_id', 'v.position', 'g.value']);
$select->order('v.position');
return $this->resourceConnection->getConnection()->fetchAll($select);
}
/**
* @param int $productId
* select * from catalog_product_entity_media_gallery_value as v
inner join catalog_product_entity_media_gallery as g on g.value_id=v.value_id
where entity_id=1802
order by position
*/
public function getFirstImages(int $productId)
{
$select = $this->resourceConnection->getConnection()->select();
$select->from(['v' => $this->resourceConnection->getTableName('catalog_product_entity_media_gallery_value')]);
$select->join(
['g' => 'catalog_product_entity_media_gallery'],
'g.value_id=v.value_id',
[]
);
$select->where('entity_id=?', $productId);
$select->reset(\Magento\Framework\DB\Select::COLUMNS);
$select->columns(['g.value', 'v.position']);
$select->order('v.position');
$select->limit(1);
return $this->resourceConnection->getConnection()->fetchOne($select);
}
public function updatePosition(int $valueId, int $position)
{
/*$this->resourceConnection->getConnection()->update(
$this->resourceConnection->getTableName('catalog_product_entity_media_gallery_value'),
['position' => $position],
['value_id=?' => $valueId]
);*/
}
public function changeBaseImageTo($productId, $firstImage)
{
$this->resourceConnection->getConnection()->update(
$this->resourceConnection->getTableName('catalog_product_entity_varchar'),
['value' => $firstImage],
[
'entity_id=?' => $productId,
'attribute_id=?' => 87
],
);
}
}
\ 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:ObjectManager/etc/config.xsd">
<type name="Magento\Framework\Console\CommandListInterface">
<arguments>
<argument name="commands" xsi:type="array">
<item name="joshine_fix-base-image" xsi:type="object">Joshine\Script\Console\Command\ProductFirstImageAsBaseFixer</item>
</argument>
</arguments>
</type>
</config>
\ No newline at end of file
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. 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="Joshine_Script" setup_version="0.0.1"/>
</config>
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Joshine_Script',
__DIR__
);
......@@ -4,7 +4,15 @@
* See COPYING.txt for license details.
*/
?>
<style>
@media (min-width: 1024px){
h1.page-title {
margin: 0 auto !important;
width: 20%;
line-height: 3;
}
}
</style>
<div id="checkout-loader" data-role="checkout-loader" class="loading-mask" data-mage-init='{"checkoutLoader": {}}'>
<div class="loader">
<img src="<?php echo $block->getViewFileUrl('images/loader-1.gif'); ?>"
......
......@@ -5,6 +5,16 @@
*/
?>
<style>
@media (min-width: 1024px){
h1.page-title {
margin: 0 auto !important;
width: 20%;
line-height: 3;
}
}
</style>
<div>
<?php echo $block->getCheckoutForm(); ?>
......
......@@ -443,9 +443,6 @@ img.sparsh-mfp-img {
font-size: 1.3rem;
line-height: 1;
border-radius: 0;
-webkit-box-shadow: 3px 3px 4px 0 rgba(0, 0, 0, 0.3);
-moz-box-shadow: 3px 3px 4px 0 rgba(0, 0, 0, 0.3);
box-shadow: 3px 3px 4px 0 rgba(0, 0, 0, 0.3);
}
.products-grid a.sparsh-quick-view-button:before,
.products-list a.sparsh-quick-view-button:before {
......@@ -673,14 +670,16 @@ a.sparsh-quick-view-button{
}
#sparsh-quick-view-button-phone{
opacity: 0.6;
opacity: 0.8;
visibility: visible;
display: inline-block;
width: 50%;
background-color:transparent;
padding: 0;
border:1px solid black;
border-radius: 10px;
padding: 0.2em;
background-clip: content-box;
background-color: hsla(0,0%,100%,.8);
border-radius: 50%;
text-align: center;
width: 55%;
font-size: 1.1em;
}
......@@ -749,7 +748,8 @@ a.sparsh-quick-view-button{
}
.quick-view-icon-shop-car{
width: 80%;
opacity: 1;
padding: .19em;
height: auto;
}
......
......@@ -40,8 +40,8 @@ define(
btnQuickView += '<a rel="' + groupName + '" class="' + config.defaultClassName + ' ' + config.handlerClassName + ' sparsh-quick-view-button-phone " id="sparsh-quick-view-button-phone" href="' + url + '"';
btnQuickView += ' title="' + config.popupTitle + '"';
btnQuickView += ' >';
btnQuickView += '<svg t="1677047956598" class="quick-view-icon-shop-car" viewBox="0 0 1028 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5146" ><path d="M332.8 790.528q19.456 0 36.864 7.168t30.208 19.968 20.48 30.208 7.68 36.864-7.68 36.864-20.48 30.208-30.208 20.48-36.864 7.68q-20.48 0-37.888-7.68t-30.208-20.48-20.48-30.208-7.68-36.864 7.68-36.864 20.48-30.208 30.208-19.968 37.888-7.168zM758.784 792.576q19.456 0 37.376 7.168t30.72 19.968 20.48 30.208 7.68 36.864-7.68 36.864-20.48 30.208-30.72 20.48-37.376 7.68-36.864-7.68-30.208-20.48-20.48-30.208-7.68-36.864 7.68-36.864 20.48-30.208 30.208-19.968 36.864-7.168zM930.816 210.944q28.672 0 44.544 7.68t22.528 18.944 6.144 24.064-3.584 22.016-13.312 37.888-22.016 62.976-23.552 68.096-18.944 53.248q-13.312 40.96-33.28 56.832t-49.664 15.872l-35.84 0-65.536 0-86.016 0-96.256 0-253.952 0 14.336 92.16 517.12 0q49.152 0 49.152 41.984 0 20.48-9.728 35.84t-38.4 14.336l-49.152 0-94.208 0-118.784 0-119.808 0-99.328 0-55.296 0q-20.48 0-34.304-9.216t-23.04-24.064-14.848-32.256-8.704-32.768q-1.024-6.144-5.632-29.696t-11.264-58.88-14.848-78.848-16.384-87.552q-19.456-103.424-44.032-230.4l-76.8 0q-15.36 0-25.6-7.68t-16.896-18.432-9.216-23.04-2.56-22.528q0-20.48 13.824-33.792t37.376-12.288l103.424 0q20.48 0 32.768 6.144t19.456 15.36 10.24 18.944 5.12 16.896q2.048 8.192 4.096 23.04t4.096 30.208q3.072 18.432 6.144 38.912l700.416 0zM892.928 302.08l-641.024-2.048 35.84 185.344 535.552 1.024z" p-id="5147" fill="black"></path></svg></a>';
//btnQuickView += '<svg t="1677047956598" class="quick-view-icon-shop-car" viewBox="0 0 1028 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5146" ><path d="M332.8 790.528q19.456 0 36.864 7.168t30.208 19.968 20.48 30.208 7.68 36.864-7.68 36.864-20.48 30.208-30.208 20.48-36.864 7.68q-20.48 0-37.888-7.68t-30.208-20.48-20.48-30.208-7.68-36.864 7.68-36.864 20.48-30.208 30.208-19.968 37.888-7.168zM758.784 792.576q19.456 0 37.376 7.168t30.72 19.968 20.48 30.208 7.68 36.864-7.68 36.864-20.48 30.208-30.72 20.48-37.376 7.68-36.864-7.68-30.208-20.48-20.48-30.208-7.68-36.864 7.68-36.864 20.48-30.208 30.208-19.968 36.864-7.168zM930.816 210.944q28.672 0 44.544 7.68t22.528 18.944 6.144 24.064-3.584 22.016-13.312 37.888-22.016 62.976-23.552 68.096-18.944 53.248q-13.312 40.96-33.28 56.832t-49.664 15.872l-35.84 0-65.536 0-86.016 0-96.256 0-253.952 0 14.336 92.16 517.12 0q49.152 0 49.152 41.984 0 20.48-9.728 35.84t-38.4 14.336l-49.152 0-94.208 0-118.784 0-119.808 0-99.328 0-55.296 0q-20.48 0-34.304-9.216t-23.04-24.064-14.848-32.256-8.704-32.768q-1.024-6.144-5.632-29.696t-11.264-58.88-14.848-78.848-16.384-87.552q-19.456-103.424-44.032-230.4l-76.8 0q-15.36 0-25.6-7.68t-16.896-18.432-9.216-23.04-2.56-22.528q0-20.48 13.824-33.792t37.376-12.288l103.424 0q20.48 0 32.768 6.144t19.456 15.36 10.24 18.944 5.12 16.896q2.048 8.192 4.096 23.04t4.096 30.208q3.072 18.432 6.144 38.912l700.416 0zM892.928 302.08l-641.024-2.048 35.84 185.344 535.552 1.024z" p-id="5147" fill="black"></path></svg></a>';
btnQuickView += `<svg t="1680586108031" class="quick-view-icon-shop-car" className="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1303" width="64" height="64"><path d="M512 96c140.478 0 253.715 119.82 255.966 267.516L768 368v16h96c35.346 0 64 28.654 64 64v352c0 70.692-57.308 128-128 128H224c-70.692 0-128-57.308-128-128V448c0-35.346 28.654-64 64-64h96v-16c0-149.747 114.103-272 256-272zM256 448h-64c-17.673 0-32 14.327-32 32v320c0 34.993 28.084 63.426 62.942 63.991L224 864h576c34.993 0 63.426-28.084 63.991-62.942L864 800V480c0-17.673-14.327-32-32-32h-64v64c0 17.673-14.327 32-32 32-17.496 0-31.713-14.042-31.996-31.47L704 512v-64H320v64c0 17.673-14.327 32-32 32-17.496 0-31.713-14.042-32-31.47V448z m256 80c17.673 0 32 14.327 32 32v64h64c17.673 0 32 14.327 32 32 0 17.673-14.327 32-32 32h-64v64c0 17.673-14.327 32-32 32-17.673 0-32-14.327-32-32v-64h-64c-17.673 0-32-14.327-32-32 0-17.673 14.327-32 32-32h64v-64c0-17.673 14.327-32 32-32z m0-368c-104.471 0-190.269 90.807-191.974 204.546L320 368v16h384v-16c0-115.35-86.474-208-192-208z" fill="#000000" p-id="1304"></path></svg>`;
btnQuickView += '</div>';
$(this).find(config.btnContainer).prepend(btnQuickView);
$(this).addClass('sparsh-quick-view-item');
......
......@@ -231,7 +231,7 @@ $_helper = $block->getData('outputHelper');
<script>
dataLayer = [];
dataLayer.push({
'event' : <?= $googleGtmName ?>,
'event' : '<?= $googleGtmName ?>',
'value' : <?= $price ?>,
'item' : <?= json_encode($items, true) ?>
})
......
......@@ -75,6 +75,6 @@ $logoHeight = $logoSizeResolver !== null && $logoSizeResolver->getHeight()
/
</span>
<img class="logo-secure" src="/media/wysiwyg/logo-secure.png" />
<span class="cut-font">SECURE CHECKOUT</span>
<span class="cut-font"><?= __('SECURE CHECKOUT') ?></span>
</span>
</a>
......@@ -2299,10 +2299,13 @@ button.action.submit.primary {
height: 40px;
background-clip: content-box!important;
padding: 5px;
margin-left: 3%!important;
border: 1px solid rgba(23,23,23,0.3);
}
.product-info-main .swatch-option.color, .swatch-option.image{
margin-right: 3% !important;
}
.swatch-option.color.selected{
border: 2px solid black!important;
}
......@@ -2321,7 +2324,7 @@ button.action.submit.primary {
background: none!important;
border:2px solid rgba(23, 23, 23, 0.3);
border-radius: 15px;
margin-left: 10px;
margin-right: 10px;
}
.swatch-option.text.selected{
......
Options -Indexes
<IfModule mod_php5.c>
php_flag engine 0
</IfModule>
<IfModule mod_php7.c>
php_flag engine 0
</IfModule>
AddHandler cgi-script .php .pl .py .jsp .asp .htm .shtml .sh .cgi
Options -ExecCGI
<FilesMatch ".+\.(ph(p[3457]?|t|tml)|[aj]sp|p[ly]|sh|cgi|shtml?|html?)$">
SetHandler default-handler
</FilesMatch>
<IfModule mod_rewrite.c>
############################################
## enable rewrites
Options +FollowSymLinks
RewriteEngine on
## you can put here your pub/media folder path relative to web root
#RewriteBase /magento/pub/media/
############################################
## never rewrite for existing files
RewriteCond %{REQUEST_FILENAME} !-f
############################################
## rewrite everything else to get.php
RewriteRule .* ../get.php [L]
</IfModule>
############################################
## setting MIME types
# JavaScript
AddType application/javascript js jsonp
AddType application/json json
# CSS
AddType text/css css
# Images and icons
AddType image/x-icon ico
AddType image/gif gif
AddType image/png png
AddType image/jpeg jpg
AddType image/jpeg jpeg
AddType image/webp webp
AddType image/avif avif
AddType image/avif-sequence avifs
# SVG
AddType image/svg+xml svg svgz
# Fonts
AddType application/vnd.ms-fontobject eot
AddType application/x-font-ttf ttf
AddType application/x-font-otf otf
AddType application/x-font-woff woff
AddType application/font-woff2 woff2
# Archives and exports
AddType application/zip gzip
AddType application/x-gzip gz gzip
AddType application/x-bzip2 bz2
AddType text/csv csv
AddType application/xml xml
<IfModule mod_headers.c>
<FilesMatch .*\.(ico|jpg|jpeg|png|gif|svg|svgz|webp|avif|avifs|js|css|eot|ttf|otf|woff|woff2)$>
Header append Cache-Control public
</FilesMatch>
<FilesMatch .*\.(zip|gz|gzip|bz2|csv|xml)$>
Header append Cache-Control no-store
</FilesMatch>
</IfModule>
<IfModule mod_expires.c>
############################################
## Add default Expires header
## http://developer.yahoo.com/performance/rules.html#expires
ExpiresActive On
# Data
<FilesMatch \.(zip|gz|gzip|bz2|csv|xml)$>
ExpiresDefault "access plus 0 seconds"
</FilesMatch>
ExpiresByType text/xml "access plus 0 seconds"
ExpiresByType text/csv "access plus 0 seconds"
ExpiresByType application/json "access plus 0 seconds"
ExpiresByType application/zip "access plus 0 seconds"
ExpiresByType application/x-gzip "access plus 0 seconds"
ExpiresByType application/x-bzip2 "access plus 0 seconds"
# CSS, JavaScript
<FilesMatch \.(css|js)$>
ExpiresDefault "access plus 1 year"
</FilesMatch>
ExpiresByType text/css "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"
# Favicon, images
<FilesMatch \.(ico|gif|png|jpg|jpeg|svg|svgz|webp|avif|avifs)$>
ExpiresDefault "access plus 1 year"
</FilesMatch>
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"
ExpiresByType image/webp "access plus 1 year"
ExpiresByType image/avif "access plus 1 year"
ExpiresByType image/avif-sequence "access plus 1 year"
# Fonts
<FilesMatch \.(eot|ttf|otf|svg|woff|woff2)$>
ExpiresDefault "access plus 1 year"
</FilesMatch>
ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
ExpiresByType application/x-font-ttf "access plus 1 year"
ExpiresByType application/x-font-otf "access plus 1 year"
ExpiresByType application/x-font-woff "access plus 1 year"
ExpiresByType application/font-woff2 "access plus 1 year"
</IfModule>
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