ltsecurityinc安防产品在线商城代码
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Olegnax
|
||||
* @package Olegnax_BrandSlider
|
||||
* @copyright Copyright (c) 2023 Olegnax (http://olegnax.com/). All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
namespace Olegnax\BrandSlider\Block\Adminhtml\System\Config\Form;
|
||||
|
||||
class Info extends \Olegnax\Core\Block\Adminhtml\System\Config\Form\Info
|
||||
{
|
||||
}
|
||||
|
||||
+151
@@ -0,0 +1,151 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Olegnax BrandSlider
|
||||
*
|
||||
* This file is part of Olegnax/Core.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Olegnax.com license that is
|
||||
* available through the world-wide-web at this URL:
|
||||
* https://www.olegnax.com/license
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this extension to newer
|
||||
* version in the future.
|
||||
*
|
||||
* @category Olegnax
|
||||
* @package Olegnax_BrandSlider
|
||||
* @copyright Copyright (c) 2023 Olegnax (http://www.olegnax.com/)
|
||||
* @license https://www.olegnax.com/license
|
||||
*/
|
||||
|
||||
namespace Olegnax\BrandSlider\Block;
|
||||
|
||||
use Magento\Customer\Model\Context;
|
||||
use Magento\Framework\App\ObjectManager;
|
||||
use Magento\Framework\Serialize\Serializer\Json;
|
||||
use Magento\Framework\View\Element\Template;
|
||||
use Magento\Widget\Block\BlockInterface;
|
||||
use Olegnax\BrandSlider\Helper\Helper;
|
||||
|
||||
class BrandSlider extends Template implements BlockInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\App\Http\Context
|
||||
*/
|
||||
protected $httpContext;
|
||||
|
||||
/**
|
||||
* Json Serializer Instance
|
||||
*
|
||||
* @var Json
|
||||
*/
|
||||
private $json;
|
||||
/**
|
||||
* @var Helper
|
||||
*/
|
||||
private $helper;
|
||||
|
||||
public function __construct(
|
||||
Template\Context $context,
|
||||
\Magento\Framework\App\Http\Context $httpContext,
|
||||
Helper $helper,
|
||||
array $data = [],
|
||||
Json $json = null
|
||||
) {
|
||||
$this->httpContext = $httpContext;
|
||||
$this->helper = $helper;
|
||||
$this->json = $json ?: ObjectManager::getInstance()->get(Json::class);
|
||||
parent::__construct($context, $data);
|
||||
}
|
||||
|
||||
public function getCacheKeyInfo($newval = [])
|
||||
{
|
||||
return array_merge([
|
||||
'OLEGNAX_BRANDSLIDER_WIDGET',
|
||||
$this->_storeManager->getStore()->getId(),
|
||||
$this->_design->getDesignTheme()->getId(),
|
||||
$this->httpContext->getValue(Context::CONTEXT_GROUP),
|
||||
$this->json->serialize($this->getRequest()->getParams()),
|
||||
$this->json->serialize($this->getData()),
|
||||
], parent::getCacheKeyInfo(), $newval);
|
||||
}
|
||||
|
||||
public function getSliderId()
|
||||
{
|
||||
return 'ox_' . $this->getNameInLayout();
|
||||
}
|
||||
|
||||
public function prepareStyle(array $style, string $separatorValue = ': ', string $separatorAttribute = ';')
|
||||
{
|
||||
$style = array_filter($style);
|
||||
if (empty($style)) {
|
||||
return '';
|
||||
}
|
||||
foreach ($style as $key => &$value) {
|
||||
$value = $key . $separatorValue . $value;
|
||||
}
|
||||
$style = implode($separatorAttribute, $style);
|
||||
|
||||
return $style;
|
||||
}
|
||||
public function getResponsive($to_string = true)
|
||||
{
|
||||
$width = $this->getWidth();
|
||||
$responsive = [
|
||||
0 => [
|
||||
'items' => 1,
|
||||
],
|
||||
];
|
||||
$j = 1;
|
||||
for ($i = $width + 1; $i < 3000; $i += $width) {
|
||||
$j++;
|
||||
$responsive[$i] = [
|
||||
'items' => $j,
|
||||
];
|
||||
}
|
||||
|
||||
if ($to_string) {
|
||||
return json_encode($responsive);
|
||||
}
|
||||
|
||||
return $responsive;
|
||||
}
|
||||
|
||||
public function getAutoScroll()
|
||||
{
|
||||
$auto_scroll = $this->getData('auto_scroll');
|
||||
if (empty($auto_scroll)) {
|
||||
$auto_scroll = 0;
|
||||
}
|
||||
|
||||
return $auto_scroll;
|
||||
}
|
||||
|
||||
public function getItems()
|
||||
{
|
||||
$_attr = $this->getData('items_attr') ?: '';
|
||||
return $this->helper->getItems($this->getData('items_list'), $_attr);
|
||||
}
|
||||
|
||||
public function getBrandUrl($item)
|
||||
{
|
||||
return $this->getUrl('catalogsearch/result/') . '?q=' . $item->getLabel();
|
||||
}
|
||||
|
||||
protected function _construct()
|
||||
{
|
||||
$this->addData([
|
||||
'cache_lifetime' => 86400,
|
||||
]);
|
||||
if (!$this->hasData('template') && !$this->getTemplate()) {
|
||||
$this->setTemplate('Olegnax_BrandSlider::brandslider.phtml');
|
||||
}
|
||||
parent::_construct();
|
||||
}
|
||||
|
||||
}
|
||||
+278
@@ -0,0 +1,278 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Olegnax
|
||||
* @package Olegnax_BrandSlider
|
||||
* @copyright Copyright (c) 2023 Olegnax (http://olegnax.com/). All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
* @noinspection PhpDeprecationInspection
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
namespace Olegnax\BrandSlider\Helper;
|
||||
|
||||
use Magento\Catalog\Model\Product;
|
||||
use Magento\Catalog\Model\Product\Attribute\Repository;
|
||||
use Magento\Eav\Model\Entity\Attribute\Option;
|
||||
use Magento\Framework\App\Filesystem\DirectoryList;
|
||||
use Magento\Framework\App\Helper\Context;
|
||||
use Magento\Framework\Escaper;
|
||||
use Magento\Framework\Exception\NoSuchEntityException;
|
||||
use Magento\Framework\Filesystem;
|
||||
use Magento\Framework\Phrase;
|
||||
use Magento\Framework\UrlInterface;
|
||||
use Olegnax\Core\Helper\Helper as CoreHelperHelper;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class Helper extends CoreHelperHelper
|
||||
{
|
||||
const HIDE_PRODUCT_DEFAULT = true;
|
||||
const BRANDS_PATH_SMALL = 'wysiwyg/brands/small/';
|
||||
const BRANDS_PATH = 'wysiwyg/brands/';
|
||||
|
||||
const CONFIG_MODULE = 'olegnax_brandslider';
|
||||
const XML_PATH_ATTRIBUTE_CODE = 'general/attribute_code';
|
||||
|
||||
protected $repository;
|
||||
protected $_mediaDirectory;
|
||||
|
||||
/**
|
||||
* @var array|null
|
||||
*/
|
||||
protected $items;
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $absolutePath;
|
||||
/**
|
||||
* @var Escaper
|
||||
*/
|
||||
private $escaper;
|
||||
/**
|
||||
* @var Image
|
||||
*/
|
||||
private $image;
|
||||
private $defaultOptions;
|
||||
|
||||
/**
|
||||
* Helper constructor.
|
||||
* @param Context $context
|
||||
* @param Repository $repository
|
||||
* @param Escaper $escaper
|
||||
* @param Image $image
|
||||
* @param Filesystem $filesystem
|
||||
*/
|
||||
public function __construct(
|
||||
Context $context,
|
||||
LoggerInterface $logger,
|
||||
Repository $repository,
|
||||
Escaper $escaper,
|
||||
Image $image,
|
||||
Filesystem $filesystem
|
||||
) {
|
||||
$this->repository = $repository;
|
||||
$this->escaper = $escaper;
|
||||
$this->image = $image;
|
||||
$this->_mediaDirectory = $filesystem->getDirectoryRead(DirectoryList::MEDIA);
|
||||
parent::__construct($context, $logger);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $itemsList
|
||||
* @return array|mixed|null
|
||||
* @throws NoSuchEntityException
|
||||
*/
|
||||
|
||||
public function getItems($itemsList = '', $attribute = '')
|
||||
{
|
||||
$attributeCode = $this->getAttribute();
|
||||
if( $attribute && '' !== $attribute){
|
||||
$attributeCode = $attribute;
|
||||
}
|
||||
if(!$attributeCode){
|
||||
return [];
|
||||
}
|
||||
if (!isset($this->items[$attributeCode][$itemsList]) || empty($this->items[$attributeCode][$itemsList])) {
|
||||
$this->items[$attributeCode][$itemsList] = [];
|
||||
if ($attributeCode == '') {
|
||||
return $this->items;
|
||||
}
|
||||
|
||||
/** @var Option[]|null $options */
|
||||
$options = $this->repository->get($attributeCode)->getOptions();
|
||||
if (!empty($options) && is_array($options)) {
|
||||
array_shift($options);
|
||||
$_itemsList = !empty($itemsList) ? array_filter(array_map('trim', explode(',', (string)$itemsList))) : '';
|
||||
if (!empty($_itemsList)) {
|
||||
foreach ($options as &$option) {
|
||||
$label = $this->getDefaultLabel($option->getValue(), $option->getLabel());
|
||||
if (in_array($label, $_itemsList)) {
|
||||
$option->setData('image_name', $this->getFileName($label));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach ($options as &$option) {
|
||||
$label = $this->getDefaultLabel($option->getValue(), $option->getLabel());
|
||||
$option->setData('image_name', $this->getFileName($label));
|
||||
}
|
||||
}
|
||||
$this->items[$attributeCode][$itemsList] = $options;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->items[$attributeCode][$itemsList];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAttribute()
|
||||
{
|
||||
return $this->getModuleConfig(self::XML_PATH_ATTRIBUTE_CODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param string $path
|
||||
* @param bool $returnBool
|
||||
* @return bool|string
|
||||
*/
|
||||
public function getFileName($name, $path = self::BRANDS_PATH, $returnBool = false)
|
||||
{
|
||||
if (!is_array($this->absolutePath)) {
|
||||
$this->absolutePath = [];
|
||||
}
|
||||
if (!array_key_exists($path, $this->absolutePath)) {
|
||||
$this->absolutePath[$path] = $this->_mediaDirectory->getAbsolutePath($path);
|
||||
}
|
||||
$name = str_replace(
|
||||
[' ', '\'', '/', ':', '*', '?', '"', '<', '>', '|', '+', '.'],
|
||||
'_',
|
||||
strtolower($name)
|
||||
);
|
||||
$absolutePath = $this->absolutePath[$path];
|
||||
$paths = glob($absolutePath . $name . '.*');
|
||||
if (!empty($paths)) {
|
||||
$file_name = basename(array_shift($paths));
|
||||
return $path . $file_name;
|
||||
}
|
||||
if ($returnBool) {
|
||||
return false;
|
||||
}
|
||||
return $path . $name . '.png';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Product $product
|
||||
* @param bool $isBig
|
||||
* @param array $size
|
||||
* @param string $class
|
||||
* @return string
|
||||
*/
|
||||
public function getProductBrandImage($product, $isBig = false, $size = [], $class = '')
|
||||
{
|
||||
$attributeCode = $this->getAttribute();
|
||||
|
||||
if (empty($attributeCode) || !$attributeCode || !$this->checkAttrExist($attributeCode)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$width = $height = '';
|
||||
$attribute = $this->getProductAttributeText($product, $attributeCode);
|
||||
if (is_array($attribute)) {
|
||||
$attribute = array_shift($attribute);
|
||||
}
|
||||
if ($attribute) {
|
||||
$fileName = $this->getFileName(
|
||||
$attribute,
|
||||
($isBig ? self::BRANDS_PATH : self::BRANDS_PATH_SMALL),
|
||||
self::HIDE_PRODUCT_DEFAULT
|
||||
);
|
||||
if ($fileName) {
|
||||
$url = $this->getBaseUrl(UrlInterface::URL_TYPE_MEDIA) . $fileName;
|
||||
if (is_array($size)) {
|
||||
$size = array_filter($size);
|
||||
$width = ' width="' . $size[0] . '" ';
|
||||
$height = ' height="' . $size[1] . '" ';
|
||||
}
|
||||
if (!empty($size)) {
|
||||
$url = $this->image->adaptiveResize($fileName, $size)->getUrl();
|
||||
}
|
||||
return '<img
|
||||
src="' . $this->escaper->escapeUrl($url) . '"
|
||||
alt="' . $this->escaper->escapeHtmlAttr($attribute) . '"
|
||||
' . $width . '
|
||||
' . $height . '
|
||||
class="ox-product-grid__brand-image ' . $this->escaper->escapeHtmlAttr($class) . '" />';
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Product $product
|
||||
* @param string $attributeCode
|
||||
* @return bool|Phrase
|
||||
*/
|
||||
private function getProductAttributeText($product, $attributeCode)
|
||||
{
|
||||
return $this->getDefaultLabel($product->getData($attributeCode), $product->getAttributeText($attributeCode));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $value
|
||||
* @param bool $default
|
||||
* @return bool|string
|
||||
*/
|
||||
private function getDefaultLabel($value, $default = false)
|
||||
{
|
||||
if (true) { // @todo add option check whether to use default names from admin panel?
|
||||
$options = $this->getDefaultOptions();
|
||||
if (is_array($options) && isset($options[$value])) {
|
||||
return $options[$value];
|
||||
}
|
||||
}
|
||||
|
||||
return $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
private function getDefaultOptions()
|
||||
{
|
||||
if (empty($this->defaultOptions)) {
|
||||
$attributeCode = $this->getAttribute();
|
||||
try {
|
||||
$defaultOptions = $this->repository
|
||||
->get($attributeCode)
|
||||
->getSource()
|
||||
->getAllOptions(false, true);
|
||||
} catch (NoSuchEntityException $e) {
|
||||
$defaultOptions = null;
|
||||
}
|
||||
if (!empty($defaultOptions) && is_array($defaultOptions)) {
|
||||
$this->defaultOptions = [];
|
||||
foreach ($defaultOptions as $option) {
|
||||
$this->defaultOptions[$option['value']] = $option['label'];
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this->defaultOptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function checkAttrExist($attributeCode = "") {
|
||||
try {
|
||||
$this->repository->get($attributeCode);
|
||||
return true;
|
||||
} catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
|
||||
$error_message = 'Olegnax BrandSlider: ';
|
||||
$this->_logger->critical( $error_message . $e->getMessage() );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+595
@@ -0,0 +1,595 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Image helper
|
||||
*
|
||||
* Copyright © 2023 Olegnax. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
namespace Olegnax\BrandSlider\Helper;
|
||||
|
||||
use Exception;
|
||||
use Magento\Framework\App\Filesystem\DirectoryList;
|
||||
use Magento\Framework\App\Helper\AbstractHelper;
|
||||
use Magento\Framework\Filesystem;
|
||||
use Magento\Framework\Filesystem\Directory\WriteInterface;
|
||||
use Magento\Framework\Image as MagentoImage;
|
||||
use Magento\Framework\Image\AdapterFactory;
|
||||
use Magento\Framework\Image\Factory;
|
||||
use Magento\Framework\UrlInterface;
|
||||
use Magento\Store\Model\StoreManagerInterface;
|
||||
|
||||
/**
|
||||
* Description of Image
|
||||
*
|
||||
* @author Master
|
||||
*/
|
||||
class Image extends AbstractHelper {
|
||||
|
||||
const DEST_FOLDER = 'bandsresized';
|
||||
public $_imageExist;
|
||||
protected $_baseFile;
|
||||
protected $_resizedFile;
|
||||
/**
|
||||
* @var AdapterFactory
|
||||
*/
|
||||
protected $adapterFactory;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $cachePrefix = 'IMG_INFO';
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $_width;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $_height;
|
||||
|
||||
/**
|
||||
* Default quality value (for JPEG images only).
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $_quality = 80;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $_keepAspectRatio = true;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $_keepFrame = true;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $_keepTransparency = true;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $_constrainOnly = true;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $_cropOnly = false;
|
||||
|
||||
/**
|
||||
* @var int[]
|
||||
*/
|
||||
protected $_backgroundColor = [ 255, 255, 255 ];
|
||||
|
||||
/**
|
||||
* @var MagentoImage
|
||||
*/
|
||||
protected $_processor;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_destinationSubdir;
|
||||
|
||||
/**
|
||||
* Store Manager
|
||||
*
|
||||
* @var StoreManagerInterface
|
||||
*/
|
||||
private $_storeManager;
|
||||
|
||||
/**
|
||||
* @var WriteInterface
|
||||
*/
|
||||
protected $_mediaDirectory;
|
||||
/**
|
||||
* @var Factory
|
||||
*/
|
||||
private $_imageFactory;
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $attributes;
|
||||
|
||||
public function __construct(
|
||||
Filesystem $filesystem,
|
||||
Factory $imageFactory,
|
||||
StoreManagerInterface $storeManager,
|
||||
AdapterFactory $adapterFactory
|
||||
) {
|
||||
$this->_mediaDirectory = $filesystem->getDirectoryRead(DirectoryList::MEDIA);
|
||||
$this->_imageFactory = $imageFactory;
|
||||
$this->_storeManager = $storeManager;
|
||||
$this->adapterFactory = $adapterFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function checkDependencies() {
|
||||
try {
|
||||
$this->adapterFactory->create();
|
||||
return true;
|
||||
} catch (Exception $e) {
|
||||
$this->_logger->critical($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function adaptiveResize($file, $size, $attributes = [])
|
||||
{
|
||||
if ($this->checkDependencies()) {
|
||||
$this->init($file, $attributes);
|
||||
[$width, $height] = $this->prepareSize($size);
|
||||
$this->setWidth($width);
|
||||
$this->setHeight($height);
|
||||
if (0 < $this->getWidth() && 0 < $this->getHeight() && (bool)$this->getFullPath()) {
|
||||
if ($this->_keepAspectRatio && $this->_cropOnly) {
|
||||
$this->crop();
|
||||
}
|
||||
$this->resize();
|
||||
} else {
|
||||
$this->_resizedFile = $this->_baseFile;
|
||||
}
|
||||
} else {
|
||||
$this->_resizedFile = $this->_baseFile;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
private function prepareSize( $size ) {
|
||||
if ( is_array( $size ) && 1 >= count( $size ) ) {
|
||||
$size = array_shift( $size );
|
||||
}
|
||||
if ( !is_array( $size ) ) {
|
||||
$size = [ $size, $size ];
|
||||
}
|
||||
$size = array_map( 'intval', $size );
|
||||
$size = array_map( 'abs', $size );
|
||||
return $size;
|
||||
}
|
||||
|
||||
public function init( $file, $attributes = [] ) {
|
||||
$this->_processor = null;
|
||||
$this->_resizedFile = null;
|
||||
|
||||
$this->setBaseFile( $file );
|
||||
|
||||
$this->attributes = $attributes;
|
||||
$this->setImageProperties();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve image attribute
|
||||
*
|
||||
* @param string $name
|
||||
* @return string
|
||||
*/
|
||||
protected function getAttribute( $name ) {
|
||||
return $this->attributes[ $name ] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set image properties
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
protected function setImageProperties() {
|
||||
$this->setDestinationSubdir( self::DEST_FOLDER );
|
||||
|
||||
|
||||
// Set 'keep frame' flag
|
||||
$frame = $this->getAttribute( 'frame' );
|
||||
if ( !empty( $frame ) ) {
|
||||
$this->setKeepFrame( $frame );
|
||||
}
|
||||
|
||||
// Set 'constrain only' flag
|
||||
$constrain = $this->getAttribute( 'constrain' );
|
||||
if ( !empty( $constrain ) ) {
|
||||
$this->setConstrainOnly( $constrain );
|
||||
}
|
||||
|
||||
// Set 'keep aspect ratio' flag
|
||||
$aspectRatio = $this->getAttribute( 'aspect_ratio' );
|
||||
if ( !empty( $aspectRatio ) ) {
|
||||
$this->setKeepAspectRatio( $aspectRatio );
|
||||
}
|
||||
|
||||
|
||||
// Set 'keep $crop' flag
|
||||
$crop = $this->getAttribute( 'crop' );
|
||||
if ( !empty( $crop ) ) {
|
||||
$this->seCropOnly( $crop );
|
||||
}
|
||||
|
||||
// Set 'transparency' flag
|
||||
$transparency = $this->getAttribute( 'transparency' );
|
||||
if ( !empty( $transparency ) ) {
|
||||
$this->setKeepTransparency( $transparency );
|
||||
}
|
||||
|
||||
// Set background color
|
||||
$background = $this->getAttribute( 'background' );
|
||||
if ( !empty( $background ) ) {
|
||||
$this->setBackgroundColor( $background );
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $dir
|
||||
* @return $this
|
||||
*/
|
||||
public function setDestinationSubdir( $dir ) {
|
||||
$this->_destinationSubdir = $dir;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDestinationSubdir() {
|
||||
return $this->_destinationSubdir;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param MagentoImage $processor
|
||||
* @return $this
|
||||
*/
|
||||
public function setImageProcessor( $processor ) {
|
||||
$this->_processor = $processor;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function crop() {
|
||||
if ( $this->getWidth() === null && $this->getHeight() === null ) {
|
||||
return $this;
|
||||
}
|
||||
if ( $this->_fileExists( $this->getResizedFile() ) ) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
$_imageSrcWidth = $this->getImageProcessor()->getOriginalWidth();
|
||||
$_imageSrcHeight = $this->getImageProcessor()->getOriginalHeight();
|
||||
$_imageSrcRatio = $_imageSrcWidth / $_imageSrcHeight;
|
||||
$_ratio = $this->_width / $this->_height;
|
||||
|
||||
if ( $_imageSrcRatio != $_ratio ) {
|
||||
if ( 1 > $_imageSrcRatio ) {
|
||||
$newHeight = round( $_imageSrcWidth / $_ratio );
|
||||
$deltHeight = $_imageSrcHeight - $newHeight;
|
||||
|
||||
$_deltHeight = floor( $deltHeight / 2 );
|
||||
$__deltHeight = $deltHeight % 2;
|
||||
|
||||
$this->getImageProcessor()->crop( $_deltHeight + $__deltHeight, 0, 0, $_deltHeight );
|
||||
} elseif ( 1 < $_imageSrcRatio ) {
|
||||
$newWidth = round( $_imageSrcHeight * $_ratio );
|
||||
$deltWidth = $_imageSrcWidth - $newWidth;
|
||||
|
||||
$_deltWidth = floor( $deltWidth / 2 );
|
||||
$__deltWidth = $deltWidth % 2;
|
||||
|
||||
$this->getImageProcessor()->crop( 0, $_deltWidth + $__deltWidth, $_deltWidth, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see \Magento\Framework\Image\Adapter\AbstractAdapter
|
||||
* @return $this
|
||||
*/
|
||||
public function resize() {
|
||||
if ( $this->getWidth() === null && $this->getHeight() === null ) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
$resizedFile = $this->getResizedFile();
|
||||
if ( $resizedFile && $this->_fileExists( $resizedFile ) ) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
$new_filename = $this->_mediaDirectory->getAbsolutePath( $resizedFile );
|
||||
$_processor = $this->getImageProcessor();
|
||||
if ( $_processor ) {
|
||||
$_processor->resize( $this->_width, $this->_height );
|
||||
$_processor->save( $new_filename );
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getFullPath() {
|
||||
$filename = $this->getBaseFile();
|
||||
if ( $this->_fileExists( $filename ) ) {
|
||||
$filename = $this->_mediaDirectory->getAbsolutePath( $filename );
|
||||
|
||||
return $filename;
|
||||
} else {
|
||||
//file_put_contents(BP . '/var/log/oxbrands.log', print_r($filename, true) . "\n", FILE_APPEND);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MagentoImage
|
||||
*/
|
||||
public function getImageProcessor() {
|
||||
if ( !$this->_processor ) {
|
||||
$filename = $this->getFullPath();
|
||||
$this->_processor = $this->_imageFactory->create( $filename );
|
||||
}
|
||||
$this->_processor->keepAspectRatio( $this->_keepAspectRatio );
|
||||
$this->_processor->keepFrame( $this->_keepFrame );
|
||||
$this->_processor->keepTransparency( $this->_keepTransparency );
|
||||
$this->_processor->constrainOnly( $this->_constrainOnly );
|
||||
$this->_processor->backgroundColor( $this->_backgroundColor );
|
||||
$this->_processor->quality( $this->_quality );
|
||||
|
||||
return $this->_processor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getBaseFile() {
|
||||
return $this->_baseFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set filenames for base file and new file
|
||||
*
|
||||
* @param string $file
|
||||
* @return $this
|
||||
* @throws Exception
|
||||
*/
|
||||
public function setBaseFile( $file ) {
|
||||
$this->_baseFile = $file;
|
||||
return $this;
|
||||
}
|
||||
|
||||
private function getResizedFile() {
|
||||
if ( empty( $this->_resizedFile ) ) {
|
||||
$baseFile = $this->getBaseFile();
|
||||
if ( !empty( $baseFile ) ) {
|
||||
$new_filename = pathinfo( $baseFile );
|
||||
if ( is_array( $new_filename ) && !empty( $new_filename ) ) {
|
||||
$new_filename[ 'filename' ] = implode( '_', [ $new_filename[ 'filename' ], $this->getWidth(), $this->getHeight() ] ) . '.' . $new_filename[ 'extension' ];
|
||||
$this->_resizedFile = implode( '/', [ $this->getDestinationSubdir(), $new_filename[ 'dirname' ], $new_filename[ 'filename' ] ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_resizedFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* First check this file on FS
|
||||
* If it doesn't exist - try to download it from DB
|
||||
*
|
||||
* @param string $filename
|
||||
* @return bool
|
||||
*/
|
||||
protected function _fileExists( $filename ) {
|
||||
$path = $this->_mediaDirectory->getAbsolutePath( $filename );
|
||||
$this->_imageExist = !empty( $filename ) && file_exists( $path ) && !is_dir( $path );
|
||||
return $this->_imageExist;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $width
|
||||
* @return $this
|
||||
*/
|
||||
public function setWidth( $width ) {
|
||||
$this->_width = $width;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getWidth() {
|
||||
return $this->_width;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $height
|
||||
* @return $this
|
||||
*/
|
||||
public function setHeight( $height ) {
|
||||
$this->_height = $height;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getHeight() {
|
||||
return $this->_height;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set image quality, values in percentage from 0 to 100
|
||||
*
|
||||
* @param int $quality
|
||||
* @return $this
|
||||
*/
|
||||
public function setQuality( $quality ) {
|
||||
$this->_quality = $quality;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get image quality
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getQuality() {
|
||||
return $this->_quality;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getUrl() {
|
||||
return $this->_storeManager->getStore()->getBaseUrl( UrlInterface::URL_TYPE_MEDIA ) . ( $this->getResizedFile() ?: $this->getBaseFile());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $keep
|
||||
* @return $this
|
||||
*/
|
||||
public function setKeepAspectRatio( $keep ) {
|
||||
$this->_keepAspectRatio = $keep && $keep !== 'false';
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $keep
|
||||
* @return $this
|
||||
*/
|
||||
public function setKeepFrame( $keep ) {
|
||||
$this->_keepFrame = $keep && $keep !== 'false';
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $keep
|
||||
* @return $this
|
||||
*/
|
||||
public function setKeepTransparency( $keep ) {
|
||||
$this->_keepTransparency = $keep && $keep !== 'false';
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $flag
|
||||
* @return $this
|
||||
*/
|
||||
public function setConstrainOnly( $flag ) {
|
||||
$this->_constrainOnly = $flag && $flag !== 'false';
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $flag
|
||||
* @return $this
|
||||
*/
|
||||
public function seCropOnly( $flag ) {
|
||||
$this->_cropOnly = $flag && $flag !== 'false';
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int[] $rgbArray
|
||||
* @return $this
|
||||
*/
|
||||
public function setBackgroundColor( array $rgbArray ) {
|
||||
$this->_backgroundColor = $rgbArray;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $size
|
||||
* @return $this
|
||||
*/
|
||||
public function setSize( $size ) {
|
||||
// determine width and height from string
|
||||
$width = $height = 0;
|
||||
|
||||
if ( is_numeric( $size ) ) {
|
||||
$width = $height = $size;
|
||||
} elseif ( is_array( $size ) ) {
|
||||
if ( 1 >= count( $size ) ) {
|
||||
[$width, $height] = $size;
|
||||
} else {
|
||||
$width = $height = array_shift( $size );
|
||||
}
|
||||
} elseif ( is_string( $size ) ) {
|
||||
[$width, $height] = explode( 'x', strtolower( $size ), 2 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
foreach ( [ 'width', 'height' ] as $wh ) {
|
||||
${$wh} = (int) ${$wh};
|
||||
if ( empty( ${$wh} ) ) {
|
||||
${$wh} = null;
|
||||
}
|
||||
}
|
||||
|
||||
// set sizes
|
||||
$this->setWidth( $width )->setHeight( $height );
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get image size
|
||||
*
|
||||
* @param string $imagePath
|
||||
* @return array
|
||||
*/
|
||||
private function getImageSize( $imagePath ) {
|
||||
$imageSize = getimagesize( $imagePath );
|
||||
return $imageSize;
|
||||
}
|
||||
|
||||
public function removeResized( $file ) {
|
||||
if ( !empty( $file ) ) {
|
||||
$this->init( $file );
|
||||
}
|
||||
$file = $this->getBaseFile();
|
||||
|
||||
if ( !empty( $file ) ) {
|
||||
$new_filename = pathinfo( $file );
|
||||
$new_filename[ 'filename' ] = implode( '_', [ $new_filename[ 'filename' ], '*' ] ) . '.' . $new_filename[ 'extension' ];
|
||||
$pattern = implode( '/', [ $this->getDestinationSubdir(), $new_filename[ 'dirname' ], $new_filename[ 'filename' ] ] );
|
||||
$pattern = $this->_mediaDirectory->getAbsolutePath( $pattern );
|
||||
$files = (array) @glob( $pattern );
|
||||
if ( !empty( $files ) ) {
|
||||
foreach ( $files as $_file ) {
|
||||
if ( file_exists( $_file ) ) {
|
||||
@unlink( $_file );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Olegnax\BrandSlider\Model\Config\Source;
|
||||
|
||||
use Magento\Catalog\Model\ResourceModel\Product\Attribute\CollectionFactory;
|
||||
use Magento\Framework\Option\ArrayInterface;
|
||||
|
||||
class BrandAttribute implements ArrayInterface
|
||||
{
|
||||
|
||||
protected $collectionFactory;
|
||||
|
||||
public function __construct( CollectionFactory $collectionFactory)
|
||||
{
|
||||
$this->collectionFactory = $collectionFactory;
|
||||
}
|
||||
|
||||
public function toOptionArray()
|
||||
{
|
||||
$options = [];
|
||||
foreach ($this->_getOptions() as $optionValue => $optionLabel) {
|
||||
$options[] = ['value' => $optionValue, 'label' => $optionLabel];
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
||||
public function toArray()
|
||||
{
|
||||
return $this->_getOptions();
|
||||
}
|
||||
|
||||
protected function _getOptions()
|
||||
{
|
||||
$collection = $this->collectionFactory->create();
|
||||
$collection->addIsFilterableFilter();
|
||||
$collection->addOrder('attribute_code', 'asc');
|
||||
|
||||
$options = ['' => __('-- Empty --')];
|
||||
foreach ($collection->getItems() as $attribute) {
|
||||
$options[$attribute->getAttributeCode()] = $attribute->getAttributeCode();
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
<?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="Olegnax_Core::Olegnax_Core">
|
||||
<resource id="Olegnax_BrandSlider::brandslider" sortOrder="10" title="Brand Slider"/>
|
||||
</resource>
|
||||
</resource>
|
||||
</resources>
|
||||
</acl>
|
||||
</config>
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
<?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>
|
||||
<add id="Olegnax_BrandSlider::brandslider" title="Brands" translate="title" module="Olegnax_BrandSlider" sortOrder="999" parent="Olegnax_Core::Olegnax_Core" resource="Olegnax_BrandSlider::brandslider"/>
|
||||
<add id="Olegnax_BrandSlider::config" title="Configuration" translate="title" module="Olegnax_BrandSlider" sortOrder="20" action="adminhtml/system_config/edit/section/olegnax_brandslider" parent="Olegnax_BrandSlider::brandslider" resource="Olegnax_BrandSlider::brandslider"/>
|
||||
</menu>
|
||||
</config>
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
<?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>
|
||||
<tab id="olegnax" sortOrder="999" translate="label">
|
||||
<label>Olegnax</label>
|
||||
</tab>
|
||||
<section id="olegnax_brandslider" showInDefault="1" showInStore="1" showInWebsite="1" sortOrder="10" translate="label">
|
||||
<label>Brand Slider</label>
|
||||
<tab>olegnax</tab>
|
||||
<resource>Olegnax_BrandSlider::brandslider</resource>
|
||||
<group id="info" showInDefault="1" showInStore="1" showInWebsite="1" sortOrder="0" translate="label">
|
||||
<frontend_model>Olegnax\BrandSlider\Block\Adminhtml\System\Config\Form\Info</frontend_model>
|
||||
</group>
|
||||
<group id="general" showInDefault="1" showInStore="1" showInWebsite="1" sortOrder="10" translate="label">
|
||||
<label>General</label>
|
||||
<field id="attribute_code" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
|
||||
<label>Brand Attribute</label>
|
||||
<comment>Choose attribute that will be used in brands slider.</comment>
|
||||
<source_model>Olegnax\BrandSlider\Model\Config\Source\BrandAttribute</source_model>
|
||||
</field>
|
||||
</group>
|
||||
</section>
|
||||
</system>
|
||||
</config>
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
<?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>
|
||||
<olegnax_brandslider>
|
||||
<general>
|
||||
<attribute_code/>
|
||||
</general>
|
||||
</olegnax_brandslider>
|
||||
</default>
|
||||
</config>
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
<?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="Olegnax_BrandSlider" setup_version="0.1.2.1">
|
||||
<sequence>
|
||||
<module name="Magento_Catalog"/>
|
||||
<module name="Olegnax_Core"/>
|
||||
</sequence>
|
||||
</module>
|
||||
</config>
|
||||
Executable
+114
@@ -0,0 +1,114 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<widgets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Widget:etc/widget.xsd">
|
||||
<widget id="ox_brand_slider" class="Olegnax\BrandSlider\Block\BrandSlider" is_email_compatible="true"
|
||||
placeholder_image="Olegnax_BrandSlider::images/products_list.png" ttl="86400">
|
||||
<label translate="true">Olegnax - Brand Slider</label>
|
||||
<description translate="true"></description>
|
||||
<parameters>
|
||||
<parameter name="items_attr" xsi:type="text" visible="true">
|
||||
<label translate="true">Custom Attribute</label>
|
||||
<description translate="true"><![CDATA[Optional. You can set specific attribute insterad of global attribute.]]></description>
|
||||
<value></value>
|
||||
</parameter>
|
||||
<parameter name="items_list" xsi:type="text" visible="true">
|
||||
<label translate="true">List of Brands</label>
|
||||
<description translate="true"><![CDATA[Optional. Add brand names separated by comma.]]></description>
|
||||
<value></value>
|
||||
</parameter>
|
||||
<parameter name="height" xsi:type="text" visible="true">
|
||||
<label translate="true">Image Height</label>
|
||||
<value>200</value>
|
||||
</parameter>
|
||||
<parameter name="width" xsi:type="text" visible="true">
|
||||
<label translate="true">Image Width</label>
|
||||
<value>200</value>
|
||||
</parameter>
|
||||
<parameter name="auto_scroll" xsi:type="text" visible="true">
|
||||
<label translate="true">Autoscroll</label>
|
||||
<description translate="true"><![CDATA[Set to 0 to disable autoscroll</br>Set to 1-10 to enable autoscroll ( scroll timeout - autoscroll * 1000ms ) ]]></description>
|
||||
</parameter>
|
||||
<parameter name="scroll_items" xsi:type="select" visible="true">
|
||||
<label translate="true">Items to scroll</label>
|
||||
<options>
|
||||
<option name="item" value="1" selected="true">
|
||||
<label translate="true">Scroll per item</label>
|
||||
</option>
|
||||
<option name="page" value="page">
|
||||
<label translate="true">Scroll per page</label>
|
||||
</option>
|
||||
</options>
|
||||
</parameter>
|
||||
<parameter name="rewind" xsi:type="select" visible="true" source_model="Olegnax\Core\Model\Config\Source\Noyes">
|
||||
<label translate="true">Rewind</label>
|
||||
<description translate="true">Slide to first item or stop at last item</description>
|
||||
</parameter>
|
||||
<parameter name="nav" xsi:type="select" visible="true">
|
||||
<label translate="true">Show Arrows</label>
|
||||
<options>
|
||||
<option name="show" value="show" selected="true">
|
||||
<label translate="true">Yes</label>
|
||||
</option>
|
||||
<option name="hide" value="hide">
|
||||
<label translate="true">No</label>
|
||||
</option>
|
||||
</options>
|
||||
</parameter>
|
||||
<parameter name="image_hover" xsi:type="select" visible="true">
|
||||
<label translate="true">Image Hover</label>
|
||||
<options>
|
||||
<option name="default" value="default" selected="true">
|
||||
<label translate="true">Default, Opacity and Overlay</label>
|
||||
</option>
|
||||
<option name="overlay" value="overlay">
|
||||
<label translate="true">Overlay Only</label>
|
||||
</option>
|
||||
<option name="none" value="none">
|
||||
<label translate="true">None</label>
|
||||
</option>
|
||||
</options>
|
||||
</parameter>
|
||||
<parameter name="nolink" xsi:type="select" visible="true" source_model="Olegnax\Core\Model\Config\Source\Noyes">
|
||||
<label translate="true">Disable Link</label>
|
||||
<description translate="true">You can disable link on image click</description>
|
||||
</parameter>
|
||||
<parameter name="template" xsi:type="select" required="true" visible="true">
|
||||
<label translate="true">Template</label>
|
||||
<options>
|
||||
<option name="slider" value="Olegnax_BrandSlider::brandslider.phtml" selected="true">
|
||||
<label translate="true">Slider</label>
|
||||
</option>
|
||||
<option name="grid" value="Olegnax_BrandSlider::brandsgrid.phtml">
|
||||
<label translate="true">Grid</label>
|
||||
</option>
|
||||
</options>
|
||||
</parameter>
|
||||
<parameter name="columns_desktop" xsi:type="text" required="false" visible="true">
|
||||
<label translate="true">Grid Columns Desktop</label>
|
||||
<description translate="true">Columns are optional. You can use values up to 20.</description>
|
||||
</parameter>
|
||||
<parameter name="columns_desktop_small" xsi:type="text" required="false" visible="true">
|
||||
<label translate="true">Grid Desktop Small</label>
|
||||
<description translate="true">Columns are optional. You can use values up to 20.</description>
|
||||
</parameter>
|
||||
<parameter name="columns_tablet" xsi:type="text" required="false" visible="true">
|
||||
<label translate="true">Grid Tablet</label>
|
||||
<description translate="true">Columns are optional. You can use values up to 12.</description>
|
||||
</parameter>
|
||||
<parameter name="columns_mobile" xsi:type="text" required="false" visible="true">
|
||||
<label translate="true">Grid Mobile</label>
|
||||
<description translate="true">Columns are optional. You can use values up to 8.</description>
|
||||
</parameter>
|
||||
<parameter name="cache_lifetime" xsi:type="text" visible="true">
|
||||
<label translate="true">Cache Lifetime (Seconds)</label>
|
||||
<description translate="true">86400 by default, if not set. To refresh instantly, clear the Blocks HTML Output cache.</description>
|
||||
</parameter>
|
||||
</parameters>
|
||||
</widget>
|
||||
|
||||
</widgets>
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Magento\Framework\Component\ComponentRegistrar;
|
||||
|
||||
ComponentRegistrar::register(
|
||||
ComponentRegistrar::MODULE, 'Olegnax_BrandSlider', __DIR__
|
||||
);
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
@@ -0,0 +1,5 @@
|
||||
var config = {
|
||||
paths: {
|
||||
'OXBrandsSlider': 'Olegnax_BrandSlider/brandslider'
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* Olegnax BrandSlider
|
||||
*
|
||||
* This file is part of Olegnax/Core.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Olegnax.com license that is
|
||||
* available through the world-wide-web at this URL:
|
||||
* https://www.olegnax.com/license
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this extension to newer
|
||||
* version in the future.
|
||||
*
|
||||
* @category Olegnax
|
||||
* @package Olegnax_BrandSlider
|
||||
* @copyright Copyright (c) 2023 Olegnax (http://www.olegnax.com/)
|
||||
* @license https://www.olegnax.com/license
|
||||
*/
|
||||
$brands = $block->getItems();
|
||||
$athleteImgHelper = $this->helper( 'Olegnax\BrandSlider\Helper\Image' );
|
||||
$classes = [];
|
||||
$classes [] = $block->getColumnsDesktop() ? ('columns-' . $block->getColumnsDesktop()) : '';
|
||||
$classes [] = $block->getColumnsDesktopSmall() ? ('columns-l-' . $block->getColumnsDesktopSmall()) : '';
|
||||
$classes [] = $block->getColumnsTablet() ? ('columns-m-' . $block->getColumnsTablet()) : '';
|
||||
$classes [] = $block->getColumnsMobile() ? ('columns-s-' . $block->getColumnsMobile()) : '';
|
||||
$classes[] = 'hover-'. ($block->getImageHover() ?: 'default');
|
||||
|
||||
$cols = (bool) ($block->getColumnsDesktop() || $block->getColumnsMobile() || $block->getColumnsTablet() || $block->getColumnsDesktopSmall());
|
||||
$width = $escaper->escapeHtmlAttr($block->getWidth());
|
||||
$height = $escaper->escapeHtmlAttr($block->getHeight());
|
||||
$wrapperStyle = 'padding-bottom:' . ($height / $width) * 100 . '%;';
|
||||
if(!$cols) {
|
||||
$wrapperStyle .= ' width:' . $width . 'px; ' . 'height: ' . $height . 'px; ';
|
||||
}
|
||||
|
||||
if ( 0 < count( $brands ) ) :
|
||||
?>
|
||||
<div class="block widget ox-brand-grid__container <?php echo $escaper->escapeHtmlAttr(implode(' ', $classes)); ?>">
|
||||
<?php foreach ( $brands as $brand ) : ?>
|
||||
<?php
|
||||
$size = [ $width, $height ];
|
||||
$url = $athleteImgHelper->adaptiveResize( $brand->getImageName(), $size )->getUrl();
|
||||
if($athleteImgHelper->_imageExist){
|
||||
$link = '';
|
||||
if(!$brand->getNoLink()) {
|
||||
$link = $block->getBrandUrl( $brand );
|
||||
}
|
||||
?>
|
||||
<div class="ox-brand__item brand-<?php echo $escaper->escapeHtmlAttr($brand->getValue()); ?>">
|
||||
<a href="<?php echo $escaper->escapeUrl($link) ?>" class="ox-brand__link" ><img src="<?php echo $escaper->escapeUrl($url); ?>" alt="<?php echo $escaper->escapeHtmlAttr($brand->getLabel()); ?>" width="<?php echo $escaper->escapeHtmlAttr($width); ?>" height="<?php echo $escaper->escapeHtmlAttr($height); ?>" class="ox-brand-slider__image" /></a>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/**
|
||||
* Olegnax BrandSlider
|
||||
*
|
||||
* This file is part of Olegnax/Core.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Olegnax.com license that is
|
||||
* available through the world-wide-web at this URL:
|
||||
* https://www.olegnax.com/license
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this extension to newer
|
||||
* version in the future.
|
||||
*
|
||||
* @category Olegnax
|
||||
* @package Olegnax_BrandSlider
|
||||
* @copyright Copyright (c) 2023 Olegnax (http://www.olegnax.com/)
|
||||
* @license https://www.olegnax.com/license
|
||||
*/
|
||||
$slider_id = $block->getSliderId();
|
||||
$brands = $block->getItems();
|
||||
$athleteImgHelper = $this->helper( 'Olegnax\BrandSlider\Helper\Image' );
|
||||
$customArrows = true;
|
||||
$showNav = ($block->getNav() == 'hide') ? false : true;
|
||||
$classes = [];
|
||||
$classes [] = $block->getColumnsMobile() ? ('columns-s-' . $block->getColumnsMobile()) : '';
|
||||
$classes[] = 'hover-'. ($block->getImageHover() ?: 'default');
|
||||
$width = $block->getWidth();
|
||||
$height = $block->getHeight();
|
||||
$paddingBottom = ($height / $width) * 100 . '%';
|
||||
if ( 0 < count( $brands ) ) :
|
||||
?>
|
||||
<div id="<?php echo $slider_id ?>" class="block widget ox-brand-slider__container <?php echo $escaper->escapeHtmlAttr(implode(' ', $classes )); ?>">
|
||||
<?php if ( $customArrows && $showNav ) { ?>
|
||||
<div class="ox-nav-sideline">
|
||||
<div id="<?php echo $escaper->escapeHtmlAttr($slider_id) ?>_list_nav" class="owl-nav ox-owl-nav">
|
||||
<button class="owl-prev ox-owl-prev" role="presentation"><span aria-label="Previous">></span></button>
|
||||
<button class="owl-next ox-owl-next" role="presentation"><span aria-label="Next"><</span></button>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div id="<?php echo $escaper->escapeHtmlAttr($slider_id) ?>_list" class="ox-carousel__brands owl-carousel" data-mage-init='{"OXBrandsSlider":<?php echo
|
||||
json_encode( [
|
||||
'autoScroll' => $escaper->escapeHtmlAttr($block->getAutoScroll()),
|
||||
'slideBy' => $escaper->escapeHtmlAttr($block->getScrollItems()),
|
||||
'rewind' => (bool) $block->getRewind(),
|
||||
'responsive' => $block->getResponsive( false ),
|
||||
'slideWidth' => $escaper->escapeHtmlAttr($width),
|
||||
'slideHeight' => $escaper->escapeHtmlAttr($height),
|
||||
] );
|
||||
?>}' style="height: <?php echo $height ?>px">
|
||||
<?php foreach ( $brands as $brand ) : ?>
|
||||
<?php
|
||||
$size = [ $block->getWidth(), $block->getHeight() ];
|
||||
$url = $athleteImgHelper->adaptiveResize( $brand->getImageName(), $size )->getUrl();
|
||||
if($athleteImgHelper->_imageExist){
|
||||
?>
|
||||
<div class="ox-brand__slide slide<?php echo $escaper->escapeHtmlAttr($brand->getValue()); ?>">
|
||||
<?php
|
||||
$link = '';
|
||||
if(!$brand->getNoLink()) {
|
||||
$link = $block->getBrandUrl( $brand );
|
||||
}
|
||||
?>
|
||||
<a href="<?php echo $escaper->escapeUrl($link) ?>" class="ox-brand__link" style="padding-bottom: <?php echo $escaper->escapeHtmlAttr($paddingBottom) ?>"><span></span><img src="<?php echo $escaper->escapeUrl($url); ?>" alt="<?php echo $escaper->escapeHtmlAttr($brand->getLabel()); ?>" width="<?php echo $escaper->escapeHtmlAttr($width); ?>" height="<?php echo $escaper->escapeHtmlAttr($height); ?>" class="ox-brand-slider__image" /></a>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
@@ -0,0 +1,95 @@
|
||||
define( [
|
||||
'jquery',
|
||||
'jquery-ui-modules/widget',
|
||||
'jquery-ui-modules/core',
|
||||
'jquery-ui-modules/effect',
|
||||
'owl.carousel',
|
||||
], function ( $ ) {
|
||||
'use strict';
|
||||
|
||||
var animation_text_space = 0;
|
||||
|
||||
$.widget( 'mage.OXBrandsSlider', {
|
||||
options: {
|
||||
// OxBannerSlider
|
||||
autoScroll: 0,
|
||||
slideWidth: 0,
|
||||
slideHeight: 0,
|
||||
// Owl.carousel
|
||||
rewind: false,
|
||||
items: 1,
|
||||
slideBy: 1,
|
||||
responsive: {
|
||||
0: {
|
||||
items: 1,
|
||||
},
|
||||
},
|
||||
dots: false,
|
||||
nav: false,
|
||||
},
|
||||
_create: function () {
|
||||
this.options.responsiveBaseElement = this.element.parent();
|
||||
this.options.autoplayTimeout = parseInt( this.options.autoScroll ) * 1000;
|
||||
this.options.autoplay = 0 < this.options.autoplayTimeout;
|
||||
this.options.autoplayHoverPause = this.options.autoplay;
|
||||
|
||||
var options = this._createOptions();
|
||||
this.element.owlCarousel( options );
|
||||
this.arrows();
|
||||
},
|
||||
|
||||
_createOptions: function () {
|
||||
var _self = this;
|
||||
var options = {
|
||||
onInitialized: function () {
|
||||
_self._resizeSlides( this.$element, this );
|
||||
},
|
||||
onRefreshed: function () {
|
||||
_self._resizeSlides( this.$element, this );
|
||||
},
|
||||
onChanged: function () {
|
||||
var carouselId = this.$element.attr( 'id' );
|
||||
var $wraper = this.$element.closest( '.ox-brand-slider__container' ).eq( 0 );
|
||||
var current = this.current();
|
||||
var $nav = $wraper.find( '#' + carouselId + '_nav' ).toggle( this.settings.items < this.items().length );
|
||||
var disable_nav_min = current === this.minimum();
|
||||
var disable_nav_max = current === this.maximum();
|
||||
if ( this.settings.loop ) {
|
||||
disable_nav_min = disable_nav_max = false;
|
||||
}
|
||||
$nav.find( '.ox-owl-next' ).toggleClass( 'disabled', disable_nav_max );
|
||||
$nav.find( '.ox-owl-prev' ).toggleClass( 'disabled', disable_nav_min );
|
||||
}
|
||||
};
|
||||
|
||||
return $.extend( { }, options, this.options );
|
||||
|
||||
},
|
||||
|
||||
_resizeSlides: function ( $this, owl ) {
|
||||
var carousel = owl.$element;
|
||||
var newWidth = $( owl._items[0] ).width(),
|
||||
newHeight = Math.round( newWidth * this.options.slideHeight / this.options.slideWidth ),
|
||||
ratio = $( owl._items[0] ).width() / this.options.slideWidth;
|
||||
|
||||
$( '.ox-brand__slide .ox-brand-slider__image', carousel ).css( {
|
||||
'transform': 'scale(' + ratio + ')',
|
||||
'-ms-transform': 'scale(' + ratio + ')',
|
||||
'-webkit-transform': 'scale(' + ratio + ')'
|
||||
} );
|
||||
|
||||
$( carousel ).animate( { height: newHeight + 'px' }, 1000, 'easeOutExpo' );
|
||||
},
|
||||
arrows: function () {
|
||||
var $wraper = this.element.closest( '.ox-brand-slider__container' ).eq( 0 );
|
||||
$wraper.on( 'click', '.ox-owl-next', $.proxy( function () {
|
||||
this.element.trigger( 'next.owl.carousel' );
|
||||
}, this ) );
|
||||
$wraper.on( 'click', '.ox-owl-prev', $.proxy( function () {
|
||||
this.element.trigger( 'prev.owl.carousel' );
|
||||
}, this ) );
|
||||
}
|
||||
} );
|
||||
|
||||
return $.mage.OXBrandsSlider;
|
||||
} );
|
||||
@@ -0,0 +1,322 @@
|
||||
@product-widget-title-side-line-color: rgba(107, 107, 107, 0.18);
|
||||
@cols: 20;
|
||||
//
|
||||
// Common
|
||||
// _____________________________________________
|
||||
|
||||
.generateCols(@counter, @prefix) when (@counter > 0) {
|
||||
@width: 100 / @counter;
|
||||
&.columns@{prefix}-@{counter} {
|
||||
.ox-brand__item{
|
||||
-ms-flex: 0 0 ~"@{width}%";
|
||||
flex: 0 0 ~"@{width}%";
|
||||
max-width: ~"@{width}%";
|
||||
}
|
||||
}
|
||||
.generateCols((@counter - 1), @prefix);
|
||||
}
|
||||
& when (@media-common = true) {
|
||||
.widget.ox-brand-slider__container,
|
||||
.widget.block.ox-brand-slider__container,
|
||||
.ox-brand-slider__container{
|
||||
margin:0;
|
||||
}
|
||||
.ox-brand-grid__container,
|
||||
.ox-brand-slider__container{
|
||||
/*.ox-brand__link {
|
||||
display: block;
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
line-height: 0;
|
||||
}*/
|
||||
&.hover-default{
|
||||
.ox-brand-slider__image{
|
||||
opacity: .49!important;
|
||||
transition: opacity 0.5s ease-in-out;
|
||||
}
|
||||
a:hover{
|
||||
.ox-brand-slider__image{
|
||||
opacity:1!important;
|
||||
transition: opacity 10ms;
|
||||
}
|
||||
}
|
||||
}
|
||||
.ox-brand-slider__image{
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
margin: auto;
|
||||
position: relative;
|
||||
/*bottom: 0;
|
||||
display: block;
|
||||
height: auto;
|
||||
left: 0;
|
||||
margin: auto;
|
||||
max-width: 100%;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;*/
|
||||
-webkit-transform:scale(1) !important;
|
||||
-moz-transform:scale(1) !important;
|
||||
-o-transform:scale(1) !important;
|
||||
transform:scale(1) !important;
|
||||
}
|
||||
}
|
||||
.ox-brand-slider__container{
|
||||
&.hover-default{
|
||||
a:hover{
|
||||
span{
|
||||
transition: background 10ms;
|
||||
background: rgba(0,0,0,0.04);
|
||||
}
|
||||
}
|
||||
}
|
||||
.owl-carousel{
|
||||
display: block;
|
||||
&:not(.owl-loaded){
|
||||
> * {
|
||||
display: none;
|
||||
opacity:0;
|
||||
visibility: hidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*.ox-brand-slider__image.owl-lazy,
|
||||
.ox-brand-slider__image{
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
margin: auto;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
opacity: .49!important;
|
||||
transition: opacity 0.5s ease-in-out;
|
||||
-webkit-transform:scale(1) !important;
|
||||
-moz-transform:scale(1) !important;
|
||||
-o-transform:scale(1) !important;
|
||||
transform:scale(1) !important;
|
||||
}*/
|
||||
.owl-item {
|
||||
a span{
|
||||
display: block;
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: transparent;
|
||||
transition: background 0.5s ease-in-out;
|
||||
}
|
||||
}
|
||||
.ox-owl-nav{
|
||||
button.owl-next,
|
||||
button.owl-prev{
|
||||
background:#ffffff;
|
||||
width: 22px;
|
||||
height: 25px;
|
||||
span{
|
||||
&:after,
|
||||
&:before{
|
||||
background: #b9b9b9;
|
||||
}
|
||||
}
|
||||
&:after{
|
||||
background:none;
|
||||
}
|
||||
&:hover{
|
||||
background:#000;
|
||||
span{
|
||||
&:after,
|
||||
&:before{
|
||||
background: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
&.disabled{
|
||||
opacity:1;
|
||||
span{
|
||||
opacity:0.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.ox-nav-sideline{
|
||||
margin-top: -12px;
|
||||
margin-bottom: -11px;
|
||||
text-align:center;
|
||||
position:relative;
|
||||
overflow:hidden;
|
||||
z-index:2;
|
||||
.ox-owl-nav{
|
||||
display:inline-block;
|
||||
display: -ms-inline-flexbox;
|
||||
display:inline-flex;
|
||||
> button{
|
||||
float:left;
|
||||
}
|
||||
}
|
||||
&:before,
|
||||
&:after{
|
||||
background-color: @product-widget-title-side-line-color;
|
||||
content: "";
|
||||
display: inline-block;
|
||||
height: 1px;
|
||||
position: relative;
|
||||
vertical-align: middle;
|
||||
width: 50%;
|
||||
}
|
||||
&:before{
|
||||
right: 0;
|
||||
}
|
||||
&:after{
|
||||
left: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
.above-footer-content{
|
||||
.ox-brand-slider__container .ox-nav-sideline{
|
||||
overflow:visible;
|
||||
&:before,
|
||||
&:after{
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.ox-brand-grid__container{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
.generateCols(@counter: 8, @prefix: -s);
|
||||
.ox-brand__item{
|
||||
flex: 0 1 auto;
|
||||
text-align: center;
|
||||
> a{
|
||||
display:block;
|
||||
position:relative;
|
||||
&:before{
|
||||
content:'';
|
||||
display: block;
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: transparent;
|
||||
transition: background 0.5s ease-in-out;
|
||||
}
|
||||
}
|
||||
&:hover{
|
||||
> a{
|
||||
&:before{
|
||||
transition: background 10ms;
|
||||
background: rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&.hover-overlay,
|
||||
&.hover-default{
|
||||
.ox-brand__item:hover{
|
||||
> a{
|
||||
&:before{
|
||||
transition: background 10ms;
|
||||
background: rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__s) {
|
||||
.ox-brand-grid__container{
|
||||
.generateCols(@counter: 10, @prefix: -m);
|
||||
}
|
||||
}
|
||||
.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
|
||||
.ox-brand-grid__container{
|
||||
.generateCols(@cols, @prefix: -l);
|
||||
}
|
||||
}
|
||||
.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__l) {
|
||||
.ox-brand-grid__container{
|
||||
.generateCols(@cols, @prefix: ~'');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.header--layout-4 .logo__container, .logo__container{
|
||||
width: 165px !important;
|
||||
}
|
||||
.page-header .ox-megamenu .ox-megamenu-navigation{
|
||||
padding: 0;
|
||||
}
|
||||
@media only screen and (max-width:1800px){
|
||||
.header__item-search .header__search-wrapper > form {
|
||||
width: 335px !important;
|
||||
}
|
||||
.page-header .ox-megamenu .level0 > .level-top, .page-header .navigation .level0 > .level-top, .slide-out-menu--mobile, .header--layout-4 .minicart-wrapper .action.showcart, .ox-nav-sections-item-title .ox-nav-sections-item-switch, .ox-megamenu-navigation > .level0 > .level-top.page-header .ox-megamenu .level0 > .level-top, .page-header .navigation .level0 > .level-top, .slide-out-menu--mobile, .header--layout-4 .minicart-wrapper .action.showcart, .ox-nav-sections-item-title .ox-nav-sections-item-switch, .ox-megamenu-navigation > .level0 > .level-top{
|
||||
font-size: 15px !important;
|
||||
letter-spacing: 0;
|
||||
}
|
||||
.page-header .ox-megamenu .level0 .ox-submenu .category-item > a, .ox-megamenu-navigation .ox-dropdown--simple .category-item a, .ox-slideout .header.links .logged-in, .ox-slideout .header.links a:not(.button), .ox-slideout .switcher .options ul.dropdown a, .ox-slideout .switcher .options .action.toggle strong span, .ox-slideout .switcher .options .action.toggle strong, .ox-dropdown--megamenu > .ox-megamenu__dropdown .ox-megamenu__categories .ox-megamenu-list > .category-item > a{
|
||||
font-size: 15px !important;
|
||||
}
|
||||
}
|
||||
@media only screen and (max-width:1635px){
|
||||
.page-header .ox-megamenu .level0 > .level-top, .page-header .navigation .level0 > .level-top, .slide-out-menu--mobile, .header--layout-4 .minicart-wrapper .action.showcart, .ox-nav-sections-item-title .ox-nav-sections-item-switch, .ox-megamenu-navigation > .level0 > .level-top.page-header .ox-megamenu .level0 > .level-top, .page-header .navigation .level0 > .level-top, .slide-out-menu--mobile, .header--layout-4 .minicart-wrapper .action.showcart, .ox-nav-sections-item-title .ox-nav-sections-item-switch, .ox-megamenu-navigation > .level0 > .level-top{
|
||||
font-size: 14px !important;
|
||||
}
|
||||
.page-header .ox-megamenu .level0 .ox-submenu .category-item > a, .ox-megamenu-navigation .ox-dropdown--simple .category-item a, .ox-slideout .header.links .logged-in, .ox-slideout .header.links a:not(.button), .ox-slideout .switcher .options ul.dropdown a, .ox-slideout .switcher .options .action.toggle strong span, .ox-slideout .switcher .options .action.toggle strong, .ox-dropdown--megamenu > .ox-megamenu__dropdown .ox-megamenu__categories .ox-megamenu-list > .category-item > a{
|
||||
font-size: 14px !important;
|
||||
}
|
||||
}
|
||||
@media only screen and (max-width:1585px){
|
||||
.page-header .ox-megamenu .level0 > .level-top, .page-header .navigation .level0 > .level-top, .slide-out-menu--mobile, .header--layout-4 .minicart-wrapper .action.showcart, .ox-nav-sections-item-title .ox-nav-sections-item-switch, .ox-megamenu-navigation > .level0 > .level-top.page-header .ox-megamenu .level0 > .level-top, .page-header .navigation .level0 > .level-top, .slide-out-menu--mobile, .header--layout-4 .minicart-wrapper .action.showcart, .ox-nav-sections-item-title .ox-nav-sections-item-switch, .ox-megamenu-navigation > .level0 > .level-top{
|
||||
font-size: 13px !important;
|
||||
}
|
||||
.page-header .ox-megamenu .level0 .ox-submenu .category-item > a, .ox-megamenu-navigation .ox-dropdown--simple .category-item a, .ox-slideout .header.links .logged-in, .ox-slideout .header.links a:not(.button), .ox-slideout .switcher .options ul.dropdown a, .ox-slideout .switcher .options .action.toggle strong span, .ox-slideout .switcher .options .action.toggle strong, .ox-dropdown--megamenu > .ox-megamenu__dropdown .ox-megamenu__categories .ox-megamenu-list > .category-item > a{
|
||||
font-size: 13px !important;
|
||||
}
|
||||
}
|
||||
@media only screen and (max-width:1530px){
|
||||
.header__item-search .header__search-wrapper > form {
|
||||
width: 285px !important;
|
||||
}
|
||||
.page-header .ox-megamenu .level0 > .level-top, .page-header .navigation .level0 > .level-top, .slide-out-menu--mobile, .header--layout-4 .minicart-wrapper .action.showcart, .ox-nav-sections-item-title .ox-nav-sections-item-switch, .ox-megamenu-navigation > .level0 > .level-top.page-header .ox-megamenu .level0 > .level-top, .page-header .navigation .level0 > .level-top, .slide-out-menu--mobile, .header--layout-4 .minicart-wrapper .action.showcart, .ox-nav-sections-item-title .ox-nav-sections-item-switch, .ox-megamenu-navigation > .level0 > .level-top{
|
||||
font-size: 12px !important;
|
||||
}
|
||||
.page-header .ox-megamenu .level0 .ox-submenu .category-item > a, .ox-megamenu-navigation .ox-dropdown--simple .category-item a, .ox-slideout .header.links .logged-in, .ox-slideout .header.links a:not(.button), .ox-slideout .switcher .options ul.dropdown a, .ox-slideout .switcher .options .action.toggle strong span, .ox-slideout .switcher .options .action.toggle strong, .ox-dropdown--megamenu > .ox-megamenu__dropdown .ox-megamenu__categories .ox-megamenu-list > .category-item > a{
|
||||
font-size: 12px !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width:1450px){
|
||||
.menu-style-3 .page-header .ox-megamenu>ul>.level0>a, .menu-style-3 .page-header .navigation>ul>.level0>a, .menu-style-3 .page-header .ox-megamenu>ul>.level0>.level-top, .menu-style-3 .page-header .navigation>ul>.level0>.level-top{
|
||||
margin: 0 5px !important;
|
||||
}
|
||||
}
|
||||
@media only screen and (max-width:1375px){
|
||||
.header--layout-4 .header__content .minicart-wrapper .action.showcart{
|
||||
padding: 0 12px !important;
|
||||
}
|
||||
.header--layout-4 .header__content .flex-right .header__item .button{
|
||||
min-width: 50px !important;
|
||||
}
|
||||
}
|
||||
@media only screen and (max-width:1330px){
|
||||
.header__item-search .header__search-wrapper > form {
|
||||
width: 200px !important;
|
||||
}
|
||||
}
|
||||
@media only screen and (max-width:1295px){
|
||||
.menu-style-3 .page-header .ox-megamenu>ul>.level0>a, .menu-style-3 .page-header .navigation>ul>.level0>a, .menu-style-3 .page-header .ox-megamenu>ul>.level0>.level-top, .menu-style-3 .page-header .navigation>ul>.level0>.level-top{
|
||||
margin: 0 3px !important;
|
||||
}
|
||||
.header__item-search .header__search-wrapper > form {
|
||||
width: 160px !important;
|
||||
}
|
||||
.header--layout-4 .logo__container, .logo__container{
|
||||
width: 150px !important;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user