← All changes
|
includes/Admin/Components/SettingPageComponents.php
+26
-2
1.10.4
→
1.10.28
View file →
| @@ -20,8 +20,25 @@ | ||
| 20 | 20 | $value = syncBasalamSettings()->getSettings(SettingsConfig::SYNC_STATUS_PRODUCT) == true ? false : true; |
| 21 | 21 | echo '<input type="hidden" name="sync_basalam_settings[' . esc_attr(SettingsConfig::SYNC_STATUS_PRODUCT) . ']" value="' . esc_attr($value) . '">'; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | + public static function renderProductSyncOperations() | |
| 25 | + { | |
| 26 | + $operations = [ | |
| 27 | + SettingsConfig::SYNC_STATUS_PRODUCT_CREATE => 'ایجاد محصول در باسلام', | |
| 28 | + SettingsConfig::SYNC_STATUS_PRODUCT_UPDATE => 'بروزرسانی محصول در باسلام', | |
| 29 | + ]; | |
| 30 | + | |
| 31 | + foreach ($operations as $setting => $label) { | |
| 32 | + $enabled = syncBasalamSettings()->getSettings($setting); | |
| 33 | + echo '<input type="hidden" name="sync_basalam_settings[' . esc_attr($setting) . ']" value="0">'; | |
| 34 | + echo '<label class="basalam-product-sync-option">'; | |
| 35 | + echo '<input type="checkbox" name="sync_basalam_settings[' . esc_attr($setting) . ']" value="1"' . checked($enabled, true, false) . '>'; | |
| 36 | + echo '<span><strong>' . esc_html($label) . '</strong></span>'; | |
| 37 | + echo '</label>'; | |
| 38 | + } | |
| 39 | + } | |
| 40 | + | |
| 24 | 41 | public static function syncStatusOrder() |
| 25 | 42 | { |
| 26 | 43 | $value = syncBasalamSettings()->getSettings(SettingsConfig::SYNC_STATUS_ORDER) == true ? false : true; |
| 27 | 44 | echo '<input type="hidden" name="sync_basalam_settings[' . esc_attr(SettingsConfig::SYNC_STATUS_ORDER) . ']" value="' . esc_attr($value) . '">'; |
| @@ -121,9 +138,9 @@ | ||
| 121 | 138 | |
| 122 | 139 | public static function renderSyncProduct() |
| 123 | 140 | { |
| 124 | 141 | $current_value = syncBasalamSettings()->getSettings(SettingsConfig::SYNC_PRODUCT_FIELDS); |
| 125 | - echo '<select class="basalam-select basalam-select-center" name="sync_basalam_settings[' . esc_attr(SettingsConfig::SYNC_PRODUCT_FIELDS) . ']" onchange="BasalamToggleCustomFields(this.value)" id="basalam-sync-type">' | |
| 142 | + echo '<select class="basalam-select basalam-select-center" name="sync_basalam_settings[' . esc_attr(SettingsConfig::SYNC_PRODUCT_FIELDS) . ']" id="basalam-sync-type">' | |
| 126 | 143 | . '<option value="all"' . selected($current_value, "all", false) . '>همه اطلاعات</option>' |
| 127 | 144 | . '<option value="price_stock"' . selected($current_value, "price_stock", false) . '>فقط قیمت و موجودی</option>' |
| 128 | 145 | . '<option value="custom"' . selected($current_value, "custom", false) . '>سفارشی</option>' |
| 129 | 146 | . '</select>'; |
| @@ -263,9 +280,9 @@ | ||
| 263 | 280 | $current_value = syncBasalamSettings()->getSettings(SettingsConfig::PRODUCT_ATTRIBUTE_SUFFIX_PRIORITY); |
| 264 | 281 | $is_enabled = syncBasalamSettings()->getSettings(SettingsConfig::PRODUCT_ATTRIBUTE_SUFFIX_ENABLED) == 'yes'; |
| 265 | 282 | $disabled = $is_enabled ? '' : 'disabled'; |
| 266 | 283 | |
| 267 | - echo '<input type="text" name="sync_basalam_settings[' . esc_attr(SettingsConfig::PRODUCT_ATTRIBUTE_SUFFIX_PRIORITY) . ']" value="' . esc_attr($current_value) . '" class="basalam-input basalam-p basalam-attribute-suffix-priority basalam-max-width-80 basalam-font-12" placeholder="مثال: ناشر" ' . esc_attr($disabled) . '>'; | |
| 284 | + echo '<input type="text" name="sync_basalam_settings[' . esc_attr(SettingsConfig::PRODUCT_ATTRIBUTE_SUFFIX_PRIORITY) . ']" value="' . esc_attr($current_value) . '" class="basalam-input basalam-p basalam-attribute-suffix-priority basalam-max-width-80 basalam-font-12" placeholder="مثال: ناشر, نویسنده" ' . esc_attr($disabled) . '>'; | |
| 268 | 285 | } |
| 269 | 286 | |
| 270 | 287 | public static function renderMapOptionsProduct() |
| 271 | 288 | { |
| @@ -284,8 +301,9 @@ | ||
| 284 | 301 | public static function renderSyncProductFields() |
| 285 | 302 | { |
| 286 | 303 | echo '<div>'; |
| 287 | 304 | echo self::renderSingleCheckbox(SettingsConfig::SYNC_PRODUCT_FIELD_NAME, 'نام'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- HTML is escaped inside the component method. |
| 305 | + echo self::renderSingleCheckbox(SettingsConfig::SYNC_PRODUCT_FIELD_SKU, 'کد محصول (SKU)'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- HTML is escaped inside the component method. | |
| 288 | 306 | echo self::renderSingleCheckbox(SettingsConfig::SYNC_PRODUCT_FIELD_PHOTOS, 'عکس'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- HTML is escaped inside the component method. |
| 289 | 307 | echo self::renderSingleCheckbox(SettingsConfig::SYNC_PRODUCT_FIELD_PRICE, 'قیمت'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- HTML is escaped inside the component method. |
| 290 | 308 | echo self::renderSingleCheckbox(SettingsConfig::SYNC_PRODUCT_FIELD_STOCK, 'موجودی'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- HTML is escaped inside the component method. |
| 291 | 309 | echo self::renderSingleCheckbox(SettingsConfig::SYNC_PRODUCT_FIELD_WEIGHT, 'وزن'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- HTML is escaped inside the component method. |
| @@ -291,8 +309,14 @@ | ||
| 291 | 309 | echo self::renderSingleCheckbox(SettingsConfig::SYNC_PRODUCT_FIELD_WEIGHT, 'وزن'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- HTML is escaped inside the component method. |
| 292 | 310 | echo self::renderSingleCheckbox(SettingsConfig::SYNC_PRODUCT_FIELD_DESCRIPTION, 'توضیحات'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- HTML is escaped inside the component method. |
| 293 | 311 | echo self::renderSingleCheckbox(SettingsConfig::SYNC_PRODUCT_FIELD_ATTR, 'ویژگی ها'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- HTML is escaped inside the component method. |
| 294 | 312 | echo self::renderSingleCheckbox(SettingsConfig::SYNC_PRODUCT_FIELD_VIDEO, 'ویدیو'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- HTML is escaped inside the component method. |
| 313 | + echo '</div>'; | |
| 314 | + | |
| 315 | + echo '<div class="basalam-margin-top-25-bottom-10">'; | |
| 316 | + echo '<label class="basalam-label basalam-p">متغیرها</label><br>'; | |
| 317 | + echo self::renderSingleCheckbox(SettingsConfig::SYNC_PRODUCT_FIELD_VARIANT_PRICE, 'قیمت متغیرها'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- HTML is escaped inside the component method. | |
| 318 | + echo self::renderSingleCheckbox(SettingsConfig::SYNC_PRODUCT_FIELD_VARIANT_STOCK, 'موجودی متغیرها'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- HTML is escaped inside the component method. | |
| 295 | 319 | echo '</div>'; |
| 296 | 320 | } |
| 297 | 321 | |
| 298 | 322 | private static function renderSingleCheckbox($field_key, $label) |