コード例 #1
0
</th>
					<td>
						<?php 
            echo ThemexInterface::renderOption(array('id' => 'local_delivery_countries[]', 'type' => 'select', 'options' => ThemexWoo::getShippingCountries(), 'value' => themex_array('countries', $shipping['local_delivery']), 'wrap' => false, 'attributes' => array('class' => 'element-chosen', 'multiple' => 'multiple', 'data-placeholder' => __('Select Options', 'makery'))));
            ?>
					</td>
				</tr>
				<tr>
					<th><?php 
            _e('Cost', 'makery');
            ?>
</th>
					<td>
						<div class="field-wrap">
							<input type="text" name="local_delivery_cost" value="<?php 
            echo ThemexWoo::formatPrice(themex_value('cost', $shipping['local_delivery'], '0'));
            ?>
" />
						</div>
					</td>
				</tr>
			</tbody>
		</table>
		<?php 
        }
        ?>
		<a href="#" class="element-button element-submit primary"><?php 
        _e('Save Changes', 'makery');
        ?>
</a>
		<input type="hidden" name="shop_id" value="<?php 
コード例 #2
0
 /**
  * Updates shipping settings
  *
  * @access public
  * @param int $ID
  * @param array $data
  * @return void
  */
 public static function updateShipping($ID, $data)
 {
     $shipping = array();
     $methods = ThemexWoo::getShippingMethods();
     $defaults = array('free_shipping', 'flat_rate', 'international_delivery', 'local_delivery');
     foreach ($defaults as $default) {
         if (isset($methods[$default])) {
             $shipping[$default]['enabled'] = sanitize_title(themex_value($default . '_enabled', $data));
             $shipping[$default]['availability'] = sanitize_title(themex_value($default . '_availability', $data));
             $countries = themex_array($default . '_countries', $data);
             if (is_array($countries)) {
                 foreach ($countries as &$country) {
                     if (is_array($country) && !empty($country)) {
                         $country = reset($country);
                     }
                 }
             }
             $shipping[$default]['countries'] = $countries;
             if ($default == 'free_shipping') {
                 $shipping[$default]['min_amount'] = ThemexWoo::formatPrice(themex_value($default . '_min_amount', $data), false);
             } else {
                 if ($default == 'flat_rate') {
                     $shipping[$default]['default_cost'] = ThemexWoo::formatPrice(themex_value($default . '_default_cost', $data), false);
                     $costs = themex_array($default . '_cost', $data);
                     if (is_array($costs)) {
                         foreach ($costs as &$cost) {
                             $cost = ThemexWoo::formatPrice($cost, false);
                         }
                     }
                     $classes = themex_array($default . '_class', $data);
                     $shipping[$default]['costs'] = array();
                     if (is_array($classes)) {
                         $classes = array_map('sanitize_title', $classes);
                         foreach ($classes as $index => $class) {
                             if (isset($costs[$index]) && !empty($costs[$index])) {
                                 $shipping[$default]['costs'][$class] = $costs[$index];
                             }
                         }
                     }
                 } else {
                     if (in_array($default, array('international_delivery', 'local_delivery'))) {
                         $shipping[$default]['cost'] = ThemexWoo::formatPrice(themex_value($default . '_cost', $data), false);
                     }
                 }
             }
         }
     }
     ThemexCore::updatePostMeta($ID, 'shipping', $shipping);
     ThemexInterface::$messages[] = __('Changes have been successfully saved', 'makery');
     $_POST['success'] = true;
 }
コード例 #3
0
								</div>
								<div class="fourcol column">
									<div class="field-wrap">
										<input type="text" name="variation_regular_prices[]" value="<?php 
                        echo ThemexWoo::formatPrice($variation->_regular_price);
                        ?>
" placeholder="<?php 
                        _e('Regular Price', 'makery');
                        ?>
" />
									</div>
								</div>
								<div class="fourcol column last">
									<div class="field-wrap">
										<input type="text" name="variation_sale_prices[]" value="<?php 
                        echo ThemexWoo::formatPrice($variation->_sale_price);
                        ?>
" placeholder="<?php 
                        _e('Sale Price', 'makery');
                        ?>
" />
									</div>
								</div>
								<input type="hidden" name="variation_ids[]" value="<?php 
                        echo $variation->ID;
                        ?>
" />
							</div>
						</td>
					</tr>
					<?php