ltsecurityinc安防产品在线商城代码

This commit is contained in:
2026-09-14 17:47:10 +08:00
parent 57d8444c15
commit 6a3c9c5bd8
14539 changed files with 1775310 additions and 0 deletions
@@ -0,0 +1,52 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* System config Logo image field backend model
*/
namespace Olegnax\Athlete2\Model\Config\Backend\Image;
use Magento\Config\Model\Config\Backend\Image;
class Logo extends Image
{
/**
* The tail part of directory path for uploading
*
*/
const UPLOAD_DIR = 'athlete2';
/**
* Return path to directory for upload file
*
* @return string
* @throw \Magento\Framework\Exception\LocalizedException
*/
protected function _getUploadDir()
{
return $this->_mediaDirectory->getAbsolutePath($this->_appendScopeInfo(self::UPLOAD_DIR));
}
/**
* Makes a decision about whether to add info about the scope.
*
* @return boolean
*/
protected function _addWhetherScopeInfo()
{
return true;
}
/**
* Getter for allowed extensions of uploaded files.
*
* @return string[]
*/
protected function _getAllowedExtensions()
{
return ['jpg', 'jpeg', 'gif', 'png', 'svg'];
}
}
@@ -0,0 +1,46 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Backend;
use Magento\Config\Model\Config\Backend\Serialized as BackendSerialized;
class Serialized extends BackendSerialized
{
/**
* @return $this
*/
public function beforeSave()
{
$groups = $this->getData('groups');
$fieldConfig = $this->getData('field_config');
$depends = true;
if (isset($fieldConfig['depends'])) {
foreach ($fieldConfig['depends']['fields'] as $field) {
$value = $field['value'];
$dependPath = $field['dependPath'];
array_shift($dependPath);
if (isset($groups[$dependPath[0]]['fields'][$dependPath[1]]['value'])
&& $groups[$dependPath[0]]['fields'][$dependPath[1]]['value'] != $value
) {
$depends = false;
}
}
}
if (is_array($this->getValue())) {
$value = $this->getValue();
if (array_key_exists('__empty', $value)) {
unset($value['__empty']);
}
if (empty($value) && !$depends) {
$value = $this->getOldValue();
}
$this->setValue($value);
}
parent::beforeSave();
return $this;
}
}
@@ -0,0 +1,27 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings;
use Magento\Framework\Option\ArrayInterface;
class BgPositionX implements ArrayInterface {
public function toOptionArray() {
$optionArray = [ ];
$array = $this->toArray();
foreach ( $array as $key => $value ) {
$optionArray[] = [ 'value' => $key, 'label' => $value ];
}
return $optionArray;
}
public function toArray() {
return [
'center' => __( 'Center' ),
'left' => __( 'Left' ),
'right' => __( 'Right' ),
];
}
}
@@ -0,0 +1,27 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings;
use Magento\Framework\Option\ArrayInterface;
class BgPositionY implements ArrayInterface {
public function toOptionArray() {
$optionArray = [ ];
$array = $this->toArray();
foreach ( $array as $key => $value ) {
$optionArray[] = [ 'value' => $key, 'label' => $value ];
}
return $optionArray;
}
public function toArray() {
return [
'center' => __( 'Center' ),
'top' => __( 'Top' ),
'bottom' => __( 'Bottom' ),
];
}
}
@@ -0,0 +1,26 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings;
use Magento\Framework\Option\ArrayInterface;
class BgRepeat implements ArrayInterface {
public function toOptionArray() {
$optionArray = [ ];
$array = $this->toArray();
foreach ( $array as $key => $value ) {
$optionArray[] = [ 'value' => $key, 'label' => $value ];
}
return $optionArray;
}
public function toArray() {
return [
'repeat' => __( 'Repeat' ),
'no-repeat' => __( 'No Repeat' ),
];
}
}
+27
View File
@@ -0,0 +1,27 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings;
use Magento\Framework\Option\ArrayInterface;
class BgSize implements ArrayInterface {
public function toOptionArray() {
$optionArray = [ ];
$array = $this->toArray();
foreach ( $array as $key => $value ) {
$optionArray[] = [ 'value' => $key, 'label' => $value ];
}
return $optionArray;
}
public function toArray() {
return [
'auto' => __( 'Auto' ),
'cover' => __( 'Cover' ),
'contain' => __( 'Contain' ),
];
}
}
+43
View File
@@ -0,0 +1,43 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings;
use Magento\Cms\Model\ResourceModel\Block\CollectionFactory;
use Magento\Framework\Option\ArrayInterface;
class Blocks implements ArrayInterface {
protected $_options;
/**
* Block collection factory
*
* @var CollectionFactory
*/
protected $_blockCollectionFactory;
/**
* Construct
*
* @param CollectionFactory $blockCollectionFactory
*/
public function __construct( CollectionFactory $blockCollectionFactory ) {
$this->_blockCollectionFactory = $blockCollectionFactory;
}
/**
* {@inheritdoc}
*/
public function toOptionArray() {
if ( !$this->_options ) {
$this->_options = [];
$colection = $this->_blockCollectionFactory->create()->load();
foreach ( $colection as $block ) {
$this->_options[] = [ 'value' => $block->getIdentifier(), 'label' => $block->getTitle() ];
}
array_unshift( $this->_options, [ 'value' => '', 'label' => __( 'Please select a static block.' ) ] );
}
return $this->_options;
}
}
@@ -0,0 +1,26 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings\Blog;
use Magento\Framework\Option\ArrayInterface;
class Columns implements ArrayInterface
{
public function toOptionArray() {
$optionArray = [ ];
$array = $this->toArray();
foreach ( $array as $key => $value ) {
$optionArray[] = [ 'value' => $key, 'label' => $value ];
}
return $optionArray;
}
public function toArray()
{
return [
'1' => __('1'),
'2' => __('2'),
'3' => __('3'),
];
}
}
@@ -0,0 +1,27 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings\Blog;
use Magento\Framework\Option\ArrayInterface;
class ListStyle implements ArrayInterface
{
public function toOptionArray() {
$optionArray = [ ];
$array = $this->toArray();
foreach ( $array as $key => $value ) {
$optionArray[] = [ 'value' => $key, 'label' => $value ];
}
return $optionArray;
}
public function toArray()
{
return [
'image-top' => __('Image Top'),
'image-left' => __('Image Left'),
'above-image' => __('Content Above Image, Fullwidth'),
'overlay' => __('Content Above Image, Normal'),
];
}
}
@@ -0,0 +1,28 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings\Blog;
use Magento\Framework\Option\ArrayInterface;
class PageLayout implements ArrayInterface
{
public function toOptionArray() {
$optionArray = [ ];
$array = $this->toArray();
foreach ( $array as $key => $value ) {
$optionArray[] = [ 'value' => $key, 'label' => $value ];
}
return $optionArray;
}
public function toArray()
{
return [
'' => __('Use Default'),
'1column' => __('1 Column'),
'2columns-left' => __('2 Columns with Left bar'),
'2columns-right' => __('2 Columns with Right bar'),
'1column-fullwidth' => __('1 Column, Full Width '),
];
}
}
@@ -0,0 +1,28 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings\Blog;
use Magento\Framework\Option\ArrayInterface;
class PostListStyle implements ArrayInterface
{
public function toOptionArray() {
$optionArray = [ ];
$array = $this->toArray();
foreach ( $array as $key => $value ) {
$optionArray[] = [ 'value' => $key, 'label' => $value ];
}
return $optionArray;
}
public function toArray()
{
return [
'' => __('Use Global'),
'image-top' => __('Image Top'),
'image-left' => __('Image Left'),
'above-image' => __('Content Above Image, Fullwidth'),
'overlay' => __('Content Above Image, Normal'),
];
}
}
@@ -0,0 +1,26 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings\Blog;
use Magento\Framework\Option\ArrayInterface;
class RelatedColumns implements ArrayInterface
{
public function toOptionArray() {
$optionArray = [ ];
$array = $this->toArray();
foreach ( $array as $key => $value ) {
$optionArray[] = [ 'value' => $key, 'label' => $value ];
}
return $optionArray;
}
public function toArray()
{
return [
'2' => __('2'),
'3' => __('3'),
'4' => __('4'),
];
}
}
@@ -0,0 +1,27 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings\Blog;
use Magento\Framework\Option\ArrayInterface;
class RelatedColumnsProductPage implements ArrayInterface
{
public function toOptionArray() {
$optionArray = [ ];
$array = $this->toArray();
foreach ( $array as $key => $value ) {
$optionArray[] = [ 'value' => $key, 'label' => $value ];
}
return $optionArray;
}
public function toArray()
{
return [
'1' => __('1'),
'2' => __('2'),
'3' => __('3'),
'4' => __('4'),
];
}
}
@@ -0,0 +1,26 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings;
use Magento\Framework\Option\ArrayInterface;
class ButtonStyle implements ArrayInterface {
public function toOptionArray() {
$optionArray = [ ];
$array = $this->toArray();
foreach ( $array as $key => $value ) {
$optionArray[] = [ 'value' => $key, 'label' => $value ];
}
return $optionArray;
}
public function toArray() {
return [
'' => __( 'Athlete Default (Slide from Left)' ),
'simple' => __( 'Simple (Fade)' ),
];
}
}
@@ -0,0 +1,25 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings\Carousel;
use Magento\Framework\Option\ArrayInterface;
class Align implements ArrayInterface
{
public function toOptionArray() {
$optionArray = [ ];
$array = $this->toArray();
foreach ( $array as $key => $value ) {
$optionArray[] = [ 'value' => $key, 'label' => $value ];
}
return $optionArray;
}
public function toArray()
{
return [
'left' => __('Left'),
'center' => __('Center'),
];
}
}
@@ -0,0 +1,25 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings\Carousel;
use Magento\Framework\Option\ArrayInterface;
class Arrows implements ArrayInterface
{
public function toOptionArray() {
$optionArray = [ ];
$array = $this->toArray();
foreach ( $array as $key => $value ) {
$optionArray[] = [ 'value' => $key, 'label' => $value ];
}
return $optionArray;
}
public function toArray()
{
return [
'title' => __('Title'),
'hover' => __('Left/Right on Hover'),
];
}
}
@@ -0,0 +1,30 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings\Catalog\Products;
use Magento\Framework\Option\ArrayInterface;
class Columns implements ArrayInterface
{
public function toOptionArray() {
$optionArray = [ ];
$array = $this->toArray();
foreach ( $array as $key => $value ) {
$optionArray[] = [ 'value' => $key, 'label' => $value ];
}
return $optionArray;
}
public function toArray()
{
return [
'2' => __('2'),
'3' => __('3'),
'4' => __('4'),
'5' => __('5'),
'6' => __('6'),
'7' => __('7'),
'8' => __('8'),
];
}
}
@@ -0,0 +1,25 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings\Catalog\Products;
use Magento\Framework\Option\ArrayInterface;
class ColumnsMobile implements ArrayInterface
{
public function toOptionArray() {
$optionArray = [ ];
$array = $this->toArray();
foreach ( $array as $key => $value ) {
$optionArray[] = [ 'value' => $key, 'label' => $value ];
}
return $optionArray;
}
public function toArray()
{
return [
'2' => __('2'),
'1' => __('1'),
];
}
}
@@ -0,0 +1,28 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings\Catalog\Products;
use Magento\Framework\Option\ArrayInterface;
class ColumnsTablet implements ArrayInterface
{
public function toOptionArray() {
$optionArray = [ ];
$array = $this->toArray();
foreach ( $array as $key => $value ) {
$optionArray[] = [ 'value' => $key, 'label' => $value ];
}
return $optionArray;
}
public function toArray()
{
return [
'2' => __('2'),
'3' => __('3'),
'4' => __('4'),
'5' => __('5'),
'6' => __('6'),
];
}
}
@@ -0,0 +1,28 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings\Catalog\Products;
use Magento\Framework\Option\ArrayInterface;
class ProductsLayout implements ArrayInterface
{
public function toOptionArray() {
$optionArray = [ ];
$array = $this->toArray();
foreach ( $array as $key => $value ) {
$optionArray[] = [ 'value' => $key, 'label' => $value ];
}
return $optionArray;
}
public function toArray()
{
return [
'1' => __('All Actions Above Image - Centered'),
'3' => __('Add to cart Bottom, Secondary Above Image - Centered'),
'2' => __('Quickview Above Image - Bottom Left, Secondary Bottom'),
'4' => __('Actions Bottom, Always Visible'),
'5' => __('Add to cart Bottom, Secondary Above Image - Top Right'),
];
}
}
@@ -0,0 +1,26 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings\Catalog\Products;
use Magento\Framework\Option\ArrayInterface;
class QuickviewPosition implements ArrayInterface
{
public function toOptionArray() {
$optionArray = [ ];
$array = $this->toArray();
foreach ( $array as $key => $value ) {
$optionArray[] = [ 'value' => $key, 'label' => $value ];
}
return $optionArray;
}
public function toArray()
{
return [
'' => __('Default to Layout'),
'bottom-left' => __('Bottom Left'),
'bottom-full' => __('Bottom Full Width'),
];
}
}
@@ -0,0 +1,27 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings\Catalog\Products;
use Magento\Framework\Option\ArrayInterface;
class RelatedPosition implements ArrayInterface
{
public function toOptionArray() {
$optionArray = [ ];
$array = $this->toArray();
foreach ( $array as $key => $value ) {
$optionArray[] = [ 'value' => $key, 'label' => $value ];
}
return $optionArray;
}
public function toArray()
{
return [
'' => __('Default, In Content'),
'oxbottom' => __('Before Page Bottom, After Content'),
'bottom' => __('Page Bottom'),
'gallery' => __('Below Gallery')
];
}
}
@@ -0,0 +1,26 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings\Contacts;
use Magento\Framework\Option\ArrayInterface;
class FirstBlockType implements ArrayInterface
{
public function toOptionArray() {
$optionArray = [ ];
$array = $this->toArray();
foreach ( $array as $key => $value ) {
$optionArray[] = [ 'value' => $key, 'label' => $value ];
}
return $optionArray;
}
public function toArray()
{
return [
'content' => __('Content'),
'image' => __('Image'),
'google_map' => __('Google Map'),
];
}
}
@@ -0,0 +1,25 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings\Contacts;
use Magento\Framework\Option\ArrayInterface;
class Layout implements ArrayInterface
{
public function toOptionArray() {
$optionArray = [ ];
$array = $this->toArray();
foreach ( $array as $key => $value ) {
$optionArray[] = [ 'value' => $key, 'label' => $value ];
}
return $optionArray;
}
public function toArray()
{
return [
'default' => __('Standard'),
'left-right' => __('One Half Split'),
];
}
}
@@ -0,0 +1,29 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings;
use Magento\Framework\Option\ArrayInterface;
class FontDisplay implements ArrayInterface {
public function toOptionArray() {
$optionArray = [ ];
$array = $this->toArray();
foreach ( $array as $key => $value ) {
$optionArray[] = [ 'value' => $key, 'label' => $value ];
}
return $optionArray;
}
public function toArray() {
return [
'fallback' => __( 'Fallback' ),
'auto' => __( 'Auto' ),
'block' => __( 'Block' ),
'swap' => __( 'Swap' ),
'optional' => __( 'Optional' ),
];
}
}
@@ -0,0 +1,32 @@
<?php /**/
namespace Olegnax\Athlete2\Model\Config\Settings\Footer;
use Magento\Framework\Option\ArrayInterface;
use Magento\Framework\View\Asset\Repository;
class CopyrightLayout implements ArrayInterface
{
protected $_assetRepo;
public function __construct(
Repository $assetRepo
) {
$this->_assetRepo = $assetRepo;
}
public function toOptionArray() {
$optionArray = [ ];
$array = $this->toArray();
foreach ( $array as $key => $value ) {
$optionArray[] = [ 'value' => $key, 'label' => $value ];
}
return $optionArray;
}
public function toArray() {
return [
'1' => $this->_assetRepo->getUrl( 'Olegnax_Athlete2::images/copyright-layout-01.png' ),
'2' => $this->_assetRepo->getUrl( 'Olegnax_Athlete2::images/copyright-layout-02.png' ),
];
}
}
@@ -0,0 +1,34 @@
<?php /**/
namespace Olegnax\Athlete2\Model\Config\Settings\Footer;
use Magento\Framework\Option\ArrayInterface;
use Magento\Framework\View\Asset\Repository;
class FooterLayout implements ArrayInterface
{
protected $_assetRepo;
public function __construct(
Repository $assetRepo
) {
$this->_assetRepo = $assetRepo;
}
public function toOptionArray() {
$optionArray = [ ];
$array = $this->toArray();
foreach ( $array as $key => $value ) {
$optionArray[] = [ 'value' => $key, 'label' => $value ];
}
return $optionArray;
}
public function toArray() {
return [
'1' => $this->_assetRepo->getUrl( 'Olegnax_Athlete2::images/footer-layout-01.png' ),
'2' => $this->_assetRepo->getUrl( 'Olegnax_Athlete2::images/footer-layout-02.png' ),
'4' => $this->_assetRepo->getUrl( 'Olegnax_Athlete2::images/footer-layout-04.jpg' ),
'3' => $this->_assetRepo->getUrl( 'Olegnax_Athlete2::images/footer-layout-03.png' ),
];
}
}
@@ -0,0 +1,32 @@
<?php /**/
namespace Olegnax\Athlete2\Model\Config\Settings\Footer;
use Magento\Framework\Option\ArrayInterface;
use Magento\Framework\View\Asset\Repository;
class NewsletterStyle implements ArrayInterface
{
protected $_assetRepo;
public function __construct(
Repository $assetRepo
) {
$this->_assetRepo = $assetRepo;
}
public function toOptionArray() {
$optionArray = [ ];
$array = $this->toArray();
foreach ( $array as $key => $value ) {
$optionArray[] = [ 'value' => $key, 'label' => $value ];
}
return $optionArray;
}
public function toArray() {
return [
'small' => $this->_assetRepo->getUrl( 'Olegnax_Athlete2::images/newsletter_small.png' ),
'big' => $this->_assetRepo->getUrl( 'Olegnax_Athlete2::images/newsletter_big.png' ),
];
}
}
@@ -0,0 +1,25 @@
<?php /**/
namespace Olegnax\Athlete2\Model\Config\Settings\Footer;
use Magento\Framework\Option\ArrayInterface;
class StoreSwitcherPosition implements ArrayInterface
{
public function toOptionArray() {
$optionArray = [ ];
$array = $this->toArray();
foreach ( $array as $key => $value ) {
$optionArray[] = [ 'value' => $key, 'label' => $value ];
}
return $optionArray;
}
public function toArray()
{
return [
'below-newsletter' => __('Below Footer Newsletter Block'),
'footer-content' => __('Below Footer Content'),
'custom' => __('Custom/Do not display'),
];
}
}
@@ -0,0 +1,70 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings;
use Magento\Framework\Option\ArrayInterface;
class GoogleFonts implements ArrayInterface {
private $font_api = 'https://www.googleapis.com/webfonts/v1/webfonts?sort=alpha&key=AIzaSyAELicRrZCL8Refz-D2-FeyahisL1hUoYc';
private function _getApiFonts() {
$ch = curl_init();
curl_setopt_array( $ch, array(
CURLOPT_URL => $this->font_api,
CURLOPT_SSL_VERIFYHOST => 0,
CURLOPT_SSL_VERIFYPEER => 0,
CURLOPT_RETURNTRANSFER => 1,
) );
$result = curl_exec( $ch );
curl_close( $ch );
if ( empty( $result ) ) {
return [ ];
}
$fonts = json_decode( (string) $result, true );
if ( array_key_exists( 'items', $fonts ) ) {
return $fonts[ 'items' ];
}
return [ ];
}
public function _mapFonts( $font ) {
if ( array_key_exists( 'family', $font ) ) {
return [
'value' => $font[ 'family' ],
'label' => $font[ 'family' ],
'variants' => $font[ 'variants' ],
];
}
return [ ];
}
private function _prepareFonts() {
$fonts = $this->_getApiFonts();
if ( !empty( $fonts ) && is_array( $fonts ) ) {
$fonts = array_map( [$this, '_mapFonts' ], $fonts );
$fonts = array_filter( $fonts );
}
return $fonts;
}
public function toOptionArray() {
$fonts = $this->_prepareFonts();
return $fonts;
}
public function toArray() {
$fonts = $this->_prepareFonts();
$_fonts = [];
foreach ( $fonts as $font ) {
$_fonts[$font['value']] = $font['label'];
}
return $_fonts;
}
}
@@ -0,0 +1,69 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings;
use Magento\Framework\Option\ArrayInterface;
class GoogleFontsVariants implements ArrayInterface {
private $font_api = 'https://www.googleapis.com/webfonts/v1/webfonts?sort=alpha&key=AIzaSyAELicRrZCL8Refz-D2-FeyahisL1hUoYc';
private function _getApiFonts() {
$ch = curl_init();
curl_setopt_array( $ch, array(
CURLOPT_URL => $this->font_api,
CURLOPT_SSL_VERIFYHOST => 0,
CURLOPT_SSL_VERIFYPEER => 0,
CURLOPT_RETURNTRANSFER => 1,
) );
$result = curl_exec( $ch );
curl_close( $ch );
if ( empty( $result ) ) {
return [ ];
}
$fonts = json_decode( (string)$result, true );
if ( array_key_exists( 'items', $fonts ) ) {
return $fonts[ 'items' ];
}
return [ ];
}
public function _mapVariant( $variant ) {
return [
'value' => $variant,
'label' => $variant,
];
}
private function _prepareFonts() {
$fonts = $this->_getApiFonts();
$variants = [];
foreach( $fonts as $font ){
$variants = array_merge( $variants, $font['variants'] );
}
$variants = array_unique( $variants );
sort( $variants );
$variants = array_map([$this, '_mapVariant'], $variants);
return $variants;
}
public function toOptionArray() {
$fonts = $this->_prepareFonts();
return $fonts;
}
public function toArray() {
$fonts = $this->toOptionArray();
$_fonts = [ ];
foreach ( $fonts as $font ) {
$_fonts[ $font[ 'value' ] ] = $font[ 'label' ];
}
return $_fonts;
}
}
@@ -0,0 +1,23 @@
<?php /**/
namespace Olegnax\Athlete2\Model\Config\Settings\Header;
use Magento\Framework\Option\ArrayInterface;
class AccountAction implements ArrayInterface
{
public function toOptionArray()
{
return [
['value' => '', 'label' => __('Open Login/My Acount page')],
['value' => 'simple', 'label' => __('Simple Drop Down with Links')],
['value' => 'login', 'label' => __('Drop Down/Slideout with Login Form')]
];
}
public function toArray()
{
$array = [];
foreach ($this->toOptionArray() as $item) {
$array[$item['value']] = $item['label'];
}
return $array;
}
}
@@ -0,0 +1,22 @@
<?php /**/
namespace Olegnax\Athlete2\Model\Config\Settings\Header;
use Magento\Framework\Option\ArrayInterface;
class BannerColumns implements ArrayInterface
{
public function toOptionArray()
{
return [
['value' => '1', 'label' => __('1')],
['value' => '2', 'label' => __('2')]
];
}
public function toArray()
{
$array = [];
foreach ($this->toOptionArray() as $item) {
$array[$item['value']] = $item['label'];
}
return $array;
}
}
@@ -0,0 +1,22 @@
<?php /**/
namespace Olegnax\Athlete2\Model\Config\Settings\Header;
use Magento\Framework\Option\ArrayInterface;
class BannerType implements ArrayInterface
{
public function toOptionArray()
{
return [
['value' => 'textfield', 'label' => __('Custom HTML')],
['value' => 'custom_block', 'label' => __('Static Block')]
];
}
public function toArray()
{
$array = [];
foreach ($this->toOptionArray() as $item) {
$array[$item['value']] = $item['label'];
}
return $array;
}
}
@@ -0,0 +1,22 @@
<?php /**/
namespace Olegnax\Athlete2\Model\Config\Settings\Header;
use Magento\Framework\Option\ArrayInterface;
class HeaderBannerMode implements ArrayInterface
{
public function toOptionArray()
{
return [
['value' => 'always', 'label' => __('Always')],
['value' => 'once', 'label' => __('Once')]
];
}
public function toArray()
{
$array = [];
foreach ($this->toOptionArray() as $item) {
$array[$item['value']] = $item['label'];
}
return $array;
}
}
@@ -0,0 +1,23 @@
<?php /**/
namespace Olegnax\Athlete2\Model\Config\Settings\Header;
use Magento\Framework\Option\ArrayInterface;
class HeaderItemPosition implements ArrayInterface
{
public function toOptionArray()
{
return [
['value' => '', 'label' => __('Don\'t Show')],
['value' => 'topline', 'label' => __('in Top Line/My Account Drop')],
['value' => 'main', 'label' => __('in Main Header')],
];
}
public function toArray()
{
$array = [];
foreach ($this->toOptionArray() as $item) {
$array[$item['value']] = $item['label'];
}
return $array;
}
}
@@ -0,0 +1,23 @@
<?php /**/
namespace Olegnax\Athlete2\Model\Config\Settings\Header;
use Magento\Framework\Option\ArrayInterface;
class HeaderItemPositionAccount implements ArrayInterface
{
public function toOptionArray()
{
return [
['value' => 'none', 'label' => __('Don\'t Show')],
['value' => 'topline', 'label' => __('in Top Line')],
['value' => 'main', 'label' => __('in Main Header')]
];
}
public function toArray()
{
$array = [];
foreach ($this->toOptionArray() as $item) {
$array[$item['value']] = $item['label'];
}
return $array;
}
}
@@ -0,0 +1,24 @@
<?php /**/
namespace Olegnax\Athlete2\Model\Config\Settings\Header;
use Magento\Framework\Option\ArrayInterface;
class HeaderItemPositionMobile implements ArrayInterface
{
public function toOptionArray()
{
return [
['value' => '', 'label' => __('Inherit, Same as Desktop')],
['value' => 'none', 'label' => __('Don\'t Show')],
['value' => 'main', 'label' => __('in Main Header')],
['value' => 'slideout', 'label' => __('in Navigation Slideout')]
];
}
public function toArray()
{
$array = [];
foreach ($this->toOptionArray() as $item) {
$array[$item['value']] = $item['label'];
}
return $array;
}
}
@@ -0,0 +1,35 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings\Header;
use Magento\Framework\Option\ArrayInterface;
use Magento\Framework\View\Asset\Repository;
class Layout implements ArrayInterface
{
protected $_assetRepo;
public function __construct(
Repository $assetRepo
) {
$this->_assetRepo = $assetRepo;
}
public function toOptionArray() {
$optionArray = [ ];
$array = $this->toArray();
foreach ( $array as $key => $value ) {
$optionArray[] = [ 'value' => $key, 'label' => $value ];
}
return $optionArray;
}
public function toArray() {
return [
'header_1' => $this->_assetRepo->getUrl( 'Olegnax_Athlete2::images/header-layout-01.png' ),
'header_2' => $this->_assetRepo->getUrl( 'Olegnax_Athlete2::images/header-layout-02.png' ),
'header_4' => $this->_assetRepo->getUrl( 'Olegnax_Athlete2::images/header-layout-04.png' ),
'header_5' => $this->_assetRepo->getUrl( 'Olegnax_Athlete2::images/header-layout-05.png' ),
'header_6' => $this->_assetRepo->getUrl( 'Olegnax_Athlete2::images/header-layout-06.png' ),
];
}
}
@@ -0,0 +1,23 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings\Header;
use Magento\Framework\Option\ArrayInterface;
class MenuAlign implements ArrayInterface
{
public function toOptionArray()
{
return [
['value' => 'left', 'label' => __('Left')],
['value' => 'center', 'label' => __('Center')],
['value' => 'right', 'label' => __('Right')]
];
}
public function toArray()
{
$array = [];
foreach ($this->toOptionArray() as $item) {
$array[$item['value']] = $item['label'];
}
return $array;
}
}
@@ -0,0 +1,24 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings\Header;
use Magento\Framework\Option\ArrayInterface;
class MenuAlignSticky implements ArrayInterface
{
public function toOptionArray()
{
return [
['value' => '', 'label' => __('Same as Header (inherit)')],
['value' => 'left', 'label' => __('Left')],
['value' => 'center', 'label' => __('Center')],
['value' => 'right', 'label' => __('Right')]
];
}
public function toArray()
{
$array = [];
foreach ($this->toOptionArray() as $item) {
$array[$item['value']] = $item['label'];
}
return $array;
}
}
@@ -0,0 +1,23 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings\Header;
use Magento\Framework\Option\ArrayInterface;
class MenuPosition implements ArrayInterface
{
public function toOptionArray()
{
return [
['value' => '1', 'label' => __('In Header')],
['value' => '2', 'label' => __('Below Header')],
];
}
public function toArray()
{
return [
'1' => __('In Header'),
'2' => __('Below Header'),
];
}
}
@@ -0,0 +1,35 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings\Header;
use Magento\Framework\Option\ArrayInterface;
use Magento\Framework\View\Asset\Repository;
class MenuStyle implements ArrayInterface
{
protected $_assetRepo;
public function __construct(
Repository $assetRepo
) {
$this->_assetRepo = $assetRepo;
}
public function toOptionArray() {
$optionArray = [ ];
$array = $this->toArray();
foreach ( $array as $key => $value ) {
$optionArray[] = [ 'value' => $key, 'label' => $value ];
}
return $optionArray;
}
public function toArray() {
return [
'menu-style-1' => $this->_assetRepo->getUrl( 'Olegnax_Athlete2::images/header-menu-v1.png' ),
'menu-style-2' => $this->_assetRepo->getUrl( 'Olegnax_Athlete2::images/header-menu-v2.png' ),
'menu-style-3' => $this->_assetRepo->getUrl( 'Olegnax_Athlete2::images/header-menu-v3.png' ),
'menu-style-4' => $this->_assetRepo->getUrl( 'Olegnax_Athlete2::images/header-menu-v4.png' ),
'menu-style-5' => $this->_assetRepo->getUrl( 'Olegnax_Athlete2::images/header-menu-v5.png' ),
];
}
}
@@ -0,0 +1,22 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings\Header;
use Magento\Framework\Option\ArrayInterface;
class MinicartStyle implements ArrayInterface
{
public function toOptionArray()
{
return [
['value' => 'classic', 'label' => __('Athlete Classic')],
['value' => 'modern', 'label' => __('Modern')],
];
}
public function toArray()
{
$array = [];
foreach ($this->toOptionArray() as $item) {
$array[$item['value']] = $item['label'];
}
return $array;
}
}
@@ -0,0 +1,27 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings\Header;
use Magento\Framework\Option\ArrayInterface;
class MinicartType implements ArrayInterface {
public function toOptionArray() {
$optionArray = [ ];
$array = $this->toArray();
foreach ( $array as $key => $value ) {
$optionArray[] = [ 'value' => $key, 'label' => $value ];
}
return $optionArray;
}
public function toArray() {
return [
'dropdown-click' => __( 'Dropdown Click' ),
'dropdown-hover' => __( 'Dropdown Hover' ),
'slideout' => __( 'Slideout' ),
];
}
}
@@ -0,0 +1,29 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings\Header\Mobile;
use Magento\Framework\Option\ArrayInterface;
class Layout implements ArrayInterface
{
public function toOptionArray() {
$optionArray = [ ];
$array = $this->toArray();
foreach ( $array as $key => $value ) {
$optionArray[] = [ 'value' => $key, 'label' => $value ];
}
return $optionArray;
}
public function toArray()
{
return [
'1' => __('Logo Left'),
'2' => __('Logo Above'),
/*'3' => __('Menu, Logo, Search, Wishlist, Cart'),*/
'4' => __('Search + Menu, Logo Centered, Wishlist + Cart'),
'5' => __('Menu + Search, Logo Centered, Wishlist + Cart'),
/*'6' => __('Menu, Logo Centered, Other Items'),*/
];
}
}
@@ -0,0 +1,24 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings\Header;
use Magento\Framework\Option\ArrayInterface;
class SearchStyle implements ArrayInterface
{
public function toOptionArray()
{
return [
['value' => '', 'label' => __('Default - No border')],
['value' => 'border-single', 'label' => __('Single Border')],
['value' => 'border-double', 'label' => __('Double Border')],
['value' => 'underlined', 'label' => __('Underlined')]
];
}
public function toArray()
{
$array = [];
foreach ($this->toOptionArray() as $item) {
$array[$item['value']] = $item['label'];
}
return $array;
}
}
@@ -0,0 +1,27 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings\Header;
use Magento\Framework\Option\ArrayInterface;
class SearchType implements ArrayInterface {
public function toOptionArray() {
$optionArray = [ ];
$array = $this->toArray();
foreach ( $array as $key => $value ) {
$optionArray[] = [ 'value' => $key, 'label' => $value ];
}
return $optionArray;
}
public function toArray() {
return [
'panel' => __( 'Simple Input' ),
'overlay' => __( 'Fullscreen' ),
'slideout' => __( 'Slideout' ),
];
}
}
@@ -0,0 +1,29 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings;
use Magento\Framework\Option\ArrayInterface;
class PageLayouts implements ArrayInterface
{
public function toOptionArray() {
$optionArray = [ ];
$array = $this->toArray();
foreach ( $array as $key => $value ) {
$optionArray[] = [ 'value' => $key, 'label' => $value ];
}
return $optionArray;
}
public function toArray()
{
return [
'' => __('Use Default'),
'1column' => __('1 Column'),
'1column-fullwidth' => __('1 Column, Full Width '),
'2columns-left' => __('2 Columns with Left bar'),
'2columns-right' => __('2 Columns with Right bar'),
'3columns' => __('3 Columns'),
];
}
}
@@ -0,0 +1,46 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings;
use Magento\Framework\Option\ArrayInterface;
class PageLocation implements ArrayInterface {
const HOMEPAGE = 'cms_index_index';
const CATEGORY = 'catalog_category_view';
const PRODUCT = 'catalog_product_view';
const PAGE = 'cms_page_view';
const CHECKOUT = 'checkout_cart_index';
public function toOptionArray() {
$options = [
[
'label' => __( 'All Pages' ),
'value' => '',
],
[
'label' => __( 'Home Page' ),
'value' => self::HOMEPAGE,
],
[
'label' => __( 'Category pages' ),
'value' => self::CATEGORY,
],
[
'label' => __( 'Product pages' ),
'value' => self::PRODUCT,
],
[
'label' => __( 'CMS Pages' ),
'value' => self::PAGE,
],
[
'label' => __( 'Shopping Cart' ),
'value' => self::CHECKOUT,
]
];
return $options;
}
}
@@ -0,0 +1,32 @@
<?php /**/
namespace Olegnax\Athlete2\Model\Config\Settings\Product;
use Magento\Framework\Option\ArrayInterface;
use Magento\Framework\View\Asset\Repository;
class ActionsPosition implements ArrayInterface
{
protected $_assetRepo;
public function __construct(
Repository $assetRepo
) {
$this->_assetRepo = $assetRepo;
}
public function toOptionArray() {
$optionArray = [ ];
$array = $this->toArray();
foreach ( $array as $key => $value ) {
$optionArray[] = [ 'value' => $key, 'label' => $value ];
}
return $optionArray;
}
public function toArray() {
return [
'1' => $this->_assetRepo->getUrl( 'Olegnax_Athlete2::images/actions-layout-1.jpg' ),
'2' => $this->_assetRepo->getUrl( 'Olegnax_Athlete2::images/actions-layout-2.jpg' ),
];
}
}
@@ -0,0 +1,33 @@
<?php /**/
namespace Olegnax\Athlete2\Model\Config\Settings\Product;
use Magento\Framework\Option\ArrayInterface;
use Magento\Framework\View\Asset\Repository;
class GalleryLayout implements ArrayInterface
{
protected $_assetRepo;
public function __construct(
Repository $assetRepo
) {
$this->_assetRepo = $assetRepo;
}
public function toOptionArray() {
$optionArray = [ ];
$array = $this->toArray();
foreach ( $array as $key => $value ) {
$optionArray[] = [ 'value' => $key, 'label' => $value ];
}
return $optionArray;
}
public function toArray() {
return [
'fast' => $this->_assetRepo->getUrl( 'Olegnax_Athlete2::images/gallery-layout-02.png' ),
'1col' => $this->_assetRepo->getUrl( 'Olegnax_Athlete2::images/gallery-layout-01.jpg' ),
'2cols' => $this->_assetRepo->getUrl( 'Olegnax_Athlete2::images/gallery-layout-03.jpg' ),
];
}
}
@@ -0,0 +1,23 @@
<?php /**/
namespace Olegnax\Athlete2\Model\Config\Settings\Product;
use Magento\Framework\Option\ArrayInterface;
class ImageBehavior implements ArrayInterface
{
public function toOptionArray()
{
return [
['value' => '', 'label' => __('Default')],
['value' => 'center', 'label' => __('Align center in block')],
['value' => 'stretch', 'label' => __('Stretch to the block size')]
];
}
public function toArray()
{
$array = [];
foreach ($this->toOptionArray() as $item) {
$array[$item['value']] = $item['label'];
}
return $array;
}
}
@@ -0,0 +1,26 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings\Product;
use Magento\Framework\Option\ArrayInterface;
class ReviewPosition implements ArrayInterface
{
public function toOptionArray()
{
return [
['value' => '', 'label' => __('Default. In Content, Below Tabs')],
['value' => 'intabs', 'label' => __('Move Reviews in Tabs')],
['value' => 'oxbottom', 'label' => __('Before Page Bottom, After Content')],
['value' => 'bottom', 'label' => __('Page Bottom')],
['value' => 'gallery', 'label' => __('Below Gallery')]
];
}
public function toArray()
{
$array = [];
foreach ($this->toOptionArray() as $item) {
$array[$item['value']] = $item['label'];
}
return $array;
}
}
@@ -0,0 +1,26 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings\Product;
use Magento\Framework\Option\ArrayInterface;
class TabsPosition implements ArrayInterface
{
public function toOptionArray()
{
return [
['value' => '', 'label' => __('Default, In Content')],
['value' => 'info', 'label' => __('Move Tabs to Product Info block')],
['value' => 'oxbottom', 'label' => __('Before Page Bottom, After Content')],
['value' => 'bottom', 'label' => __('Page Bottom')],
['value' => 'gallery', 'label' => __('Below Gallery')]
];
}
public function toArray()
{
$array = [];
foreach ($this->toOptionArray() as $item) {
$array[$item['value']] = $item['label'];
}
return $array;
}
}
@@ -0,0 +1,33 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings\Product;
use Magento\Framework\Option\ArrayInterface;
use Magento\Framework\View\Asset\Repository;
class TabsStyle implements ArrayInterface
{
protected $_assetRepo;
public function __construct(
Repository $assetRepo
) {
$this->_assetRepo = $assetRepo;
}
public function toOptionArray() {
$optionArray = [ ];
$array = $this->toArray();
foreach ( $array as $key => $value ) {
$optionArray[] = [ 'value' => $key, 'label' => $value ];
}
return $optionArray;
}
public function toArray()
{
return [
'' => $this->_assetRepo->getUrl( 'Olegnax_Athlete2::images/tabs-style-01.png' ),
'minimal' => $this->_assetRepo->getUrl( 'Olegnax_Athlete2::images/tabs-style-02.png' ),
];
}
}
@@ -0,0 +1,12 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings\Radio;
use Magento\Framework\Option\ArrayInterface;
class Radio implements ArrayInterface
{
public function toOptionArray()
{
return [['value' => 'left', 'label' => __('Left')], ['value' => 'right', 'label' => __('Right')]];
}
}
@@ -0,0 +1,28 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings;
use Magento\Framework\Option\ArrayInterface;
class TextTransform implements ArrayInterface {
public function toOptionArray() {
$optionArray = [ ];
$array = $this->toArray();
foreach ( $array as $key => $value ) {
$optionArray[] = [ 'value' => $key, 'label' => $value ];
}
return $optionArray;
}
public function toArray() {
return [
'' => __( 'Choose Text Transform...' ),
'uppercase' => __( 'Uppercase' ),
'capitalize' => __( 'Capitalize' ),
'initial' => __( 'Initial' ),
];
}
}
@@ -0,0 +1,26 @@
<?php
namespace Olegnax\Athlete2\Model\Config\Settings;
use Magento\Framework\Option\ArrayInterface;
class TitleSize implements ArrayInterface {
public function toOptionArray() {
$optionArray = [ ];
$array = $this->toArray();
foreach ( $array as $key => $value ) {
$optionArray[] = [ 'value' => $key, 'label' => $value ];
}
return $optionArray;
}
public function toArray() {
return [
'h1' => __( 'Big (H1)' ),
'h2' => __( 'Medium (H2,H3)' ),
];
}
}