Commit 9961f9a5 by liumengfei

Merge branch 'developer' into production

parents af7069ef f419995e
...@@ -11,8 +11,13 @@ use Magento\Store\Model\ScopeInterface; ...@@ -11,8 +11,13 @@ use Magento\Store\Model\ScopeInterface;
class ApiAddress extends Template class ApiAddress extends Template
{ {
const INSTAGRAM_API_BASE_URL = 'https://api.instagram.com'; const INSTAGRAM_API_BASE_URL = 'https://api.instagram.com';
const INSTAGRAM_GRAPH_API_URL = "https://graph.instagram.com";
const INSTAGRAM_AUTH_URL = 'oauth/authorize'; const INSTAGRAM_AUTH_URL = 'oauth/authorize';
const INSTAGRAM_TOKEN_URL = 'oauth/access_token';
const REDIRECT_URL = 'admin/joshine_instagram/oauth/redirect'; const REDIRECT_URL = 'admin/joshine_instagram/oauth/redirect';
protected $_objectManager; protected $_objectManager;
...@@ -36,6 +41,16 @@ class ApiAddress extends Template ...@@ -36,6 +41,16 @@ class ApiAddress extends Template
); );
} }
public function getLongTokenUrl()
{
return self::INSTAGRAM_GRAPH_API_URL."/access_token";
}
public function getTokenUrl() :string
{
return self::INSTAGRAM_API_BASE_URL.'/'.self::INSTAGRAM_TOKEN_URL;
}
public function getAppSecret() public function getAppSecret()
{ {
return $this->_objectManager->get(ScopeConfigInterface::class) return $this->_objectManager->get(ScopeConfigInterface::class)
...@@ -57,6 +72,8 @@ class ApiAddress extends Template ...@@ -57,6 +72,8 @@ class ApiAddress extends Template
"?client_id={$this->getAppid()}&redirect_uri={$this->redirectUri()}&scope=user_profile,user_media&response_type=code"; "?client_id={$this->getAppid()}&redirect_uri={$this->redirectUri()}&scope=user_profile,user_media&response_type=code";
} }
public function getMediaUrl($token, $uid): string
{
return self::INSTAGRAM_GRAPH_API_URL."/v16.0/{$uid}/media?access_token={$token}&fields=caption,id,is_shared_to_feed,media_type,media_url,permalink,thumbnail_url,timestamp,username";
}
} }
\ No newline at end of file
<?php
namespace Joshine\InstagramFeed\Block;
use Joshine\InstagramFeed\Model\Cache\Type;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\View\Element\Template;
use Magento\Store\Model\ScopeInterface;
use Magento\Framework\App\Cache;
use phpDocumentor\Reflection\PseudoTypes\LiteralString;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\Serialize\Serializer\Json;
class MediaFeed extends Template {
const TYPE_IDENTIFIER = 'instagram_feed';
const CACHE_TAG = 'INSTAGRAM_FEED';
const CACHE_LIFETIME = 60 * 60;
protected $request;
protected $_template = 'Joshine_InstagramFeed::mediafeed.phtml';
/**
* @var \Magento\Framework\ObjectManagerInterface
*/
private $_objectManager;
/**
* @var ApiAddress
*/
private $apiAddress;
private $_curlClient;
/**
* @var \Magento\Framework\Json\EncoderInterface
*/
private $jsonEncoder;
/**
* @var \Magento\Framework\Json\Decoder
*/
private $jsonDecoder;
/**
* @var string
*/
private $id;
private $_json;
public function __construct(
Template\Context $context,
\Magento\Framework\ObjectManagerInterface $objectManager,
\Magento\Framework\App\Request\Http $request,
ApiAddress $apiAddress,
\Magento\Framework\HTTP\Client\Curl $curl,
\Magento\Framework\Json\EncoderInterface $jsonEncoder,
\Magento\Framework\Json\Decoder $jsonDecoder,
Json $json,
array $data = []
) {
parent::__construct($context, $data);
$this->request = $request;
$this->id = $this->getId();
$this->_objectManager = $objectManager;
$this->apiAddress = $apiAddress;
$this->_curlClient = $curl;
$this->jsonEncoder = $jsonEncoder;
$this->jsonDecoder = $jsonDecoder;
$this->_json = $json;
}
public function getCurlClient()
{
return $this->_curlClient;
}
public function getMediaByCache()
{
if ($this->_cacheState->isEnabled(Type::TYPE_IDENTIFIER)) {
if ($feed = $this->_cache->load($this->id)) {
return $this->_json->unserialize($feed);
}
}
return [];
}
public function getMediaByApi()
{
$uid = $this->_objectManager->get(ScopeConfigInterface::class)
->getValue(
'joshine_instagram_feed/general/user_id',
ScopeInterface::SCOPE_STORE
);
$token = $this->_objectManager->get(ScopeConfigInterface::class)
->getValue(
'joshine_instagram_feed/general/access_token',
ScopeInterface::SCOPE_STORE
);
$url = $this->apiAddress->getMediaUrl($token, $uid);
$this->getCurlClient()->get($url);
$this->getCurlClient()
->setOptions([
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_SSL_VERIFYPEER => false
]);
if ($this->getCurlClient()->getStatus() != 200) {
return [];
}
return $this->jsonDecoder->decode($this->getCurlClient()->getBody());
}
public function cacheFeed($feed)
{
if ($this->_cacheState->isEnabled(Type::TYPE_IDENTIFIER)) {
$this->save($feed, $this->id);
}
return true;
}
public function getId()
{
try {
return base64_encode($this->_storeManager->getStore()->getCode() . Type::TYPE_IDENTIFIER);
} catch (NoSuchEntityException $e) {
return base64_encode(date('Y-m-d') . Type::TYPE_IDENTIFIER);
}
}
public function load($cacheId)
{
if ($this->_cacheState->isEnabled(Type::TYPE_IDENTIFIER)) {
return $this->_cache->load($cacheId) ?: false;
}
return false;
}
public function save($data, $cacheId)
{
if ($this->_cacheState->isEnabled(Type::TYPE_IDENTIFIER)) {
return $this->_cache->save($data, $cacheId, [Type::CACHE_TAG], Type::CACHE_LIFETIME);
}
return false;
}
public function getMedia() {
$cache = $this->getMediaByCache();
if (!empty($cache)) {
return $cache;
}
$feed = $this->getMediaByApi();
if (isset($feed['data'])) {
$this->cacheFeed($this->_json->serialize($feed));
}
return $feed;
}
}
\ No newline at end of file
<?php <?php
namespace Joshine\InstagramFeed\Controller\Adminhtml\OAuth; namespace Joshine\InstagramFeed\Controller\Adminhtml\OAuth;
use Joshine\InstagramFeed\Block\ApiAddress;
use \Magento\Backend\App\Action; use \Magento\Backend\App\Action;
use Magento\Backend\App\Action\Context;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\HTTP\Client\Curl;
use Magento\Store\Model\ScopeInterface;
class Redirect extends Action class Redirect extends Action
{ {
protected $_publicActions = ['redirect']; protected $_publicActions = ['redirect'];
protected $_apiAddress;
/**
* @var ApiAddress
*/
private $_curlClient;
/**
* @var \Magento\Framework\App\Config\Storage\WriterInterface
*/
private $_configWriter;
private $_cacheTypeList;
public function __construct(
Context $context,
Curl $curl,
\Magento\Framework\App\Config\Storage\WriterInterface $configWriter,
ApiAddress $apiAddress,
\Magento\Framework\App\Cache\TypeListInterface $cacheTypeList
)
{
$this->_curlClient = $curl;
$this->_configWriter = $configWriter;
$this->_apiAddress = $apiAddress;
$this->_cacheTypeList = $cacheTypeList;
parent::__construct($context);
}
public function getCurlClient()
{
return $this->_curlClient;
}
public function execute() public function execute()
{ {
echo "1111"; $codeRaw = $this->getRequest()->getParam('code');
// TODO: Implement execute() method. if (!$codeRaw) {
return "Error Code";
}
$code = rtrim($codeRaw, "#_");
try {
$oauthRes = $this->getToken($code);
if (!isset($oauthRes['access_token'])) {
return;
}
$longTokenRaw = $this->getLongToken($oauthRes["access_token"]);
$longToken = json_decode($longTokenRaw, true);
if (!isset($longToken['access_token'])) {
echo $longTokenRaw;
return;
}
$userId = $oauthRes['user_id'];
$longLifeToken = $longToken['access_token'];
$this->_configWriter->save("joshine_instagram_feed/general/user_id", $userId);
$this->_configWriter->save("joshine_instagram_feed/general/access_token", $longLifeToken);
$this->_cacheTypeList->cleanType(\Magento\Framework\App\Cache\Type\Config::TYPE_IDENTIFIER);
echo "Success!";
return;
} catch (\Exception $e) {
\Magento\Framework\App\ObjectManager::getInstance()
->get('Psr\Log\LoggerInterface')->warning($e->getMessage());
}
echo "Something error, try again";
}
private function getLongToken($token)
{
$url = $this->_apiAddress->getLongTokenUrl()."?grant_type=ig_exchange_token"
."&client_secret={$this->_apiAddress->getAppSecret()}"
."&access_token={$token}";
$this->getCurlClient()->get($url);
$this->getCurlClient()
->setOptions([
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_SSL_VERIFYPEER => false
]);
return $this->getCurlClient()->getBody();
}
private function getToken($code)
{
$request = [
'code' => $code,
'client_secret' => $this->_apiAddress->getAppSecret(),
'redirect_uri' => $this->_apiAddress->redirectUri(),
'grant_type' => 'authorization_code',
'client_id' => $this->_apiAddress->getAppid(),
];
$this->getCurlClient()->post($this->_apiAddress->getTokenUrl(), $request);
$this->getCurlClient()
->setOptions([
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_SSL_VERIFYPEER => false
]);
if ($this->getCurlClient()->getStatus() != 200) {
ob_clean();
echo $this->getCurlClient()->getBody();
return [];
}
return json_decode($this->getCurlClient()->getBody(), true);
} }
} }
\ No newline at end of file
<?php
namespace Joshine\InstagramFeed\Model\Cache;
use Magento\Framework\App\Cache\Type\FrontendPool;
use Magento\Framework\Cache\Frontend\Decorator\TagScope;
class Type extends TagScope
{
const TYPE_IDENTIFIER = 'instagram_feed';
const CACHE_TAG = 'INSTAGRAM_FEED';
const CACHE_LIFETIME = 60 * 60;
/**
* @param FrontendPool $cacheFrontendPool
*/
public function __construct(FrontendPool $cacheFrontendPool)
{
parent::__construct($cacheFrontendPool->get(self::TYPE_IDENTIFIER), self::CACHE_TAG);
}
}
<?php
/** @var $block \Joshine\InstagramFeed\Block\MediaFeed */
$media = $block->getMedia()['data'];
?>
<style>
.instagram-feed-container .instagram-feed-title {
background: #fff;
font-size: 24px;
font-weight: bold;
color: #000000;
margin: 0px;
padding: 40px;
text-align: center;
}
.instagram-feed-container {
margin: 0 auto;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.instagram-feed-container .instagram-feed-block {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.instagram-media-wrapper {
cursor: pointer;
float: left;
overflow: hidden;
position: relative;
height: 244px;
width: 100%;
}
@media (max-width: 767px) {
.instagram-media-wrapper {
height: 100px;
}
#instagram-modal .instagram-media-modal-wrapper {
height: 30vh !important;
}
#instagram-modal .instagram-content-wrapper {
height: 30vh;
}
.joshine-model-warp .j-modal .j-modal-dialog {
height: 65vh;
width: 90% !important;
}
}
@media (min-width: 768px) and (max-width: 991px) {
.instagram-media-wrapper {
height: 150px;
}
#instagram-modal .instagram-media-modal-wrapper {
height: 30vh !important;
}
#instagram-modal .instagram-content-wrapper {
height: 30vh;
}
.joshine-model-warp .j-modal .j-modal-dialog {
height: 65vh;
width: 90% !important;
}
}
@media (min-width: 992px) and (max-width: 1199px) {
.instagram-media-wrapper {
height: 180px;
}
}
@media (min-width: 1200px) {
.instagram-media-wrapper {
height: 244px;
}
}
.instagram-media-wrapper .instagram-media-url {
display: block;
height: 100%;
-o-object-fit: cover;
object-fit: cover;
transition: all .2s linear;
width: 100%;
}
.instagram-media-wrapper:hover .instagram-media-url {
transform: scale(1.2);
}
.instagram-media-wrapper:hover .camera-icon-wrapper {
opacity: 1;
}
.instagram-media-wrapper .video-icon {
pointer-events: none;
position: absolute;
right: 5%;
top: 5%;
width: 10%;
}
.instagram-media-wrapper .camera-icon-wrapper {
background-color: rgba(0, 0, 0, .5);
height: 100%;
left: 0;
opacity: 0;
position: absolute;
top: 0;
width: 100%;
}
.instagram-media-wrapper .camera-icon-wrapper ._82YWzw7n {
height: 9.375%;
width: 10%;
}
.instagram-media-wrapper .camera-icon-wrapper .-JolWu6c {
left: 50%;
position: absolute;
top: 50%;
transform: translate(-50%, -50%);
}
#instagram-modal .j-modal .j-modal-content {
padding: initial;
}
#instagram-modal .instagram-media {
height: 100%;
display: block;
object-fit: contain;
}
#instagram-modal .instagram-media-modal-wrapper {
height: 600px;
background-color: #0b0b0b;
}
#instagram-modal .instagram-content-head {
align-items: center;
border-bottom: 1px solid #ededed;
display: flex;
height: 56px;
justify-content: space-between;
padding: 0 16px;
}
.joshine-font-close:after {
content: '\00d7';
}
#instagram-modal .joshine-font-close {
font-size: 2em;
cursor: pointer;
}
#instagram-modal .instagram-content-wrapper .instagram-content-head {
padding: 0 16px;
}
#instagram-modal .instagram-content-wrapper .instagram-content-body pre {
word-wrap: break-word;
border-bottom: 1px solid #eef1f6;
color: #474f5e;
font-size: 14px;
line-height: 20px;
margin: 0;
padding: 16px 0;
white-space: pre-wrap;
white-space: -moz-pre-wrap;
white-space: -pre-wrap;
white-space: -o-pre-wrap;
word-break: break-all;
}
#instagram-modal .instagram-content-wrapper .instagram-content-body {
height: calc(100% - 76px);
overflow-y: auto;
padding: 0 16px 16px;
}
#instagram-modal .instagram-content-head .instagram-view-on a {
color: #366dff;
cursor: pointer;
text-decoration: none;
}
#instagram-modal .instagram-content-date {
color: #7a8499;
font-size: 12px;
line-height: 16px;
margin: 0;
padding: 16px 0;
text-align: end;
}
</style>
<?php if (!empty($media)): ?>
<div id="joshine-section-app-block-instagram" class="joshine-section spaced-section">
<div class="container">
<div id="joshine-block-block1" class="joshine-block">
<div class="instagram-feed-container ipsc">
<h2 class="instagram-feed-title section-title title4">Follow us so you'll never miss an update</h2>
<div class="instagram-feed-block">
<?php foreach ($media as $row): ?>
<div class="joshine-col-lg-2 joshine-col-md-2 joshine-col-sm-3 joshine-col-xs-3" style="padding-right: 2px; padding-bottom: 2px;">
<div class="instagram-media-wrapper " data-feed-data='<?= json_encode($row) ?>'>
<img class="instagram-media-url"
src=" <?= $row["thumbnail_url"] ?? $row["media_url"] ?> ">
<?php if (isset($row["media_type"]) && $row["media_type"] == 'VIDEO' ) : ?>
<img class="video-icon" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAACgCAYAAACLz2ctAAAACXBIWXMAACxLAAAsSwGlPZapAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAwoSURBVHgB7Z1LTBVZGsc/RXAAAyHack3GB2bEzHT7jG2Lj4kZFuBCYySauDEhYTRutBeMC3Qxm5atJCYTzSxYidHEiJ2oG3ojPsgYZNQODydi0ky4tA8Gw0PFmKn/vXXo4qbuvVV1q26dc+r7JUVx7620Nv75f9/5zjnfWUCMlULjKjGuYsu9yLwvMj8n8zM7Zi3XZ/M+bVwzlvsEMXMsoOgCMS01rnLjKjOvEsoPECHE+N643pqvZymCREmAEFyMkkLDPV9icwpECEHGzfs0RQDdBbiMki4nLpWAM8bpN4fUEh0FCGdbaVy/J/lczitwQ4hxmDRzRl0EiPAK0SG0quZ0boEj/mJeyqO6AIXbVdFvI9SoACeEGIdIYVdUVYDI7apJf7dzCtxQSSGqJkAWXmaU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AMybxvQ8j11htkSdL3/iiTqQ80kwGxWD+W5N2QYc7eYP4QIMWPCIpQDnN2G6bW8LyoJa/EAftvQ/g2rcbhWGC4It/8mHxYWeCHM1StiFQ3ywoqQ/y5RBCaAUS4GHF8oJBaQHKBgXWPemeBByH1MEhzRK4vr4LdRnAvHpZpgQXmllyTZzyOLA1phNwwGlMEwpTZBEiGjAAVY3FpNLMRcgdPB9aQ8eVRmAQKIDyLkldbeEJuGpN0+K7sABSxEdyDcYkYj9EFGNlQRoICFmBkIb5AUaiClmgAFLMT5KCc8gaoCFAghLqXoDVbEaVaYUZI+1KZDdQFaWWleup/yCZfDggEtzvPTSYACOGEVJRc76OKKovGj0m5nh44CtIL9KHDEGKnnjHC6N6T5MRm6C9AK3LCMkmIsN7+XCTgbQut78x6J1ndREmAqWIsIES4z70Kg+QBie29emBqDw0Wy12KUBZgOuGMxJQUp7oXmtcjyvR0iP8MSMwgKrUo+mfdpy50be5r8H1jpHR4PcheiAAAAAElFTkSuQmCC">
<? endif; ?>
<div class="camera-icon-wrapper">
<svg class="-JolWu6c _82YWzw7n" width="48" height="45" viewBox="0 0 48 45" fill="none"
xmlns="http://www.w3.org/2000/svg">
<path d="M10.356 7.2L11.6664 2.9598C11.9314 2.10251 12.4639 1.3526 13.186 0.819972C13.9082 0.287341 14.7819 -1.75654e-05 15.6792 8.05315e-10H32.3208C33.2181 -1.75654e-05 34.0918 0.287341 34.814 0.819972C35.5361 1.3526 36.0686 2.10251 36.3336 2.9598L37.644 7.2H41.4C45.045 7.2 48 10.155 48 13.8V37.8C48 41.445 45.045 44.4 41.4 44.4H6.6C2.955 44.4 5.625e-08 41.445 0 37.8V13.8C0 10.155 2.955 7.2 6.6 7.2H10.356ZM11.6838 10.8H6.6C6.20603 10.8 5.81593 10.8776 5.45195 11.0284C5.08797 11.1791 4.75726 11.4001 4.47868 11.6787C4.2001 11.9573 3.97913 12.288 3.82836 12.6519C3.6776 13.0159 3.6 13.406 3.6 13.8V37.8C3.6 38.194 3.6776 38.5841 3.82836 38.948C3.97913 39.312 4.2001 39.6427 4.47868 39.9213C4.75726 40.1999 5.08797 40.4209 5.45195 40.5716C5.81593 40.7224 6.20603 40.8 6.6 40.8H41.4C41.794 40.8 42.1841 40.7224 42.548 40.5716C42.912 40.4209 43.2427 40.1999 43.5213 39.9213C43.7999 39.6427 44.0209 39.312 44.1716 38.948C44.3224 38.5841 44.4 38.194 44.4 37.8V13.8C44.4 13.406 44.3224 13.0159 44.1716 12.6519C44.0209 12.288 43.7999 11.9573 43.5213 11.6787C43.2427 11.4001 42.912 11.1791 42.548 11.0284C42.1841 10.8776 41.794 10.8 41.4 10.8H36.3162C35.9317 10.8 35.5573 10.6768 35.2478 10.4486C34.9384 10.2203 34.7102 9.89897 34.5966 9.5316L32.8938 4.023C32.856 3.90054 32.78 3.7934 32.6768 3.71728C32.5737 3.64117 32.449 3.60006 32.3208 3.6H15.6792C15.551 3.60006 15.4263 3.64117 15.3231 3.71728C15.22 3.7934 15.144 3.90054 15.1062 4.023L13.4034 9.531C13.2899 9.89848 13.0618 10.22 12.7523 10.4483C12.4429 10.6767 12.0684 10.7999 11.6838 10.8ZM24 33.6C19.0296 33.6 15 29.5704 15 24.6C15 19.6296 19.0296 15.6 24 15.6C28.9704 15.6 33 19.6296 33 24.6C33 29.5704 28.9704 33.6 24 33.6ZM24 30C25.4322 30 26.8057 29.4311 27.8184 28.4184C28.8311 27.4057 29.4 26.0322 29.4 24.6C29.4 23.1678 28.8311 21.7943 27.8184 20.7816C26.8057 19.7689 25.4322 19.2 24 19.2C22.5678 19.2 21.1943 19.7689 20.1816 20.7816C19.1689 21.7943 18.6 23.1678 18.6 24.6C18.6 26.0322 19.1689 27.4057 20.1816 28.4184C21.1943 29.4311 22.5678 30 24 30Z"
fill="white"></path>
</svg>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
</div>
</div>
<? endif; ?>
<div class="joshine-model-warp" style="display: none;" id="instagram-modal">
<div class="joshine-mask"></div>
<div class="j-modal j-modal-vertical">
<div class="j-modal-dialog j-modal-fluid joshine-col-lg-7 joshine-col-md-7 joshine-col-xs-11">
<div class="j-modal-content">
<div class="j-modal-body">
<div class="row">
<div class="joshine-col-md-7 joshine-col-xs-12 joshine-text-center instagram-media-modal-wrapper">
</div>
<div class="joshine-col-md-5 joshine-col-xs-12 instagram-content-wrapper">
<div class="instagram-content-head">
<div class="instagram-view-on">
View on <a target="_blank" class="i1wejPu-"
href="" id="instagram-link">Instagram</a>
</div>
<span title="Close (Esc)" type="button" class="joshine-font-close"
id="instagram-modal-close"></span>
</div>
<div class="instagram-content-body">
<pre id="instagram-caption">
</pre>
<p class="instagram-content-date" id="instagram-content-date">2023/04/07</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
require([
'jquery', 'ko', 'mage/translate'
], function ($, ko) {
$("#instagram-modal-close").on('click', function () {
$("#instagram-modal").hide()
});
$(".instagram-media-wrapper").on('click', function () {
let data = $(this).data("feed-data");
console.log(data);
let link = data.permalink;
let content = data.caption;
let media = data.media_url;
let date = data.timestamp;
let type = data.media_type;
if (type == "VIDEO") {
var html = `
<video class="instagram-media joshine-center-block" src="${media}" controls="" autoplay="true" webkit-playsinline="true" muted="" playsinline="true">Your browser does not support the video tag.</video>`;
} else {
var html = `
<img class="instagram-media joshine-center-block" src="${media}">
`;
}
$("#instagram-link").attr({"href":""}).attr({"href":link});
$(".instagram-media-modal-wrapper").html("").html(html);
$("#instagram-content-date").html("").html(date.substring(0, 10));
$("#instagram-caption").html("").html(content);
$("#instagram-modal").show()
});
});
</script>
\ 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:Cache/etc/cache.xsd">
<type name="instagram_feed" translate="label,description" instance="Joshine\InstagramFeed\Model\Cache\Type">
<label>Instagram Feed</label>
<description>Instagram feed cache.</description>
</type>
</config>
...@@ -100,11 +100,20 @@ $_helper = $block->getData('outputHelper'); ...@@ -100,11 +100,20 @@ $_helper = $block->getData('outputHelper');
$baseImageUrl = $productImage->getImageUrl(); $baseImageUrl = $productImage->getImageUrl();
$allImage = $_product->getMediaGalleryImages()->getItems(); $allImage = $_product->getMediaGalleryImages()->getItems();
$hoverImg = ''; $hoverImg = '';
foreach ($allImage as $img){
if (basename($baseImageUrl) != basename($img->getUrl())){ $tm_id = 0;
$hoverImg = $imageHelper->init($_product, 'product_page_image_large')->setImageFile($img->getFile())->resize($productImage->getWidth(),$productImage->getHeight())->getUrl(); $arr = [];
foreach ($allImage as $index => $img){
if (count($arr) > 3) {
break; break;
} }
if (in_array($img->getData('position'),[0,1,2])) {
$arr[] = $img;
}
}
if (isset($arr[1])) {
$hoverImg = $imageHelper->init($_product, 'product_page_image_large')->setImageFile($arr[1]->getFile())->resize($productImage->getWidth(),$productImage->getHeight())->getUrl();
} }
if ($pos != null) { if ($pos != null) {
......
...@@ -984,7 +984,7 @@ $free_price = $_helper->currency(0, true, false); ...@@ -984,7 +984,7 @@ $free_price = $_helper->currency(0, true, false);
padding: 0.1rem 0.5rem; padding: 0.1rem 0.5rem;
} }
.checkout-index-index .table-totals .grand.totals td{ .checkout-index-index .table-totals .grand.totals td{
padding-bottom:0.45rem; padding:0.45rem;
} }
/********************************************address from end****************************************************/ /********************************************address from end****************************************************/
......
...@@ -965,7 +965,7 @@ p.shopbycate-title { ...@@ -965,7 +965,7 @@ p.shopbycate-title {
transition: all .3s; transition: all .3s;
} }
.checkout-cart-index #cart-totals table td,.checkout-cart-index #cart-totals table th { .checkout-cart-index #cart-totals table td,.checkout-cart-index #cart-totals table th {
padding: 0.2rem 0.5rem; padding: 0.2rem 0.5rem 0.2rem 0px;
} }
.catalog-product-view .recently-viewed .flash-sale-info .price-final_price .normal-price{ .catalog-product-view .recently-viewed .flash-sale-info .price-final_price .normal-price{
float:right; float:right;
......
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