![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/extmag/shiplab/Model/Rule/Condition/ |
<?php /** * Copyright © Extmag. All rights reserved. */ namespace Extmag\Shiplab\Model\Rule\Condition; use Magento\Framework\Model\AbstractModel; /** * Address rule condition data model. */ class Address extends \Magento\SalesRule\Model\Rule\Condition\Address { /** * Load attribute options * * @return $this */ public function loadAttributeOptions() { $attributes = [ 'base_subtotal_with_discount' => __('Subtotal (Excl. Tax)'), 'base_subtotal' => __('Subtotal'), 'total_qty' => __('Total Items Quantity'), 'weight' => __('Total Weight'), 'postcode' => __('Shipping Postcode'), 'region' => __('Shipping Region'), 'region_id' => __('Shipping State/Province'), 'country_id' => __('Shipping Country'), ]; $this->setAttributeOption($attributes); return $this; } /** * @return string */ public function getInputType() { switch ($this->getAttribute()) { case 'base_subtotal': case 'weight': case 'total_qty': return 'numeric'; case 'region_id': return 'select'; case 'country_id': return 'multiselect'; } return 'string'; } /** * @return string */ public function getValueElementType() { switch ($this->getAttribute()) { case 'region_id': return 'select'; case 'country_id': return 'multiselect'; } return 'text'; } /** * @return array|mixed */ public function getValueSelectOptions() { if (!$this->hasData('value_select_options')) { switch ($this->getAttribute()) { case 'country_id': $options = $this->_directoryCountry->toOptionArray(); break; case 'region_id': $options = $this->_directoryAllregion->toOptionArray(); break; default: $options = []; } $this->setData('value_select_options', $options); } return $this->getData('value_select_options'); } }