function rules_meta_box ($Promotion) { $targets = array( 'Cart' => __('shopping cart','Ecart'), ); $target = '<select name="target" id="promotion-target" class="small">'; $target .= menuoptions($targets,$Promotion->target,true); $target .= '</select>'; if (empty($Promotion->search)) $Promotion->search = "all"; $logic = '<select name="search" class="small">'; $logic .= menuoptions(array('any'=>__('any','Ecart'),'all' => __('all','Ecart')),$Promotion->search,true); $logic .= '</select>'; ?> <p><strong><?php printf(__('Apply discount to %s','Ecart'),$target,$logic); ?> <strong id="target-property"></strong></strong></p> <table class="form-table" id="cartitem"></table> <p><strong><?php printf(__('When %s of these conditions match the','Ecart'),$logic); ?> <strong id="rule-target">:</strong></strong></p> <table class="form-table" id="rules"></table> <?php }
function save_meta_box ($Product) { global $Ecart; $workflows = array( "continue" => __('Continue Editing','Ecart'), "close" => __('Products Manager','Ecart'), "new" => __('New Product','Ecart'), "next" => __('Edit Next','Ecart'), "previous" => __('Edit Previous','Ecart') ); $date_format = get_option('date_format'); $time_format = get_option('time_format'); ?> <div id="misc-publishing-actions"> <input type="hidden" name="id" value="<?php echo $Product->id; ?>" /> <div class="misc-pub-section misc-pub-section-last"> <input type="hidden" name="status" value="draft" /><input type="checkbox" name="status" value="publish" id="published" tabindex="11" <?php if ($Product->status == "publish") echo ' checked="checked"'?> /><label for="published"><strong> <?php if ($Product->published() && !empty($Product->id)) _e('Published','Ecart'); else _e('Publish','Ecart'); ?></strong> <span id="publish-status"><?php if ($Product->publish>1) printf(__('on: %s'),"</span><br />".date($date_format.' @ '.$time_format,$Product->publish)); else echo "</span>"; ?></label> <span id="schedule-toggling"><div style="display:none !important;"><button type="button" name="schedule-toggle" id="schedule-toggle" class="button-secondary"><?php if ($Product->publish>1) _e('Edit','Ecart'); else _e('Schedule','Ecart'); ?></button></div></span> <div id="scheduling"> <div id="schedule-calendar" class="calendar-wrap"> <?php $dateorder = date_format_order(true); foreach ($dateorder as $type => $format): if ($previous == "s" && $type[0] == "s") continue; if ("month" == $type): ?><input type="text" name="publish[month]" id="publish-month" title="<?php _e('Month','Ecart'); ?>" size="2" maxlength="2" value="<?php echo ($Product->publish>1)?date("n",$Product->publish):''; ?>" class="publishdate selectall" /><?php elseif ("day" == $type): ?><input type="text" name="publish[date]" id="publish-date" title="<?php _e('Day','Ecart'); ?>" size="2" maxlength="2" value="<?php echo ($Product->publish>1)?date("j",$Product->publish):''; ?>" class="publishdate selectall" /><?php elseif ("year" == $type): ?><input type="text" name="publish[year]" id="publish-year" title="<?php _e('Year','Ecart'); ?>" size="4" maxlength="4" value="<?php echo ($Product->publish>1)?date("Y",$Product->publish):''; ?>" class="publishdate selectall" /><?php elseif ($type[0] == "s"): echo "/"; endif; $previous = $type[0]; ?><?php endforeach; ?> <br /> <input type="text" name="publish[hour]" id="publish-hour" title="<?php _e('Hour','Ecart'); ?>" size="2" maxlength="2" value="<?php echo ($Product->publish>1)?date("g",$Product->publish):date('g'); ?>" class="publishdate selectall" />:<input type="text" name="publish[minute]" id="publish-minute" title="<?php _e('Minute','Ecart'); ?>" size="2" maxlength="2" value="<?php echo ($Product->publish>1)?date("i",$Product->publish):date('i'); ?>" class="publishdate selectall" /> <select name="publish[meridiem]" class="publishdate"> <?php echo menuoptions(array('AM' => __('AM','Ecart'),'PM' => __('PM','Ecart')),date('A',$Product->publish),true); ?> </select> </div> </div> </div> </div> <div id="major-publishing-actions"> <select name="settings[workflow]" id="workflow"> <?php echo menuoptions($workflows,$Ecart->Settings->get('workflow'),true); ?> </select> <input type="submit" class="button-primary" name="save" value="<?php _e('Save Product','Ecart'); ?>" /> </div> <?php }
function save_meta_box($Product) { global $Shopp; $workflows = array("continue" => __('Continue Editing', 'Shopp'), "close" => __('Products Manager', 'Shopp'), "new" => __('New Product', 'Shopp'), "next" => __('Edit Next', 'Shopp'), "previous" => __('Edit Previous', 'Shopp')); ?> <div><input type="hidden" name="id" value="<?php echo $Product->id; ?> " /></div> <div id="major-publishing-actions"> <select name="settings[workflow]" id="workflow"> <?php echo menuoptions($workflows, $Shopp->Settings->get('workflow'), true); ?> </select> <input type="submit" class="button-primary" name="save" value="<?php _e('Save Product', 'Shopp'); ?> " /> </div> <?php }
<div class="optionrow fix"> <div class="optiontitle fix"> <strong><label for="showcase-order"><?php _e('Product Images Order','Ecart'); ?></label></strong><br> </div> <div class="theinputs"> <div class="optioninputs"> <br/> <select name="settings[product_image_order]" id="showcase-order"> <?php echo menuoptions($orderOptions,$this->Settings->get('product_image_order'),true); ?> </select> by <select name="settings[product_image_orderby]" id="showcase-orderby"> <?php echo menuoptions($orderBy,$this->Settings->get('product_image_orderby'),true); ?> </select> <br /> <br> <br> </div> </div> <div class="theexplanation"> <div class="context"></div> <p><?php _e('Set the default display order of your product pictures.','Ecart'); ?></p> </div> <div class="clear"></div>
/** * ecartregcust::shortcode() * * @return */ public function shortcode() { $data = array(); $data['show_form'] = true; $data['ecart_account_type'] = $this->ecart_account_type; $this->show_billing = (isset($this->options['ecartreg_show_billing']) && $this->options['ecartreg_show_billing'] == 1) ? true : false; global $Ecart; $base = $Ecart->Settings->get('base_operations'); $countries = $Ecart->Settings->get('target_markets'); $selected_country = (isset($_POST['billing']['country'])) ? $_POST['billing']['country'] : $base['country']; $data['countries_select_html'] = menuoptions($countries,$selected_country,true); $data['show_billing'] = $this->show_billing; if (isset($_POST['customer'])) { $user = $this->add_user(); if (!$user) { $data['form_error'] = $this->form_error; } else { $this->user = $user; $data['show_form'] = false; $data['form_success'] = 'Thank you for registering.'; do_action('scr_registration_success'); } } $html = $this->view('library.register.form.php', $data); return ($html !== false) ? $html : ''; }
/** * Helper method to render markup for state/province input fields * * @internal * @since 1.3 * * @param string $result The output * @param array $options The options * - **mode**: `input` (input, value) Displays the field `input` or the current value of the property * - **type**: `menu` (menu, text) Changes the input type to a drop-down menu or text input field * - **options**: A comma-separated list of options for the drop-down menu when the **type** is set to `menu` * - **required**: `auto` (auto,on,off) Sets the field to be required automatically, always `on` or disabled `off` * - **class**: The class attribute specifies one or more class-names for the input * - **label**: The label shown as the default option of the drop-down menu when the **type** is set to `menu` * - **address**: `billing` (billing,shipping) Used to specify which address the field takes input for * @param ShoppCustomer $O The working object * @return string The state input markup **/ private static function state($result, $options, $O) { $defaults = array('mode' => 'input', 'type' => 'menu', 'options' => '', 'required' => 'auto', 'class' => '', 'label' => '', 'address' => 'billing'); $options = array_merge($defaults, $options); $options['address'] = self::valid_address($options['address']); $Address = self::AddressObject($options['address']); if (!isset($options['value'])) { $options['value'] = $Address->state; } $options['selected'] = $options['value']; $options['id'] = "{$options['address']}-state"; extract($options, EXTR_SKIP); if ('value' == $mode) { return $value; } $countries = (array) shopp_setting('target_markets'); $select_attrs = array('title', 'required', 'class', 'disabled', 'required', 'size', 'tabindex', 'accesskey'); $country = ShoppBaseLocale()->country(); if (!empty($Address->country)) { $country = $Address->country; } if (!array_key_exists($country, $countries)) { $country = key($countries); } $regions = Lookup::country_zones(); $states = isset($regions[$country]) ? $regions[$country] : array(); if (!empty($options['options']) && empty($states)) { $states = explode(',', $options['options']); } $classes = false === strpos($class, ' ') ? explode(' ', $class) : array(); $classes[] = $id; if ('auto' == $required) { unset($options['required']); // prevent inputattrs from handling required=auto $classes[] = 'auto-required'; } $options['class'] = join(' ', $classes); if ('text' == $type) { return '<input type="text" name="' . $address . '[state]" id="' . $id . '" ' . inputattrs($options) . '/>'; } $options['disabled'] = 'disabled'; $options['class'] = join(' ', array_merge($classes, array('disabled', 'hidden'))); $result = '<select name="' . $address . '[state]" id="' . $id . '-menu" ' . inputattrs($options, $select_attrs) . '>' . '<option value="">' . $label . '</option>' . (!empty($states) ? menuoptions($states, $selected, true) : '') . '</select>'; unset($options['disabled']); $options['class'] = join(' ', $classes); $result .= '<input type="text" name="' . $address . '[state]" id="' . $id . '" ' . inputattrs($options) . '/>'; return $result; }
<td scope="row" valign="top" class="rate"><input type="text" name="settings[taxrates][${id}][rate]" id="tax-rate" value="${rate}" size="7" class="selectall" tabindex="1" /><br /><label for="tax-rate"><?php _e('Tax Rate', 'Shopp'); ?> </label><br /> <input type="hidden" name="settings[taxrates][${id}][compound]" value="off" /><label><input type="checkbox" id="tax-compound" name="settings[taxrates][${id}][compound]" value="on" ${compounded} tabindex="4" /> <?php Shopp::_e('Compound'); ?> </label></td> <td scope="row" class="conditions"> <select name="settings[taxrates][${id}][country]" class="country" tabindex="2">${countries}</select><select name="settings[taxrates][${id}][zone]" class="zone no-zones" tabindex="3">${zones}</select> <?php echo ShoppUI::button('add', 'addrule'); ?> <?php $options = array('any' => Shopp::__('any'), 'all' => strtolower(Shopp::__('All'))); $menu = '<select name="settings[taxrates][${id}][logic]" class="logic">' . menuoptions($options, false, true) . '</select>'; ?> <div class="conditionals no-conditions"> <p><label><?php printf(__('Apply tax rate when %s of the following conditions match', 'Shopp'), $menu); ?> :</label></p> <ul> ${conditions} </ul> </div> </td> <td> <div class="local-rates panel subpanel no-local-rates"> <div class="label"><label><?php _e('Local Rates', 'Shopp');
/** * Provides ecart('checkout') template API functionality * * @since 1.0 * * @return mixed **/ function tag ($property,$options=array()) { global $Ecart,$wp; $pages = $Ecart->Settings->get('pages'); $base = $Ecart->Settings->get('base_operations'); $countries = $Ecart->Settings->get('target_markets'); $process = get_query_var('ecart_proc'); $select_attrs = array('title','required','class','disabled','required','size','tabindex','accesskey'); $submit_attrs = array('title','class','value','disabled','tabindex','accesskey'); if (!isset($options['mode'])) $options['mode'] = "input"; switch ($property) { case "url": $link = ecarturl(false,'checkout',$this->security()); // Pass any arguments along $args = $_GET; unset($args['page_id'],$args['acct']); $link = esc_url(add_query_arg($args,$link)); if ($process == "confirm-order") $link = apply_filters('ecart_confirm_url',$link); else $link = apply_filters('ecart_checkout_url',$link); return $link; break; case "function": if (!isset($options['shipcalc'])) $options['shipcalc'] = '<img src="'.ECART_ADMIN_URI.'/icons/updating.gif" alt="'.__('Updating','Ecart').'" width="16" height="16" />'; $regions = Lookup::country_zones(); $base = $Ecart->Settings->get('base_operations'); $js = "var regions = ".json_encode($regions).",". "SHIPCALC_STATUS = '".$options['shipcalc']."',". "d_pm = '".sanitize_title_with_dashes($this->paymethod)."',". "pm_cards = {};"; foreach ($this->payoptions as $handle => $option) { if (empty($option->cards)) continue; $js .= "pm_cards['".$handle."'] = ".json_encode($option->cards).";"; } add_storefrontjs($js,true); if (!empty($options['value'])) $value = $options['value']; else $value = "process"; $output = '<div><input type="hidden" name="checkout" value="'.$value.'" /></div>'; if ($value == "confirmed") $output = apply_filters('ecart_confirm_form',$output); else $output = apply_filters('ecart_checkout_form',$output); return $output; break; case "errors": case "error": $Errors = &EcartErrors(); if (!$Errors->exist(ECART_COMM_ERR)) return false; $errors = $Errors->get(ECART_COMM_ERR); $defaults = array( 'before' => '<li>', 'after' => '</li>' ); $options = array_merge($defaults,$options); extract($options); $result = ""; foreach ((array)$errors as $error) if (!$error->blank()) $result .= $before.$error->message(true).$after; return $result; break; case "cart-summary": ob_start(); include(ECART_TEMPLATES."/summary.php"); $content = ob_get_contents(); ob_end_clean(); // If inside the checkout form, strip the extra <form> tag so we don't break standards // This is ugly, but necessary given the different markup contexts the cart summary is used in $Storefront =& EcartStorefront(); if ($Storefront !== false && $Storefront->checkout) $content = preg_replace('/<\/?form.*?>/','',$content); return $content; break; case "loggedin": return $this->Customer->login; break; case "notloggedin": return (!$this->Customer->login && $Ecart->Settings->get('account_system') != "none"); break; case "email-login": // Deprecating case "loginname-login": // Deprecating case "account-login": if (!isset($options['autocomplete'])) $options['autocomplete'] = "off"; if (!empty($_POST['account-login'])) $options['value'] = $_POST['account-login']; return '<input type="text" name="account-login" id="account-login"'.inputattrs($options).' />'; break; case "password-login": if (!isset($options['autocomplete'])) $options['autocomplete'] = "off"; if (!empty($_POST['password-login'])) $options['value'] = $_POST['password-login']; return '<input type="password" name="password-login" id="password-login" '.inputattrs($options).' />'; break; case "submit-login": // Deprecating case "login-button": $string = '<input type="hidden" name="process-login" id="process-login" value="false" />'; $string .= '<input type="submit" name="submit-login" id="submit-login" '.inputattrs($options).' />'; return $string; break; case "firstname": if ($options['mode'] == "value") return $this->Customer->firstname; if (!empty($this->Customer->firstname)) $options['value'] = $this->Customer->firstname; return '<input type="text" name="firstname" id="firstname" '.inputattrs($options).' />'; break; case "lastname": if ($options['mode'] == "value") return $this->Customer->lastname; if (!empty($this->Customer->lastname)) $options['value'] = $this->Customer->lastname; return '<input type="text" name="lastname" id="lastname" '.inputattrs($options).' />'; break; case "email": if ($options['mode'] == "value") return $this->Customer->email; if (!empty($this->Customer->email)) $options['value'] = $this->Customer->email; return '<input type="text" name="email" id="email" '.inputattrs($options).' />'; break; case "loginname": if (!isset($options['autocomplete'])) $options['autocomplete'] = "off"; if ($options['mode'] == "value") return $this->Customer->loginname; if (!empty($this->Customer->loginname)) $options['value'] = $this->Customer->loginname; return '<input type="text" name="loginname" id="login" '.inputattrs($options).' />'; break; case "password": if (!isset($options['autocomplete'])) $options['autocomplete'] = "off"; if ($options['mode'] == "value") return strlen($this->Customer->password) == 34?str_pad('•',8):$this->Customer->password; if (!empty($this->Customer->password)) $options['value'] = $this->Customer->password; return '<input type="password" name="password" id="password" '.inputattrs($options).' />'; break; case "confirm-password": if (!isset($options['autocomplete'])) $options['autocomplete'] = "off"; if (!empty($this->Customer->_confirm_password)) $options['value'] = $this->Customer->_confirm_password; return '<input type="password" name="confirm-password" id="confirm-password" '.inputattrs($options).' />'; break; case "phone": if ($options['mode'] == "value") return $this->Customer->phone; if (!empty($this->Customer->phone)) $options['value'] = $this->Customer->phone; return '<input type="text" name="phone" id="phone" '.inputattrs($options).' />'; break; case "organization": case "company": if ($options['mode'] == "value") return $this->Customer->company; if (!empty($this->Customer->company)) $options['value'] = $this->Customer->company; return '<input type="text" name="company" id="company" '.inputattrs($options).' />'; break; case "marketing": if ($options['mode'] == "value") return $this->Customer->marketing; if (!empty($this->Customer->marketing)) $options['value'] = $this->Customer->marketing; $attrs = array("accesskey","alt","checked","class","disabled","format", "minlength","maxlength","readonly","size","src","tabindex", "title"); $input = '<input type="hidden" name="marketing" value="no" />'; $input .= '<input type="checkbox" name="marketing" id="marketing" value="yes" '.inputattrs($options,$attrs).' />'; return $input; break; case "customer-info": $defaults = array( 'name' => false, // REQUIRED 'info' => false, 'mode' => false, 'title' => '', 'type' => 'hidden', 'value' => '', 'cols' => '30', 'rows' => '3', 'options' => '' ); $op = array_merge($defaults,$options); extract($op); // Allowed input types $allowed_types = array("text","hidden","password","checkbox","radio","textarea","menu"); // Input types that can override option-specified value with the loaded data value $value_override = array("text","hidden","password","textarea","menu"); /// Allowable attributes for textarea inputs $textarea_attrs = array('accesskey','title','tabindex','class','disabled','required'); if (!$name) { // Iterator for order data if (!isset($this->_customer_info_loop)) { reset($this->Customer->info->named); $this->_customer_info_loop = true; } else next($this->Customer->info->named); if (current($this->Customer->info->named) !== false) return true; else { unset($this->_customer_info_loop); return false; } } if (isset($this->Customer->info->named[$name])) $info = $this->Customer->info->named[$name]; if ($name && $mode == "value") return $info; if (!in_array($type,$allowed_types)) $type = 'hidden'; if (empty($title)) $title = $name; $id = 'customer-info-'.sanitize_title_with_dashes($name); if (in_array($type,$value_override) && !empty($info)) $value = $info; switch (strtolower($type)) { case "textarea": return '<textarea name="info['.$name.']" cols="'.$cols.'" rows="'.$rows.'" id="'.$id.'" '.inputattrs($op,$textarea_attrs).'>'.$value.'</textarea>'; break; case "menu": if (is_string($options)) $options = explode(',',$options); return '<select name="info['.$name.']" id="'.$id.'" '.inputattrs($op,$select_attrs).'>'.menuoptions($options,$value).'</select>'; break; default: return '<input type="'.$type.'" name="info['.$name.']" id="'.$id.'" '.inputattrs($op).' />'; break; } break; // SHIPPING TAGS case "shipping": return (!empty($this->shipped)); break; case "shipping-address": if ($options['mode'] == "value") return $this->Shipping->address; if (!empty($this->Shipping->address)) $options['value'] = $this->Shipping->address; return '<input type="text" name="shipping[address]" id="shipping-address" '.inputattrs($options).' />'; break; case "shipping-xaddress": if ($options['mode'] == "value") return $this->Shipping->xaddress; if (!empty($this->Shipping->xaddress)) $options['value'] = $this->Shipping->xaddress; return '<input type="text" name="shipping[xaddress]" id="shipping-xaddress" '.inputattrs($options).' />'; break; case "shipping-city": if ($options['mode'] == "value") return $this->Shipping->city; if (!empty($this->Shipping->city)) $options['value'] = $this->Shipping->city; return '<input type="text" name="shipping[city]" id="shipping-city" '.inputattrs($options).' />'; break; case "shipping-province": case "shipping-state": if ($options['mode'] == "value") return $this->Shipping->state; if (!isset($options['selected'])) $options['selected'] = false; if (!empty($this->Shipping->state)) { $options['selected'] = $this->Shipping->state; $options['value'] = $this->Shipping->state; } $output = false; $country = $base['country']; if (!empty($this->Shipping->country)) $country = $this->Shipping->country; if (!array_key_exists($country,$countries)) $country = key($countries); $regions = Lookup::country_zones(); $states = $regions[$country]; if (isset($options['options']) && empty($states)) $states = explode(",",$options['options']); if (isset($options['type']) && $options['type'] == "text") return '<input type="text" name="shipping[state]" id="shipping-state" '.inputattrs($options).'/>'; $classname = isset($options['class'])?$options['class']:''; $label = (!empty($options['label']))?$options['label']:''; $options['disabled'] = 'disabled'; $options['class'] = ($classname?"$classname ":"").'disabled hidden'; $output .= '<select name="shipping[state]" id="shipping-state-menu" '.inputattrs($options,$select_attrs).'>'; $output .= '<option value="">'.$label.'</option>'; if (is_array($states) && !empty($states)) $output .= menuoptions($states,$options['selected'],true); $output .= '</select>'; unset($options['disabled']); $options['class'] = $classname; $output .= '<input type="text" name="shipping[state]" id="shipping-state" '.inputattrs($options).'/>'; return $output; break; case "shipping-postcode": if ($options['mode'] == "value") return $this->Shipping->postcode; if (!empty($this->Shipping->postcode)) $options['value'] = $this->Shipping->postcode; return '<input type="text" name="shipping[postcode]" id="shipping-postcode" '.inputattrs($options).' />'; break; case "shipping-country": if ($options['mode'] == "value") return $this->Shipping->country; if (!empty($this->Shipping->country)) $options['selected'] = $this->Shipping->country; else if (empty($options['selected'])) $options['selected'] = $base['country']; $output = '<select name="shipping[country]" id="shipping-country" '.inputattrs($options,$select_attrs).'>'; $output .= menuoptions($countries,$options['selected'],true); $output .= '</select>'; return $output; break; case "same-shipping-address": $label = __("Same shipping address","Ecart"); if (isset($options['label'])) $label = $options['label']; $checked = ' checked="checked"'; if (isset($options['checked']) && !value_is_true($options['checked'])) $checked = ''; $output = '<label for="same-shipping"><input type="checkbox" name="sameshipaddress" value="on" id="same-shipping" '.$checked.' /> '.$label.'</label>'; return $output; break; case "residential-shipping-address": $label = __("Residential shipping address","Ecart"); if (isset($options['label'])) $label = $options['label']; if (isset($options['checked']) && value_is_true($options['checked'])) $checked = ' checked="checked"'; $output = '<label for="residential-shipping"><input type="hidden" name="shipping[residential]" value="no" /><input type="checkbox" name="shipping[residential]" value="yes" id="residential-shipping" '.$checked.' /> '.$label.'</label>'; return $output; break; // BILLING TAGS case "billing-required": // DEPRECATED case "card-required": if ($this->Cart->Totals->total == 0) return false; foreach ($Ecart->Gateways->active as $gateway) if (!empty($gateway->cards)) return true; return false; break; case "billing-address": if ($options['mode'] == "value") return $this->Billing->address; if (!empty($this->Billing->address)) $options['value'] = $this->Billing->address; return '<input type="text" name="billing[address]" id="billing-address" '.inputattrs($options).' />'; break; case "billing-xaddress": if ($options['mode'] == "value") return $this->Billing->xaddress; if (!empty($this->Billing->xaddress)) $options['value'] = $this->Billing->xaddress; return '<input type="text" name="billing[xaddress]" id="billing-xaddress" '.inputattrs($options).' />'; break; case "billing-city": if ($options['mode'] == "value") return $this->Billing->city; if (!empty($this->Billing->city)) $options['value'] = $this->Billing->city; return '<input type="text" name="billing[city]" id="billing-city" '.inputattrs($options).' />'; break; case "billing-province": case "billing-state": if ($options['mode'] == "value") return $this->Billing->state; if (!isset($options['selected'])) $options['selected'] = false; if (!empty($this->Billing->state)) { $options['selected'] = $this->Billing->state; $options['value'] = $this->Billing->state; } $output = false; $country = $base['country']; if (!empty($this->Billing->country)) $country = $this->Billing->country; if (!array_key_exists($country,$countries)) $country = key($countries); $regions = Lookup::country_zones(); $states = $regions[$country]; if (isset($options['options']) && empty($states)) $states = explode(",",$options['options']); if (isset($options['type']) && $options['type'] == "text") return '<input type="text" name="billing[state]" id="billing-state" '.inputattrs($options).'/>'; $classname = isset($options['class'])?$options['class']:''; $label = (!empty($options['label']))?$options['label']:''; $options['disabled'] = 'disabled'; $options['class'] = ($classname?"$classname ":"").'disabled hidden'; $output .= '<select name="billing[state]" id="billing-state-menu" '.inputattrs($options,$select_attrs).'>'; $output .= '<option value="">'.$label.'</option>'; if (is_array($states) && !empty($states)) $output .= menuoptions($states,$options['selected'],true); $output .= '</select>'; unset($options['disabled']); $options['class'] = $classname; $output .= '<input type="text" name="billing[state]" id="billing-state" '.inputattrs($options).'/>'; return $output; break; case "billing-postcode": if ($options['mode'] == "value") return $this->Billing->postcode; if (!empty($this->Billing->postcode)) $options['value'] = $this->Billing->postcode; return '<input type="text" name="billing[postcode]" id="billing-postcode" '.inputattrs($options).' />'; break; case "billing-country": if ($options['mode'] == "value") return $this->Billing->country; if (!empty($this->Billing->country)) $options['selected'] = $this->Billing->country; else if (empty($options['selected'])) $options['selected'] = $base['country']; $output = '<select name="billing[country]" id="billing-country" '.inputattrs($options,$select_attrs).'>'; $output .= menuoptions($countries,$options['selected'],true); $output .= '</select>'; return $output; break; case "billing-card": if ($options['mode'] == "value") return str_repeat('X',strlen($this->Billing->card)-4) .substr($this->Billing->card,-4); $options['class'] = isset($options['class']) ? $options['class'].' paycard':'paycard'; if (!empty($this->Billing->card)) { $options['value'] = $this->Billing->card; $this->Billing->card = ""; } if (!isset($options['autocomplete'])) $options['autocomplete'] = "off"; return '<input type="text" name="billing[card]" id="billing-card" '.inputattrs($options).' />'; break; case "billing-cardexpires-mm": if ($options['mode'] == "value") return date("m",$this->Billing->cardexpires); $options['class'] = isset($options['class']) ? $options['class'].' paycard':'paycard'; if (!isset($options['autocomplete'])) $options['autocomplete'] = "off"; if (!empty($this->Billing->cardexpires)) $options['value'] = date("m",$this->Billing->cardexpires); return '<input type="text" name="billing[cardexpires-mm]" id="billing-cardexpires-mm" '.inputattrs($options).' />'; break; case "billing-cardexpires-yy": if ($options['mode'] == "value") return date("y",$this->Billing->cardexpires); $options['class'] = isset($options['class']) ? $options['class'].' paycard':'paycard'; if (!isset($options['autocomplete'])) $options['autocomplete'] = "off"; if (!empty($this->Billing->cardexpires)) $options['value'] = date("y",$this->Billing->cardexpires); return '<input type="text" name="billing[cardexpires-yy]" id="billing-cardexpires-yy" '.inputattrs($options).' />'; break; case "billing-cardtype": if ($options['mode'] == "value") return $this->Billing->cardtype; $options['class'] = isset($options['class']) ? $options['class'].' paycard':'paycard'; if (!isset($options['selected'])) $options['selected'] = false; if (!empty($this->Billing->cardtype)) $options['selected'] = $this->Billing->cardtype; $cards = array(); foreach ($this->paycards as $paycard) $cards[$paycard->symbol] = $paycard->name; $label = (!empty($options['label']))?$options['label']:''; $output = '<select name="billing[cardtype]" id="billing-cardtype" '.inputattrs($options,$select_attrs).'>'; $output .= '<option value="" selected="selected">'.$label.'</option>'; $output .= menuoptions($cards,$options['selected'],true); $output .= '</select>'; $js = array(); $js[] = "var paycards = {};"; foreach ($this->paycards as $handle => $paycard) { $js[] = "paycards['".$handle."'] = ".json_encode($paycard).";"; } add_storefrontjs(join("",$js), true); return $output; break; case "billing-cardholder": if ($options['mode'] == "value") return $this->Billing->cardholder; $options['class'] = isset($options['class']) ? $options['class'].' paycard':'paycard'; if (!isset($options['autocomplete'])) $options['autocomplete'] = "off"; if (!empty($this->Billing->cardholder)) $options['value'] = $this->Billing->cardholder; return '<input type="text" name="billing[cardholder]" id="billing-cardholder" '.inputattrs($options).' />'; break; case "billing-cvv": if (!isset($options['autocomplete'])) $options['autocomplete'] = "off"; if (!empty($_POST['billing']['cvv'])) $options['value'] = $_POST['billing']['cvv']; $options['class'] = isset($options['class']) ? $options['class'].' paycard':'paycard'; return '<input type="text" name="billing[cvv]" id="billing-cvv" '.inputattrs($options).' />'; break; case "billing-xcsc-required": $Gateways = $Ecart->Gateways->active; foreach ($Gateways as $Gateway) { foreach ((array)$Gateway->settings['cards'] as $card) { $PayCard = Lookup::paycard($card); if (!empty($PayCard->inputs)) return true; } } return false; break; case "billing-xcsc": if (empty($options['input'])) return; $input = $options['input']; $cards = array(); $valid = array(); // Collect valid card inputs for all gateways foreach ($this->payoptions as $payoption) { foreach ($payoption->cards as $card) { $PayCard = Lookup::paycard($card); if (empty($PayCard->inputs)) continue; $cards[] = $PayCard->symbol; foreach ($PayCard->inputs as $field => $size) $valid[$field] = $size; } } if (!array_key_exists($input,$valid)) return; if (!empty($_POST['billing']['xcsc'][$input])) $options['value'] = $_POST['billing']['xcsc'][$input]; $options['class'] = isset($options['class']) ? $options['class'].' paycard xcsc':'paycard xcsc'; if (!isset($options['autocomplete'])) $options['autocomplete'] = "off"; $string = '<input type="text" name="billing[xcsc]['.$input.']" id="billing-xcsc-'.$input.'" '.inputattrs($options).' />'; return $string; break; case "billing-xco": return; break; // DEPRECATED case "billing-localities": $rates = $Ecart->Settings->get("taxrates"); foreach ((array)$rates as $rate) if (isset($rate['locals']) && is_array($rate['locals'])) return true; return false; break; case "billing-locale": if ($options['mode'] == "value") return $this->Billing->locale; if (!isset($options['selected'])) $options['selected'] = false; if (!empty($this->Billing->locale)) { $options['selected'] = $this->Billing->locale; $options['value'] = $this->Billing->locale; } if (empty($options['type'])) $options['type'] = "menu"; $output = false; $rates = $Ecart->Settings->get("taxrates"); foreach ($rates as $rate) if (is_array($rate['locals'])) $locales[$rate['country'].$rate['zone']] = array_keys($rate['locals']); add_storefrontjs('var locales = '.json_encode($locales).';',true); $Taxes = new CartTax(); $rate = $Taxes->rate(false,true); $localities = array_keys($rate['locals']); $label = (!empty($options['label']))?$options['label']:''; $output = '<select name="billing[locale]" id="billing-locale" '.inputattrs($options,$select_attrs).'>'; $output .= menuoptions($localities,$options['selected']); $output .= '</select>'; return $output; break; case "has-data": case "hasdata": return (is_array($this->data) && count($this->data) > 0); break; case "order-data": case "orderdata": $defaults = array( 'name' => false, // REQUIRED 'data' => false, 'mode' => false, 'title' => '', 'type' => 'hidden', 'value' => '', 'cols' => '30', 'rows' => '3', 'options' => '' ); $op = array_merge($defaults,$options); extract($op); // Allowed input types $allowed_types = array("text","hidden","password","checkbox","radio","textarea","menu"); // Input types that can override option-specified value with the loaded data value $value_override = array("text","hidden","password","textarea","menu"); /// Allowable attributes for textarea inputs $textarea_attrs = array('accesskey','title','tabindex','class','disabled','required'); if (!$name) { // Iterator for order data if (!isset($this->_data_loop)) { reset($this->data); $this->_data_loop = true; } else next($this->data); if (current($this->data) !== false) return true; else { unset($this->_data_loop); return false; } } if (isset($this->data[$name])) $data = $this->data[$name]; if ($name && $mode == "value") return $data; if (!in_array($type,$allowed_types)) $type = 'hidden'; if (empty($title)) $title = $name; $id = 'order-data-'.sanitize_title_with_dashes($name); if (in_array($type,$value_override) && !empty($data)) $value = $data; switch (strtolower($type)) { case "textarea": return '<textarea name="data['.$name.']" cols="'.$cols.'" rows="'.$rows.'" id="'.$id.'" '.inputattrs($op,$textarea_attrs).'>'.$value.'</textarea>'; break; case "menu": if (is_string($options)) $options = explode(',',$options); return '<select name="data['.$name.']" id="'.$id.'" '.inputattrs($op,$select_attrs).'>'.menuoptions($options,$value).'</select>'; break; default: return '<input type="'.$type.'" name="data['.$name.']" id="'.$id.'" '.inputattrs($op).' />'; break; } break; case "data": if (!is_array($this->data)) return false; $data = current($this->data); $name = key($this->data); if (isset($options['name'])) return $name; return $data; break; case "submit": if (!isset($options['value'])) $options['value'] = __('Submit Order','Ecart'); $options['class'] = isset($options['class'])?$options['class'].' checkout-button':'checkout-button'; $wrapclass = ''; if (isset($options['wrapclass'])) $wrapclass = ' '.$options['wrapclass']; $buttons = array('<input type="submit" name="process" id="checkout-button" '.inputattrs($options,$submit_attrs).' />'); if (!$this->Cart->orderisfree()) $buttons = apply_filters('ecart_checkout_submit_button',$buttons,$options,$submit_attrs); $_ = array(); foreach ($buttons as $label => $button) $_[] = '<span class="payoption-button payoption-'.sanitize_title_with_dashes($label).($label === 0?$wrapclass:'').'">'.$button.'</span>'; return join("\n",$_); break; case "confirm-button": if (empty($options['errorlabel'])) $options['errorlabel'] = __('Return to Checkout','Ecart'); if (empty($options['value'])) $options['value'] = __('Confirm Order','Ecart'); $button = '<input type="submit" name="confirmed" id="confirm-button" '.inputattrs($options,$submit_attrs).' />'; $return = '<a href="'.ecarturl(false,'checkout',$this->security()).'"'.inputattrs($options,array('class')).'>'. $options['errorlabel'].'</a>'; if (!$this->validated) $markup = $return; else $markup = $button; return apply_filters('ecart_checkout_confirm_button',$markup,$options,$submit_attrs); break; case "local-payment": return true; break; // DEPRECATED case "xco-buttons": return; break; // DEPRECATED case "payoptions": case "payment-options": case "paymentoptions": if ($this->Cart->orderisfree()) return false; $payment_methods = apply_filters('ecart_payment_methods',count($this->payoptions)); if ($payment_methods <= 1) return false; // Skip if only one gateway is active $defaults = array( 'default' => false, 'exclude' => false, 'type' => 'menu', 'mode' => false ); $options = array_merge($defaults,$options); extract($options); unset($options['type']); if ("loop" == $mode) { if (!isset($this->_pay_loop)) { reset($this->payoptions); $this->_pay_loop = true; } else next($this->payoptions); if (current($this->payoptions) !== false) return true; else { unset($this->_pay_loop); return false; } return true; } $excludes = array_map('sanitize_title_with_dashes',explode(",",$exclude)); $payoptions = array_keys($this->payoptions); $payoptions = array_diff($payoptions,$excludes); $paymethod = current($payoptions); if ($default !== false && !isset($this->_paymethod_selected)) { $default = sanitize_title_with_dashes($default); if (in_array($default,$payoptions)) $paymethod = $default; } if ($this->paymethod != $paymethod) { $this->paymethod = $paymethod; $processor = $this->payoptions[$this->paymethod]->processor; if (!empty($processor)) $this->processor($processor); } $output = ''; switch ($type) { case "list": $output .= '<span><ul>'; foreach ($payoptions as $value) { if (in_array($value,$excludes)) continue; $payoption = $this->payoptions[$value]; $options['value'] = $value; $options['checked'] = ($this->paymethod == $value)?'checked':false; if ($options['checked'] === false) unset($options['checked']); $output .= '<li><label><input type="radio" name="paymethod" '.inputattrs($options).' /> '.$payoption->label.'</label></li>'; } $output .= '</ul></span>'; break; case "hidden": if (!isset($options['value']) && $default) $options['value'] = $this->paymethod; $output .= '<input type="hidden" name="paymethod"'.inputattrs($options).' />'; break; default: $output .= '<select name="paymethod" '.inputattrs($options,$select_attrs).'>'; foreach ($payoptions as $value) { if (in_array($value,$excludes)) continue; $payoption = $this->payoptions[$value]; $selected = ($this->paymethod == $value)?' selected="selected"':''; $output .= '<option value="'.$value.'"'.$selected.'>'.$payoption->label.'</option>'; } $output .= '</select>'; break; } return $output; break; case "payoption": case "payment-option": case "paymentoption": $payoption = current($this->payoptions); $defaults = array( 'labelpos' => 'after', 'labeling' => false, 'type' => 'hidden', ); $options = array_merge($defaults,$options); extract($options); if (value_is_true($return)) return $payoption; $types = array('radio','checkbox','hidden'); if (!in_array($type,$types)) $type = 'hidden'; if (empty($options['value'])) $options['value'] = key($this->payoptions); $_ = array(); if (value_is_true($labeling)) $_[] = '<label>'; if ($labelpos == "before") $_[] = $payoption->label; $_[] = '<input type="'.$type.'" name="paymethod"'.inputattrs($options).' />'; if ($labelpos == "after") $_[] = $payoption->label; if (value_is_true($labeling)) $_[] = '</label>'; return join("",$_); break; case "gatewayinputs": case "gateway-inputs": return apply_filters('ecart_checkout_gateway_inputs',false); break; case "completed": if (empty($Ecart->Purchase->id) && $this->purchase !== false) { $Ecart->Purchase = new Purchase($this->purchase); $Ecart->Purchase->load_purchased(); return (!empty($Ecart->Purchase->id)); } return false; break; case "receipt": if (!empty($Ecart->Purchase->id)) return $Ecart->Purchase->receipt(); break; } }
<?php _e('Enable this to make Ecart behaviors available across all of your WordPress posts and pages.','Ecart'); ?></div> <!-- admin logger under construction --> <label for="error-notifications"><?php _e('Error Notifications','Ecart'); ?></label> <ul id="error_notify"> <?php foreach ($notification_errors as $id => $level): ?> <li><input type="checkbox" name="settings[error_notifications][]" id="error-notification-<?php echo $id; ?>" value="<?php echo $id; ?>"<?php if (in_array($id,$notifications)) echo ' checked="checked"'; ?>/><label for="error-notification-<?php echo $id; ?>"> <?php echo $level; ?></label></li> <?php endforeach; ?> </ul> <label for="error-notifications"><?php _e("Send email notifications of the selected errors to the merchant's email address.","Ecart"); ?></label> <label for="error-logging"><?php _e('Error Logging','Ecart'); ?></label> <select name="settings[error_logging]" id="error-logging"> <?php echo menuoptions($errorlog_levels,$this->Settings->get('error_logging'),true); ?> </select><br /> <label for="error-notifications"><?php _e("Limit logging errors up to the level of the selected error type.","Ecart"); ?></label> <?php if (count($recentlog) > 0): ?> <label for="error-logging"><?php _e('Error Log','Ecart'); ?></label> <div id="errorlog"><ol><?php foreach ($recentlog as $line): ?> <li><?php echo esc_html($line); ?></li> <?php endforeach; ?></ol></div> <p class="alignright"><button name="resetlog" id="resetlog" value="resetlog" class="button"><small><?php _e("Reset Log","Ecart"); ?></small></button></p> <?php endif; ?>
/** * Provides ecart('cart') template api functionality * * @since 1.0 * * @return mixed **/ function tag ($property,$options=array()) { global $Ecart; $submit_attrs = array('title','value','disabled','tabindex','accesskey','class'); // Return strings with no options switch ($property) { case "url": return ecarturl(false,'cart'); break; case "referrer": case "referer": $referrer = $Ecart->Shopping->data->referrer; if (!$referrer) $referrer = ecart('catalog','url','return=1'); return $referrer; break; case "hasitems": case "has-items": return (count($this->contents) > 0); break; case "totalitems": case "total-items": return $this->Totals->quantity; break; case "items": if (!isset($this->_item_loop)) { reset($this->contents); $this->_item_loop = true; } else next($this->contents); if (current($this->contents)) return true; else { unset($this->_item_loop); reset($this->contents); return false; } break; case "hasshipped": case "has-shipped": return $this->shipped(); break; case "shippeditems": case "shipped-items": if (!isset($this->_shipped_loop)) { reset($this->shipped); $this->_shipped_loop = true; } else next($this->shipped); if (current($this->shipped)) return true; else { unset($this->_shipped_loop); reset($this->shipped); return false; } break; case "hasdownloads": case "has-downloads": return $this->downloads(); break; case "downloaditems": case "download-items": if (!isset($this->_downloads_loop)) { reset($this->downloads); $this->_downloads_loop = true; } else next($this->downloads); if (current($this->downloads)) return true; else { unset($this->_downloads_loop); reset($this->downloads); return false; } break; case "lastitem": case "last-item": return $this->contents[$this->added]; break; case "totalpromos": case "total-promos": return count($this->discounts); break; case "haspromos": case "has-promos": return (count($this->discounts) > 0); break; case "discounts": case "promos": if (!isset($this->_promo_looping)) { reset($this->discounts); $this->_promo_looping = true; } else next($this->discounts); $discount = current($this->discounts); while ($discount && empty($discount->applied) && !$discount->freeshipping) $discount = next($this->discounts); if (current($this->discounts)) return true; else { unset($this->_promo_looping); reset($this->discounts); return false; } case "promoname": case "promo-name": $discount = current($this->discounts); if ($discount->applied == 0 && empty($discount->items) && !isset($this->freeshipping)) return false; return $discount->name; break; case "promodiscount": case "promo-discount": $discount = current($this->discounts); if ($discount->applied == 0 && empty($discount->items) && !isset($this->freeshipping)) return false; if (!isset($options['label'])) $options['label'] = ' '.__('Off!','Ecart'); else $options['label'] = ' '.$options['label']; $string = false; if (!empty($options['before'])) $string = $options['before']; switch($discount->type) { case "Free Shipping": $string .= money($discount->freeshipping).$options['label']; break; case "Percentage Off": $string .= percentage($discount->discount,array('precision' => 0)).$options['label']; break; case "Amount Off": $string .= money($discount->discount).$options['label']; break; case "Buy X Get Y Free": return sprintf(__('Buy %s get %s free','Ecart'),$discount->buyqty,$discount->getqty); break; } if (!empty($options['after'])) $string .= $options['after']; return $string; break; case "function": $result = '<div class="hidden"><input type="hidden" id="cart-action" name="cart" value="true" /></div><input type="submit" name="update" id="hidden-update" />'; $Errors = &EcartErrors(); if (!$Errors->exist(ECART_STOCK_ERR)) return $result; ob_start(); include(ECART_TEMPLATES."/errors.php"); $errors = ob_get_contents(); ob_end_clean(); return $result.$errors; break; case "emptybutton": case "empty-button": if (!isset($options['value'])) $options['value'] = __('Empty Cart','Ecart'); return '<input type="submit" name="empty" id="empty-button" '.inputattrs($options,$submit_attrs).' />'; break; case "updatebutton": case "update-button": if (!isset($options['value'])) $options['value'] = __('Update Subtotal','Ecart'); if (isset($options['class'])) $options['class'] .= " update-button"; else $options['class'] = "update-button"; return '<input type="submit" name="update"'.inputattrs($options,$submit_attrs).' />'; break; case "sidecart": ob_start(); include(ECART_TEMPLATES."/sidecart.php"); $content = ob_get_contents(); ob_end_clean(); return $content; break; case "hasdiscount": case "has-discount": return ($this->Totals->discount > 0); break; case "discount": return money($this->Totals->discount); break; } $result = ""; switch ($property) { case "promos-available": if (!$Ecart->Promotions->available()) return false; // Skip if the promo limit has been reached if ($Ecart->Settings->get('promo_limit') > 0 && count($this->discounts) >= $Ecart->Settings->get('promo_limit')) return false; return true; break; case "promo-code": // Skip if no promotions exist if (!$Ecart->Promotions->available()) return false; // Skip if the promo limit has been reached if ($Ecart->Settings->get('promo_limit') > 0 && count($this->discounts) >= $Ecart->Settings->get('promo_limit')) return false; if (!isset($options['value'])) $options['value'] = __("Apply Promo Code","Ecart"); $result = '<ul><li>'; if ($Ecart->Errors->exist()) { $result .= '<p class="error">'; $errors = $Ecart->Errors->source('CartDiscounts'); foreach ((array)$errors as $error) if (!empty($error)) $result .= $error->message(true,false); $result .= '</p>'; } $result .= '<span><input type="text" id="promocode" name="promocode" value="" size="10" /></span>'; $result .= '<span><input type="submit" id="apply-code" name="update" '.inputattrs($options,$submit_attrs).' /></span>'; $result .= '</li></ul>'; return $result; case "has-shipping-methods": return apply_filters( 'ecart_shipping_hasestimates', (!empty($this->shipping) && !$this->noshipping), $this->shipping ); break; case "needs-shipped": return (!empty($this->shipped)); break; case "hasshipcosts": case "has-shipcosts": case "hasship-costs": case "has-ship-costs": return ($this->Totals->shipping > 0); break; case "needs-shipping-estimates": $markets = $Ecart->Settings->get('target_markets'); return (!empty($this->shipped) && !$this->noshipping && ($this->showpostcode || count($markets) > 1)); break; case "shipping-estimates": if (empty($this->shipped)) return ""; $base = $Ecart->Settings->get('base_operations'); $markets = $Ecart->Settings->get('target_markets'); $Shipping = &$Ecart->Order->Shipping; if (empty($markets)) return ""; foreach ($markets as $iso => $country) $countries[$iso] = $country; if (!empty($Shipping->country)) $selected = $Shipping->country; else $selected = $base['country']; $result .= '<ul><li>'; if ((isset($options['postcode']) && value_is_true($options['postcode'])) || $this->showpostcode) { $result .= '<span>'; $result .= '<input type="text" name="shipping[postcode]" id="shipping-postcode" size="6" value="'.$Shipping->postcode.'" /> '; $result .= '</span>'; } if (count($countries) > 1) { $result .= '<span>'; $result .= '<select name="shipping[country]" id="shipping-country">'; $result .= menuoptions($countries,$selected,true); $result .= '</select>'; $result .= '</span>'; } else $result .= '<input type="hidden" name="shipping[country]" id="shipping-country" value="'.key($markets).'" />'; $result .= '<br class="clear" /></li></ul>'; return $result; break; } $result = ""; switch ($property) { case "subtotal": $result = $this->Totals->subtotal; break; case "shipping": if (empty($this->shipped)) return ""; if (isset($options['label'])) { $options['currency'] = "false"; if ($this->freeshipping) { $result = $Ecart->Settings->get('free_shipping_text'); if (empty($result)) $result = __('Free Shipping!','Ecart'); } else $result = $options['label']; } else { if ($this->Totals->shipping === null) return __("Enter Postal Code","Ecart"); elseif ($this->Totals->shipping === false) return __("Not Available","Ecart"); else $result = $this->Totals->shipping; } break; case "hastaxes": case "has-taxes": return ($this->Totals->tax > 0); break; case "tax": if ($this->Totals->tax > 0) { if (isset($options['label'])) { $options['currency'] = "false"; $result = $options['label']; } else $result = $this->Totals->tax; } else $options['currency'] = "false"; break; case "total": $result = $this->Totals->total; break; } if (isset($options['currency']) && !value_is_true($options['currency'])) return $result; if (is_numeric($result)) return '<span class="ecart_cart_'.$property.'">'.money($result).'</span>'; return false; }
<div class="context"></div> <p><?php _e('Set the digital products download limit per product for your store.','Ecart'); ?></p> </div> <div class="clear"></div> </div> <!-- these settings are hidden - still under development please do not enable --> <table class="form-table" class="notavailable" style="display:none !important;"> <tr> <th scope="row" valign="top"><label for="download-timelimit"><?php _e('Time Limit','Ecart'); ?></label></th> <td><select name="settings[download_timelimit]" id="download-timelimit"> <option value=""><?php _e('No Limit','Ecart'); ?></option> <?php echo menuoptions($time,$this->Settings->get('download_timelimit'),true); ?> </select> </td> </tr> <tr> <th scope="row" valign="top"><label for="download-restriction"><?php _e('IP Restriction','Ecart'); ?></label></th> <td><input type="hidden" name="settings[download_restriction]" value="off" /> <label for="download-restriction"><input type="checkbox" name="settings[download_restriction]" id="download-restriction" value="ip" <?php echo ($this->Settings->get('download_restriction') == "ip")?'checked="checked" ':'';?> /> <?php _e('Restrict to the computer the product is purchased from','Ecart'); ?></label></td> </tr> </table> </form> </div> <script type="text/javascript"> /* <![CDATA[ */
/** * Provides a custom text field for collecting any number of custom order fields * * @api `shopp('checkout.order-data')` * @since 1.0 * * @param string $result The output * @param array $options The options * - **name**: **REQUIRED** The name of the customer info field * - **mode**: `input` (input, value) Provide the `input` markup or the current `value` of the `name` field * - **type**: `hidden` (textarea, menu, hidden, radio, checkbox, button, submit) The type of input markup to generate * - **options**: Comma-separated option values * - **autocomplete**: (on, off) Specifies whether an `<input>` element should have autocomplete enabled * - **accesskey**: Specifies a shortcut key to activate/focus an element. Linux/Windows: `[Alt]`+`accesskey`, Mac: `[Ctrl]``[Opt]`+`accesskey` * - **alt**: Specifies an alternate text for images (only for type="image") * - **checked**: Specifies that an `<input>` element should be pre-selected when the page loads (for type="checkbox" or type="radio") * - **class**: The class attribute specifies one or more class-names for an element * - **disabled**: Specifies that an `<input>` element should be disabled * - **format**: Specifies special field formatting class names for JS validation * - **minlength**: Sets a minimum length for the field enforced by JS validation * - **maxlength**: Specifies the maximum number of characters allowed in an `<input>` element * - **placeholder**: Specifies a short hint that describes the expected value of an `<input>` element * - **readonly**: Specifies that an input field is read-only * - **required**: Adds a class that specified an input field must be filled out before submitting the form, enforced by JS * - **size**: Specifies the width, in characters, of an `<input>` element * - **src**: Specifies the URL of the image to use as a submit button (only for type="image") * - **tabindex**: Specifies the tabbing order of an element * - **cols**: Specifies the visible width of a `<textarea>` * - **rows**: Specifies the visible number of lines in a `<textarea>` * - **title**: Specifies extra information about an element * - **value**: Specifies the value of an `<input>` element * @param ShoppOrder $O The working object * @return string The custom order data field markup **/ public static function order_data($result, $options, $O) { $select_attrs = array('title', 'class', 'disabled', 'required', 'size', 'tabindex', 'accesskey'); $defaults = array('name' => false, 'data' => false, 'mode' => false, 'title' => '', 'type' => 'hidden', 'value' => '', 'options' => ''); if (isset($options['name']) && array_key_exists($options['name'], ShoppOrder()->data)) { $defaults['value'] = ShoppOrder()->data[$options['name']]; } if (isset($options['type']) && 'textarea' == $options['type']) { $defaults['cols'] = '30'; $defaults['rows'] = '3'; } $op = array_merge($defaults, $options); extract($op); // Allowed input types $allowed_types = array("text", "hidden", "password", "checkbox", "radio", "textarea", "menu"); // Input types that can override option-specified value with the loaded data value $value_override = array("text", "hidden", "password", "textarea", "menu"); /// Allowable attributes for textarea inputs $textarea_attrs = array('accesskey', 'title', 'tabindex', 'class', 'disabled', 'required', 'maxlength'); if (!$name) { // Iterator for order data if (!isset($O->_data_loop)) { reset($O->data); $O->_data_loop = true; } else { next($O->data); } if (current($O->data) !== false) { return true; } else { unset($O->_data_loop); return false; } } if (isset($O->data[$name])) { $data = $O->data[$name]; } if ($name && $mode == "value") { return apply_filters('shopp_checkout_order_data', $data); } if (!in_array($type, $allowed_types)) { $type = 'hidden'; } if (empty($title)) { $title = $name; } $id = 'order-data-' . sanitize_title_with_dashes($name); if (in_array($type, $value_override) && !empty($data)) { $op['value'] = $value = $data; } switch (strtolower($type)) { case "textarea": return '<textarea name="data[' . $name . ']" cols="' . $cols . '" rows="' . $rows . '" id="' . $id . '" ' . inputattrs($op, $textarea_attrs) . '>' . $value . '</textarea>'; break; case "menu": $menuvalues = true; if (is_string($options)) { $menuvalues = false; $options = explode(',', $options); } return '<select name="data[' . $name . ']" id="' . $id . '" ' . inputattrs($op, $select_attrs) . '>' . menuoptions($options, $value, $menuvalues) . '</select>'; break; default: return '<input type="' . $type . '" name="data[' . $name . ']" id="' . $id . '" ' . inputattrs($op) . ' />'; break; } }
function form($options) { ?> <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title'); ?></label> <input type="text" name="<?php echo $this->get_field_name('title'); ?>" id="<?php echo $this->get_field_id('title'); ?>" class="widefat" value="<?php echo $options['title']; ?>"></p> <p><select id="<?php echo $this->get_field_id('source'); ?>" name="<?php echo $this->get_field_name('source'); ?>" class="widefat"><option value="category"<?php echo $options['source'] == "category"?' selected="selected"':''; ?>><?php _e('From a category','Ecart'); ?></option><option value="product"<?php echo $options['source'] == "product"?' selected="selected"':''; ?>><?php _e('By product','Ecart'); ?></option></select></p> <?php if (ECART_PRETTYURLS) $label = __('Category Slug/ID','Ecart'); else $label = __('Category ID','Ecart'); ?> <p id="<?php echo $this->get_field_id('category-fields'); ?>" class="hidden"> <label for="<?php echo $this->get_field_id('category'); ?>"><?php echo $label; ?></label> <input type="text" name="<?php echo $this->get_field_name('category'); ?>" id="<?php echo $this->get_field_id('category'); ?>" class="widefat" value="<?php echo $options['category']; ?>"> <br /><br /> <select id="<?php echo $this->get_field_id('limit'); ?>" name="<?php echo $this->get_field_name('limit'); ?>"> <?php $limits = array(1,2,3,4,5,6,7,8,9,10,15,20,25); echo menuoptions($limits,$options['limit']); ?> </select> <select id="<?php echo $this->get_field_id('order'); ?>" name="<?php echo $this->get_field_name('order'); ?>"> <?php $sortoptions = array( "bestselling" => __('Bestselling','Ecart'), "highprice" => __('Highest Price','Ecart'), "lowprice" => __('Lowest Price','Ecart'), "newest" => __('Newest','Ecart'), "oldest" => __('Oldest','Ecart'), "random" => __('Random','Ecart') ); echo menuoptions($sortoptions,$options['order'],true); ?> </select> <label for="<?php echo $this->get_field_id('order'); ?>"><?php _e('products','Ecart'); ?></label> </p> <?php if (ECART_PRETTYURLS) $label = __('Product Slug/ID(s)','Ecart'); else $label = __('Product ID(s)','Ecart'); ?> <p id="<?php echo $this->get_field_id('product-fields'); ?>" class="hidden"> <label for="<?php echo $this->get_field_id('product'); ?>"><?php echo $label; ?></label> <input type="text" name="<?php echo $this->get_field_name('product'); ?>" id="<?php echo $this->get_field_id('product'); ?>" class="widefat" value="<?php echo $options['product']; ?>"> <small><?php _e('Use commas to specify multiple products','Ecart')?></small></p> <script type="text/javascript"> (function($) { $(window).ready(function () { var categoryui = $('#<?php echo $this->get_field_id("category-fields"); ?>'); var productui = $('#<?php echo $this->get_field_id("product-fields"); ?>'); $('#<?php echo $this->get_field_id("source"); ?>').change(function () { if ($(this).val() == "category") { productui.hide(); categoryui.show(); } if ($(this).val() == "product") { categoryui.hide(); productui.show(); } }).change(); }); })(jQuery) </script> <?php }
/** * Loads all categories for the product list manager category filter menu * * @author Jonathan Davis * @return string HTML for a drop-down menu of categories **/ public function category($id) { global $wpdb; $p = "{$wpdb->posts} AS p"; $where = array(); $joins[$wpdb->term_relationships] = "INNER JOIN {$wpdb->term_relationships} AS tr ON (p.ID=tr.object_id)"; $joins[$wpdb->term_taxonomy] = "INNER JOIN {$wpdb->term_taxonomy} AS tt ON (tr.term_taxonomy_id=tt.term_taxonomy_id AND tt.term_id={$id})"; if (-1 == $id) { $joins[$wpdb->term_relationships] = "LEFT JOIN {$wpdb->term_relationships} AS tr ON (p.ID=tr.object_id)"; unset($joins[$wpdb->term_taxonomy]); $where[] = 'tr.object_id IS NULL'; $where[] = "p.post_status='publish'"; $where[] = "p.post_type='shopp_product'"; } $where = empty($where) ? '' : ' WHERE ' . join(' AND ', $where); if ('catalog-products' == $id) { $products = sDB::query("SELECT p.id,p.post_title AS name FROM {$p} {$where} ORDER BY name ASC", 'array', 'col', 'name', 'id'); } else { $products = sDB::query("SELECT p.id,p.post_title AS name FROM {$p} " . join(' ', $joins) . $where . " ORDER BY name ASC", 'array', 'col', 'name', 'id'); } return menuoptions($products, 0, true); }
<div class="optionrow fix"> <div class="optiontitle fix"> <strong><label for="weight-unit"><?php _e('Product Dimension Unit','Ecart'); ?></label></strong><br> </div> <div class="theinputs"> <div class="optioninputs"> <br/> <select name="settings[dimension_unit]" id="dimension-unit"> <option value="">Please select an option »</option> <?php if ($base['units'] == "imperial") $units = array("in" => __("inches (in)","Ecart"),"ft" => __("feet (ft)","Ecart")); else $units = array("cm"=>__("centimeters (cm)","Ecart"),"m"=>__("meters (m)","Ecart")); echo menuoptions($units,$this->Settings->get('dimension_unit'),true); ?> </select><br /> <br> <br> </div> </div> <div class="theexplanation"> <div class="context"></div> <p><?php _e('Please select your dimension unit, this will be used for shipping products','Ecart'); ?></p> </div> <div class="clear"></div> </div>
function rules_meta_box($Promotion) { $scopes = array('Catalog' => __('Catalog', 'Shopp'), 'Order' => __('Order', 'Shopp')); $scope = '<select name="scope" id="promotion-scope" class="small">'; $scope .= menuoptions($scopes, $Promotion->scope, true); $scope .= '</select>'; if (empty($Promotion->search)) { $Promotion->search = "all"; } $logic = '<select name="search" class="small">'; $logic .= menuoptions(array('any' => __('any', 'Shopp'), 'all' => __('all', 'Shopp')), $Promotion->search, true); $logic .= '</select>'; ?> <p><strong><?php printf(__('Apply discount to %s products where %s of these conditions are met', 'Shopp'), $scope, $logic); ?> :</strong></p> <table class="form-table" id="rules"></table> <?php }
public function screen() { $shipcarriers = Lookup::shipcarriers(); $serviceareas = array('*', ShoppBaseLocale()->code()); foreach ($shipcarriers as $c => $record) { if (!in_array($record->areas, $serviceareas)) { continue; } $carriers[$c] = $record->name; } unset($shipcarriers); $shipping_carriers = shopp_setting('shipping_carriers'); if (empty($shipping_carriers)) { $shipping_carriers = array_keys($carriers); } $imperial = 'imperial' == ShoppBaseLocale()->units(); $weights = $imperial ? array('oz' => Shopp::__('ounces (oz)'), 'lb' => Shopp::__('pounds (lbs)')) : array('g' => Shopp::__('gram (g)'), 'kg' => Shopp::__('kilogram (kg)')); $weightsmenu = menuoptions($weights, shopp_setting('weight_unit'), true); $dimensions = $imperial ? array('in' => Shopp::__('inches (in)'), 'ft' => Shopp::__('feet (ft)')) : array('cm' => Shopp::__('centimeters (cm)'), 'm' => Shopp::__('meters (m)')); $dimsmenu = menuoptions($dimensions, shopp_setting('dimension_unit'), true); $rates = shopp_setting('shipping_rates'); if (!empty($rates)) { ksort($rates); } $Shopp = Shopp::object(); $Shipping = $Shopp->Shipping; $Shipping->settings(); // Load all installed shipping modules for settings UIs $methods = $Shopp->Shipping->methods; $edit = false; if (isset($_REQUEST['id'])) { $edit = (int) $_REQUEST['id']; } $active = shopp_setting('active_shipping'); if (!$active) { $active = array(); } if (isset($_POST['module'])) { $setting = false; $module = isset($_POST['module']) ? $_POST['module'] : false; $id = isset($_POST['id']) ? $_POST['id'] : false; if ($id == $module) { if (isset($_POST['settings'])) { shopp_set_formsettings(); } /** Save shipping service settings **/ $active[$module] = true; shopp_set_setting('active_shipping', $active); $updated = __('Shipping settings saved.', 'Shopp'); // Cancel editing if saving if (isset($_POST['save'])) { unset($_REQUEST['id']); } $Errors = ShoppErrors(); do_action('shopp_verify_shipping_services'); if ($Errors->exist()) { // Get all addon related errors $failures = $Errors->level(SHOPP_ADDON_ERR); if (!empty($failures)) { $updated = __('Shipping settings saved but there were errors: ', 'Shopp'); foreach ($failures as $error) { $updated .= '<p>' . $error->message(true, true) . '</p>'; } } } } else { /** Save shipping calculator settings **/ $setting = $_POST['id']; if (empty($setting)) { // Determine next available setting ID $index = 0; if (is_array($active[$module])) { $index = count($active[$module]); } $setting = "{$module}-{$index}"; } // Cancel editing if saving if (isset($_POST['save'])) { unset($_REQUEST['id']); } $setting_module = $setting; $id = 0; if (false !== strpos($setting, '-')) { list($setting_module, $id) = explode('-', $setting); } // Prevent fishy stuff from happening if ($module != $setting_module) { $module = false; } // Save shipping calculator settings $Shipper = $Shipping->get($module); if ($Shipper && isset($_POST[$module])) { $Shipper->setting($id); $_POST[$module]['label'] = stripslashes($_POST[$module]['label']); // Sterilize $values foreach ($_POST[$module]['table'] as $i => &$row) { if (isset($row['rate'])) { $row['rate'] = Shopp::floatval($row['rate']); } if (!isset($row['tiers'])) { continue; } foreach ($row['tiers'] as &$tier) { if (isset($tier['rate'])) { $tier['rate'] = Shopp::floatval($tier['rate']); } } } // Delivery estimates: ensure max equals or exceeds min ShippingFramework::sensibleestimates($_POST[$module]['mindelivery'], $_POST[$module]['maxdelivery']); shopp_set_setting($Shipper->setting, $_POST[$module]); if (!array_key_exists($module, $active)) { $active[$module] = array(); } $active[$module][(int) $id] = true; shopp_set_setting('active_shipping', $active); $this->notice(Shopp::__('Shipping settings saved.')); } } } $postcodes = ShoppLookup::postcodes(); foreach ($postcodes as &$postcode) { $postcode = !empty($postcode); } $lookup = array('regions' => array_merge(array('*' => Shopp::__('Anywhere')), ShoppLookup::regions()), 'regionmap' => ShoppLookup::regions('id'), 'countries' => ShoppLookup::countries(), 'areas' => ShoppLookup::country_areas(), 'zones' => ShoppLookup::country_zones(), 'postcodes' => $postcodes); $ShippingTemplates = new TemplateShippingUI(); add_action('shopp_shipping_module_settings', array($Shipping, 'templates')); $Table = $this->table; $Table->prepare_items(); include $this->ui('shipping.php'); }
/** * Renders the order stats widget * * @author Jonathan Davis * @since 1.0 * * @return void **/ public static function stats_widget($args = false) { $ranges = array('today' => __('Today', 'Shopp'), 'week' => __('This Week', 'Shopp'), 'month' => __('This Month', 'Shopp'), 'quarter' => __('This Quarter', 'Shopp'), 'year' => __('This Year', 'Shopp'), 'yesterday' => __('Yesterday', 'Shopp'), 'lastweek' => __('Last Week', 'Shopp'), 'last30' => __('Last 30 Days', 'Shopp'), 'last90' => __('Last 3 Months', 'Shopp'), 'lastmonth' => __('Last Month', 'Shopp'), 'lastquarter' => __('Last Quarter', 'Shopp'), 'lastyear' => __('Last Year', 'Shopp')); $defaults = array('before_widget' => '', 'before_title' => '', 'widget_name' => '', 'after_title' => '', 'after_widget' => '', 'range' => isset($_GET['shopp-stats-range']) ? $_GET['shopp-stats-range'] : ''); $args = array_merge($defaults, (array) $args); extract($args, EXTR_SKIP); if (!$range || !isset($ranges[strtolower($range)])) { $range = 'last30'; } $purchasetable = ShoppDatabaseObject::tablename(ShoppPurchase::$table); $now = current_time('timestamp'); // $offset = get_option( 'gmt_offset' ) * 3600; $daytimes = 86400; $day = date('j', $now); $month = date('n', $now); $year = date('Y', $now); $end = $now; list($weekstart, $weekend) = array_values(get_weekstartend(current_time('mysql'))); switch ($range) { case 'today': $start = mktime(0, 0, 0, $month, $day, $year); break; case 'week': $start = $weekstart; $end = $weekend; break; case 'month': $start = mktime(0, 0, 0, $month, 1, $year); break; case 'quarter': $start = mktime(0, 0, 0, $month - (3 - $month % 3), 1, $year); break; case 'year': $start = mktime(0, 0, 0, 1, 1, $year); break; case 'yesterday': $start = mktime(0, 0, 0, $month, $day - 1, $year); $end = mktime(23, 59, 59, $month, $day - 1, $year); break; case 'lastweek': $start = $weekstart - 7 * $daytimes; $end = $weekstart - 1; break; case 'last7': $start = $now - 7 * $daytimes; break; case 'last30': $start = $now - 30 * $daytimes; break; case 'last90': $start = $now - 90 * $daytimes; break; case 'lastmonth': $start = mktime(0, 0, 0, $month - 1, 1, $year); $end = mktime(0, 0, 0, $month, 0, $year); break; case 'lastquarter': $start = mktime(0, 0, 0, $month - (3 - $month % 3) - 3, 1, $year); $end = mktime(23, 59, 59, date('n', $start) + 3, 0, $year); break; case 'lastyear': $start = mktime(0, 0, 0, $month, 1, $year - 1); $end = mktime(23, 59, 59, 1, 0, $year); break; } // Include authorizations, captures and old 1.1 tranaction status CHARGED in sales data $salestatus = array("'authed'", "'captured'", "'CHARGED'"); $txnstatus = "txnstatus IN (" . join(',', $salestatus) . ")"; $daterange = "created BETWEEN '" . sDB::mkdatetime($start) . "' AND '" . sDB::mkdatetime($end) . "'"; $query = "SELECT count(id) AS orders,\n\t\t\t\t\t\tSUM(total) AS sales,\n\t\t\t\t\t\tAVG(total) AS average,\n\t\t \t\t\t\tSUM(IF({$daterange},1,0)) AS wkorders,\n\t\t\t\t\t\tSUM(IF({$daterange},total,0)) AS wksales,\n\t\t\t\t\t\tAVG(IF({$daterange},total,null)) AS wkavg\n \t\t\t\t\tFROM {$purchasetable} WHERE {$txnstatus}"; $cached = get_transient('shopp_dashboard_stats_' . $range); if (empty($cached)) { $results = sDB::query($query); $RecentBestsellers = new BestsellerProducts(array('range' => array($start, $end), 'show' => 5)); $RecentBestsellers->load(array('pagination' => false)); $RecentBestsellers->maxsold = 0; foreach ($RecentBestsellers as $product) { $RecentBestsellers->maxsold = max($RecentBestsellers->maxsold, $product->sold); } $LifeBestsellers = new BestsellerProducts(array('show' => 5)); $LifeBestsellers->load(array('pagination' => false)); $LifeBestsellers->maxsold = 0; foreach ($LifeBestsellers as $product) { $LifeBestsellers->maxsold = max($LifeBestsellers->maxsold, $product->sold); } set_transient('shopp_dashboard_stats_' . $range, array($results, $RecentBestsellers, $LifeBestsellers), 300); } else { list($results, $RecentBestsellers, $LifeBestsellers) = $cached; } echo $before_widget; echo $before_title; echo $widget_name; echo $after_title; $orderscreen = add_query_arg('page', ShoppAdmin::pagename('orders'), admin_url('admin.php')); $productscreen = add_query_arg(array('page' => ShoppAdmin::pagename('products')), admin_url('admin.php')); ?> <div class="table"><table> <tr><th colspan="2"><form action="<?php echo admin_url('index.php'); ?> "> <select name="shopp-stats-range" id="shopp-stats-range"> <?php echo menuoptions($ranges, $range, true); ?> </select> <button type="submit" id="filter-button" name="filter" value="order" class="button-secondary hide-if-js"><?php _e('Filter', 'Shopp'); ?> </button> </form> </th><th colspan="2"><?php _e('Lifetime', 'Shopp'); ?> </th></tr> <tbody> <tr><td class="amount"><a href="<?php echo esc_url($orderscreen); ?> "><?php echo (int) $results->wkorders; ?> </a></td><td class="label"><?php echo _n('Order', 'Orders', (int) $results->wkorders, 'Shopp'); ?> </td> <td class="amount"><a href="<?php echo esc_url($orderscreen); ?> "><?php echo (int) $results->orders; ?> </a></td><td class="label"><?php echo _n('Order', 'Orders', (int) $results->orders, 'Shopp'); ?> </td></tr> <tr><td class="amount"><a href="<?php echo esc_url($orderscreen); ?> "><?php echo money($results->wksales); ?> </a></td><td class="label"><?php _e('Sales', 'Shopp'); ?> </td> <td class="amount"><a href="<?php echo esc_url($orderscreen); ?> "><?php echo money($results->sales); ?> </a></td><td class="label"><?php _e('Sales', 'Shopp'); ?> </td></tr> <tr><td class="amount"><a href="<?php echo esc_url($orderscreen); ?> "><?php echo money($results->wkavg); ?> </a></td><td class="label"><?php _e('Average Order', 'Shopp'); ?> </td> <td class="amount"><a href="<?php echo esc_url($orderscreen); ?> "><?php echo money($results->average); ?> </a></td><td class="label"><?php _e('Average Order', 'Shopp'); ?> </td></tr> <?php if (!empty($RecentBestsellers->products) || !empty($LifeBestsellers->products)) { ?> <tr> <th colspan="2"><?php printf(__('Bestsellers %s', 'Shopp'), $ranges[$range]); ?> </th> <th colspan="2"><?php printf(__('Lifetime Bestsellers', 'Shopp'), $ranges[$range]); ?> </th> </tr> <?php reset($RecentBestsellers); reset($LifeBestsellers); $firstrun = true; while (true) { list($recentid, $recent) = each($RecentBestsellers->products); list($lifetimeid, $lifetime) = each($LifeBestsellers->products); if (!$recent && !$lifetime) { break; } ?> <tr> <?php if (empty($RecentBestsellers->products) && $firstrun) { echo '<td colspan="2" rowspan="5">' . __('None', 'Shopp') . '</td>'; } ?> <?php if (!empty($recent->id)) { ?> <td class="salesgraph"> <div class="bar" style="width:<?php echo $recent->sold / $RecentBestsellers->maxsold * 100; ?> %;"><?php echo $recent->sold; ?> </div> </td> <td> <a href="<?php echo esc_url(add_query_arg('view', 'bestselling', $productscreen)); ?> "><?php echo esc_html($recent->name); ?> </a> </td> <?php } ?> <?php if (empty($LifeBestsellers->products) && $firstrun) { echo '<td colspan="2" rowspan="5">' . __('None', 'Shopp') . '</td>'; } ?> <?php if (!empty($lifetime->id)) { ?> <td class="salesgraph"> <div class="bar" style="width:<?php echo $lifetime->sold / $LifeBestsellers->maxsold * 100; ?> %;"><?php echo $lifetime->sold; ?> </div> </td> <td> <a href="<?php echo esc_url(add_query_arg('view', 'bestselling', $productscreen)); ?> "><?php echo esc_html($lifetime->name); ?> </a> </td> <?php } ?> </tr> <?php $firstrun = false; } ?> <?php } ?> </tbody></table></div> <script type="text/javascript"> jQuery(document).ready(function($){$('#shopp-stats-range').change(function(){$(this).parents('form').submit();});}); </script> <?php echo $after_widget; }
function tag($property, $options = array()) { global $Shopp; $pages = $Shopp->Settings->get('pages'); if (SHOPP_PERMALINKS) { $path = $Shopp->shopuri; } else { $page = add_query_arg('page_id', $pages['catalog']['id'], $Shopp->shopuri); } switch ($property) { case "url": return $Shopp->link('catalog'); break; case "display": case "type": return $this->type; break; case "is-landing": case "is-catalog": return is_shopp_page('catalog') && $this->type == "catalog"; break; case "is-category": return is_shopp_page('catalog') && $this->type == "category"; break; case "is-product": return is_shopp_page('catalog') && $this->type == "product"; break; case "is-cart": return is_shopp_page('cart'); break; case "is-checkout": return is_shopp_page('checkout'); break; case "is-account": return is_shopp_page('account'); break; case "tagcloud": if (!empty($options['levels'])) { $levels = $options['levels']; } else { $levels = 7; } if (empty($this->tags)) { $this->load_tags(); } $min = -1; $max = -1; foreach ($this->tags as $tag) { if ($min == -1 || $tag->products < $min) { $min = $tag->products; } if ($max == -1 || $tag->products > $max) { $max = $tag->products; } } if ($max == 0) { $max = 1; } $string = '<ul class="shopp tagcloud">'; foreach ($this->tags as $tag) { $level = floor((1 - $tag->products / $max) * $levels) + 1; if (SHOPP_PERMALINKS) { $link = $path . 'tag/' . urlencode($tag->name) . '/'; } else { $link = add_query_arg('shopp_tag', urlencode($tag->name), $page); } $string .= '<li class="level-' . $level . '"><a href="' . $link . '" rel="tag">' . $tag->name . '</a></li> '; } $string .= '</ul>'; return $string; break; case "has-categories": if (empty($this->categories)) { $this->load_categories(array('where' => 'true'), $options['showsmart']); } if (count($this->categories) > 0) { return true; } else { return false; } break; case "categories": if (!$this->categoryloop) { reset($this->categories); $Shopp->Category = current($this->categories); $this->categoryloop = true; } else { $Shopp->Category = next($this->categories); } if (current($this->categories)) { $Shopp->Category = current($this->categories); return true; } else { $this->categoryloop = false; return false; } break; case "category-list": $defaults = array('title' => '', 'before' => '', 'after' => '', 'class' => '', 'exclude' => '', 'orderby' => 'name', 'order' => 'ASC', 'depth' => 0, 'childof' => 0, 'parent' => false, 'showall' => false, 'linkall' => false, 'linkcount' => false, 'dropdown' => false, 'hierarchy' => false, 'products' => false, 'wraplist' => true, 'showsmart' => false); $options = array_merge($defaults, $options); extract($options, EXTR_SKIP); $this->load_categories(array("where" => "(pd.published='on' OR pd.id IS NULL)", "orderby" => $orderby, "order" => $order), $showsmart); $string = ""; $depthlimit = $depth; $depth = 0; $exclude = explode(",", $exclude); $classes = ' class="shopp_categories' . (empty($class) ? '' : ' ' . $class) . '"'; $wraplist = value_is_true($wraplist); if (value_is_true($dropdown)) { if (!isset($default)) { $default = __('Select category…', 'Shopp'); } $string .= $title; $string .= '<form><select name="shopp_cats" id="shopp-categories-menu"' . $classes . '>'; $string .= '<option value="">' . $default . '</option>'; foreach ($this->categories as &$category) { if (!empty($category->id) && in_array($category->id, $exclude)) { continue; } // Skip excluded categories if ($category->total == 0 && !isset($category->smart)) { continue; } // Only show categories with products if ($depthlimit && $category->depth >= $depthlimit) { continue; } if (value_is_true($hierarchy) && $category->depth > $depth) { $parent =& $previous; if (!isset($parent->path)) { $parent->path = '/' . $parent->slug; } } if (value_is_true($hierarchy)) { $padding = str_repeat(" ", $category->depth * 3); } if (SHOPP_PERMALINKS) { $link = $Shopp->shopuri . 'category/' . $category->uri; } else { $link = add_query_arg('shopp_category', $category->id, $Shopp->shopuri); } $total = ''; if (value_is_true($products) && $category->total > 0) { $total = ' (' . $category->total . ')'; } $string .= '<option value="' . $link . '">' . $padding . $category->name . $total . '</option>'; $previous =& $category; $depth = $category->depth; } $string .= '</select></form>'; $string .= '<script type="text/javascript">'; $string .= 'var menu = document.getElementById(\'shopp-categories-menu\');'; $string .= 'if (menu) {'; $string .= ' menu.onchange = function () {'; $string .= ' document.location.href = this.options[this.selectedIndex].value;'; $string .= ' }'; $string .= '}'; $string .= '</script>'; } else { $string .= $title; if ($wraplist) { $string .= '<ul' . $classes . '>'; } foreach ($this->categories as &$category) { if (!isset($category->total)) { $category->total = 0; } if (!isset($category->depth)) { $category->depth = 0; } if (!empty($category->id) && in_array($category->id, $exclude)) { continue; } // Skip excluded categories if ($depthlimit && $category->depth >= $depthlimit) { continue; } if (value_is_true($hierarchy) && $category->depth > $depth) { $parent =& $previous; if (!isset($parent->path)) { $parent->path = $parent->slug; } $string = substr($string, 0, -5); // Remove the previous </li> $active = ''; if (isset($Shopp->Category) && !empty($parent->slug) && preg_match('/(^|\\/)' . $parent->path . '(\\/|$)/', $Shopp->Category->uri)) { $active = ' active'; } $subcategories = '<ul class="children' . $active . '">'; $string .= $subcategories; } if (value_is_true($hierarchy) && $category->depth < $depth) { for ($i = $depth; $i > $category->depth; $i--) { if (substr($string, strlen($subcategories) * -1) == $subcategories) { // If the child menu is empty, remove the <ul> to avoid breaking standards $string = substr($string, 0, strlen($subcategories) * -1) . '</li>'; } else { $string .= '</ul></li>'; } } } if (SHOPP_PERMALINKS) { $link = $Shopp->shopuri . 'category/' . $category->uri; } else { $link = add_query_arg('shopp_category', !empty($category->id) ? $category->id : $category->uri, $Shopp->shopuri); } $total = ''; if (value_is_true($products) && $category->total > 0) { $total = ' <span>(' . $category->total . ')</span>'; } $current = ''; if (isset($Shopp->Category) && $Shopp->Category->slug == $category->slug) { $current = ' class="current"'; } $listing = ''; if ($category->total > 0 || isset($category->smart) || $linkall) { $listing = '<a href="' . $link . '"' . $current . '>' . $category->name . ($linkcount ? $total : '') . '</a>' . (!$linkcount ? $total : ''); } else { $listing = $category->name; } if (value_is_true($showall) || $category->total > 0 || isset($category->smart) || $category->children) { $string .= '<li' . $current . '>' . $listing . '</li>'; } $previous =& $category; $depth = $category->depth; } if (value_is_true($hierarchy) && $depth > 0) { for ($i = $depth; $i > 0; $i--) { if (substr($string, strlen($subcategories) * -1) == $subcategories) { // If the child menu is empty, remove the <ul> to avoid breaking standards $string = substr($string, 0, strlen($subcategories) * -1) . '</li>'; } else { $string .= '</ul></li>'; } } } if ($wraplist) { $string .= '</ul>'; } } return $string; break; case "views": if (isset($Shopp->Category->controls)) { return false; } $string = ""; $string .= '<ul class="views">'; if (isset($options['label'])) { $string .= '<li>' . $options['label'] . '</li>'; } $string .= '<li><button type="button" class="grid"></button></li>'; $string .= '<li><button type="button" class="list"></button></li>'; $string .= '</ul>'; return $string; case "orderby-list": if (isset($Shopp->Category->controls)) { return false; } if (isset($Shopp->Category->smart)) { return false; } $menuoptions = Category::sortoptions(); $title = ""; $string = ""; $default = $Shopp->Settings->get('default_product_order'); if (empty($default)) { $default = "title"; } if (isset($options['default'])) { $default = $options['default']; } if (isset($options['title'])) { $title = $options['title']; } if (value_is_true($options['dropdown'])) { if (isset($Shopp->Cart->data->Category['orderby'])) { $default = $Shopp->Cart->data->Category['orderby']; } $string .= $title; $string .= '<form action="' . esc_url($_SERVER['REQUEST_URI']) . '" method="get" id="shopp-' . $Shopp->Category->slug . '-orderby-menu">'; if (!SHOPP_PERMALINKS) { foreach ($_GET as $key => $value) { if ($key != 'shopp_orderby') { $string .= '<input type="hidden" name="' . $key . '" value="' . $value . '" />'; } } } $string .= '<select name="shopp_orderby" class="shopp-orderby-menu">'; $string .= menuoptions($menuoptions, $default, true); $string .= '</select>'; $string .= '</form>'; $string .= '<script type="text/javascript">'; $string .= "jQuery('#shopp-" . $Shopp->Category->slug . "-orderby-menu select.shopp-orderby-menu').change(function () { this.form.submit(); });"; $string .= '</script>'; } else { if (strpos($_SERVER['REQUEST_URI'], "?") !== false) { list($link, $query) = explode("\\?", $_SERVER['REQUEST_URI']); } $query = $_GET; unset($query['shopp_orderby']); $query = http_build_query($query); if (!empty($query)) { $query .= '&'; } foreach ($menuoptions as $value => $option) { $label = $option; $href = esc_url($link . '?' . $query . 'shopp_orderby=' . $value); $string .= '<li><a href="' . $href . '">' . $label . '</a></li>'; } } return $string; break; case "breadcrumb": if (isset($Shopp->Category->controls)) { return false; } if (empty($this->categories)) { $this->load_categories(); } $separator = " » "; if (isset($options['separator'])) { $separator = $options['separator']; } $category = false; if (isset($Shopp->Cart->data->breadcrumb)) { $category = $Shopp->Cart->data->breadcrumb; } $trail = false; $search = array(); if (isset($Shopp->Cart->data->Search)) { $search = array('search' => $Shopp->Cart->data->Search); } $path = explode("/", $category); if ($path[0] == "tag") { $category = "tag"; $search = array('tag' => urldecode($path[1])); } $Category = Catalog::load_category($category, $search); if (!empty($Category->uri)) { $type = "category"; if (isset($Category->tag)) { $type = "tag"; } if (SHOPP_PERMALINKS) { $link = esc_url(add_query_arg($_GET, $Shopp->shopuri . $type . '/' . $Category->uri)); } else { if (isset($Category->smart)) { $link = esc_url(add_query_arg(array_merge($_GET, array('shopp_category' => $Category->slug, 'shopp_pid' => null)), $Shopp->shopuri)); } else { $link = esc_url(add_query_arg(array_merge($_GET, array('shopp_category' => $Category->id, 'shopp_pid' => null)), $Shopp->shopuri)); } } $filters = false; if (!empty($Shopp->Cart->data->Category[$Category->slug])) { $filters = ' (<a href="?shopp_catfilters=cancel">' . __('Clear Filters', 'Shopp') . '</a>)'; } if (!empty($Shopp->Product)) { $trail .= '<li><a href="' . $link . '">' . $Category->name . (!$trail ? '' : $separator) . '</a></li>'; } elseif (!empty($Category->name)) { $trail .= '<li>' . $Category->name . $filters . (!$trail ? '' : $separator) . '</li>'; } // Build category names path by going from the target category up the parent chain $parentkey = !empty($Category->id) ? $this->categories[$Category->id]->parent : 0; while ($parentkey != 0) { $tree_category = $this->categories[$parentkey]; if (SHOPP_PERMALINKS) { $link = $Shopp->shopuri . 'category/' . $tree_category->uri; } else { $link = esc_url(add_query_arg(array_merge($_GET, array('shopp_category' => $tree_category->id, 'shopp_pid' => null)), $Shopp->shopuri)); } $trail = '<li><a href="' . $link . '">' . $tree_category->name . '</a>' . (empty($trail) ? '' : $separator) . '</li>' . $trail; $parentkey = $tree_category->parent; } } $trail = '<li><a href="' . $Shopp->link('catalog') . '">' . $pages['catalog']['title'] . '</a>' . (empty($trail) ? '' : $separator) . '</li>' . $trail; return '<ul class="breadcrumb">' . $trail . '</ul>'; break; case "search": global $wp; $type = "hidden"; if (isset($options['type'])) { $type = $options['type']; } if ($type == "radio") { $option = "shopp"; if (isset($options['option'])) { $option = $options['option']; } $default = false; if (isset($options['default'])) { $default = value_is_true($options['default']); } $selected = ''; if ($default) { $selected = ' checked="checked"'; } if (!empty($wp->query_vars['st'])) { $selected = ''; if ($wp->query_vars['st'] == $option) { $selected = ' checked="checked"'; } } if ($option == "blog") { return '<input type="radio" name="st" value="blog"' . $selected . ' />'; } else { return '<input type="radio" name="st" value="shopp"' . $selected . ' />'; } } elseif ($type == "menu") { if (empty($options['store'])) { $options['store'] = __('Search the store', 'Shopp'); } if (empty($options['blog'])) { $options['blog'] = __('Search the blog', 'Shopp'); } if (isset($wp->query_vars['st'])) { $selected = $wp->query_vars['st']; } $menu = '<select name="st">'; if (isset($options['default']) && $options['default'] == "blog") { $menu .= '<option value="blog"' . ($selected == "blog" ? ' selected="selected"' : '') . '>' . $options['blog'] . '</option>'; $menu .= '<option value="shopp"' . ($selected == "shopp" ? ' selected="selected"' : '') . '>' . $options['store'] . '</option>'; } else { $menu .= '<option value="shopp"' . ($selected == "shopp" ? ' selected="selected"' : '') . '>' . $options['store'] . '</option>'; $menu .= '<option value="blog"' . ($selected == "blog" ? ' selected="selected"' : '') . '>' . $options['blog'] . '</option>'; } $menu .= '</select>'; return $menu; } else { return '<input type="hidden" name="st" value="shopp" />'; } break; case "catalog-products": if ($property == "catalog-products") { $Shopp->Category = new CatalogProducts($options); } case "new-products": if ($property == "new-products") { $Shopp->Category = new NewProducts($options); } case "featured-products": if ($property == "featured-products") { $Shopp->Category = new FeaturedProducts($options); } case "onsale-products": if ($property == "onsale-products") { $Shopp->Category = new OnSaleProducts($options); } case "bestseller-products": if ($property == "bestseller-products") { $Shopp->Category = new BestsellerProducts($options); } case "random-products": if ($property == "random-products") { $Shopp->Category = new RandomProducts($options); } case "tag-products": if ($property == "tag-products") { $Shopp->Category = new TagProducts($options); } case "related-products": if ($property == "related-products") { $Shopp->Category = new RelatedProducts($options); } case "search-products": if ($property == "search-products") { $Shopp->Category = new SearchResults($options); } case "category": if ($property == "category") { if (isset($options['name'])) { $Shopp->Category = new Category($options['name'], 'name'); } else { if (isset($options['slug'])) { $Shopp->Category = new Category($options['slug'], 'slug'); } else { if (isset($options['id'])) { $Shopp->Category = new Category($options['id']); } } } } if (isset($options['reset'])) { return $Shopp->Category = false; } if (isset($options['title'])) { $Shopp->Category->name = $options['title']; } if (isset($options['show'])) { $Shopp->Category->loading['limit'] = $options['show']; } if (isset($options['pagination'])) { $Shopp->Category->loading['pagination'] = $options['pagination']; } if (isset($options['order'])) { $Shopp->Category->loading['order'] = $options['order']; } if (isset($options['load'])) { return true; } if (isset($options['controls']) && !value_is_true($options['controls'])) { $Shopp->Category->controls = false; } if (isset($options['view'])) { if ($options['view'] == "grid") { $Shopp->Category->view = "grid"; } else { $Shopp->Category->view = "list"; } } ob_start(); if (isset($Shopp->Category->smart) && file_exists(SHOPP_TEMPLATES . "/category-{$Shopp->Category->slug}.php")) { include SHOPP_TEMPLATES . "/category-{$Shopp->Category->slug}.php"; } elseif (isset($Shopp->Category->id) && file_exists(SHOPP_TEMPLATES . "/category-{$Shopp->Category->id}.php")) { include SHOPP_TEMPLATES . "/category-{$Shopp->Category->id}.php"; } else { include SHOPP_TEMPLATES . "/category.php"; } $content = ob_get_contents(); ob_end_clean(); $Shopp->Category = false; // Reset the current category return $content; break; case "product": if (isset($options['name'])) { $Shopp->Product = new Product($options['name'], 'name'); } else { if (isset($options['slug'])) { $Shopp->Product = new Product($options['slug'], 'slug'); } else { if (isset($options['id'])) { $Shopp->Product = new Product($options['id']); } } } if (isset($options['load'])) { return true; } ob_start(); if (file_exists(SHOPP_TEMPLATES . "/product-{$Shopp->Product->id}.php")) { include SHOPP_TEMPLATES . "/product-{$Shopp->Product->id}.php"; } else { include SHOPP_TEMPLATES . "/product.php"; } $content = ob_get_contents(); ob_end_clean(); return $content; break; case "sideproduct": $content = false; $source = $options['source']; if ($source == "product" && isset($options['product'])) { // Save original requested product if ($Shopp->Product) { $Requested = $Shopp->Product; } $products = explode(",", $options['product']); if (!is_array($products)) { $products = array($products); } foreach ($products as $product) { $product = trim($product); if (empty($product)) { continue; } if (preg_match('/^[\\d+]$/', $product)) { $Shopp->Product = new Product($product); } else { $Shopp->Product = new Product($product, 'slug'); } if (empty($Shopp->Product->id)) { continue; } if (isset($options['load'])) { return true; } ob_start(); if (file_exists(SHOPP_TEMPLATES . "/sideproduct-{$Shopp->Product->id}.php")) { include SHOPP_TEMPLATES . "/sideproduct-{$Shopp->Product->id}.php"; } else { include SHOPP_TEMPLATES . "/sideproduct.php"; } $content .= ob_get_contents(); ob_end_clean(); } // Restore original requested category if (!empty($Requested)) { $Shopp->Product = $Requested; } else { $Shopp->Product = false; } } if ($source == "category" && isset($options['category'])) { // Save original requested category if ($Shopp->Category) { $Requested = $Shopp->Category; } if (empty($options['category'])) { return false; } $Shopp->Category = Catalog::load_category($options['category']); $Shopp->Category->load_products($options); if (isset($options['load'])) { return true; } foreach ($Shopp->Category->products as $product) { $Shopp->Product = $product; ob_start(); if (file_exists(SHOPP_TEMPLATES . "/sideproduct-{$Shopp->Product->id}.php")) { include SHOPP_TEMPLATES . "/sideproduct-{$Shopp->Product->id}.php"; } else { include SHOPP_TEMPLATES . "/sideproduct.php"; } $content .= ob_get_contents(); ob_end_clean(); } // Restore original requested category if (!empty($Requested)) { $Shopp->Category = $Requested; } else { $Shopp->Category = false; } } return $content; break; } }
?> </label></span> <span id="gallery-thumbnail-height-input"><input type="text" name="settings[gallery_thumbnail_height]" value="<?php echo attribute_escape($this->Settings->get('gallery_thumbnail_height')); ?> " id="gallery-thumbnail-height" size="5" class="selectall" /><label for="gallery-thumbnail-height"> <?php _e('height', 'Shopp'); ?> </label></span> <p><select name="settings[gallery_thumbnail_sizing]" id="gallery-thumbnail-sizing"> <?php echo menuoptions($sizingOptions, $this->Settings->get('gallery_thumbnail_sizing'), true); ?> </select></p> <p><select name="settings[gallery_thumbnail_quality]" id="gallery-thumbnail-quality"> <?php echo menuoptions($qualityOptions, $this->Settings->get('gallery_thumbnail_quality'), true); ?> </select></p> <p><?php _e('Changes to these settings will only affect new images.', 'Shopp'); ?> </p> </td> </tr> </tbody> </table> <p class="submit"><input type="submit" class="button-primary" name="save" value="<?php _e('Save Changes', 'Shopp'); ?> " /></p>
public function editor($Item) { extract($Item); $conditions = array(); foreach ($rules as $ruleid => $rule) { $conditionals = array('${id}' => $edit, '${ruleid}' => $ruleid, '${property_menu}' => $this->property_menu($rule['p']), '${rulevalue}' => esc_attr($rule['v'])); $conditions[] = str_replace(array_keys($conditionals), $conditionals, $this->template_conditional()); } $localrates = array(); foreach ($locals as $localename => $localerate) { $localrate_data = array('${id}' => $edit, '${localename}' => $localename, '${localerate}' => (double) $localerate); $localrates[] = str_replace(array_keys($localrate_data), $localrate_data, $this->template_localrate()); } $data = array('${id}' => $id, '${rate}' => percentage($rate, array('precision' => 4)), '${countries}' => menuoptions($this->countries, $country, true), '${zones}' => !empty($zones[$country]) ? menuoptions($zones[$country], $zone, true) : '', '${conditions}' => join('', $conditions), '${haslocals}' => $haslocals, '${localrates}' => join('', $localrates), '${instructions}' => $localerror ? '<p class="error">' . $localerror . '</p>' : $instructions, '${compounded}' => Shopp::str_true($compound) ? 'checked="checked"' : '', '${cancel_href}' => add_query_arg(array('id' => null, '_wpnonce' => null))); if ($conditions) { $data['no-conditions'] = ''; } if (!empty($zones[$country])) { $data['no-zones'] = ''; } if ($haslocals) { $data['no-local-rates'] = ''; } else { $data['has-local-rates'] = ''; } if (count($locals) > 0) { $data['instructions'] = 'hidden'; } echo ShoppUI::template($this->editor, $data); }
function category_products() { $db = DB::get(); $catalog = DatabaseObject::tablename(Catalog::$table); $category = DatabaseObject::tablename(Category::$table); $products = DatabaseObject::tablename(Product::$table); $results = $db->query("SELECT p.id,p.name FROM {$catalog} AS catalog LEFT JOIN {$category} AS cat ON cat.id = catalog.category LEFT JOIN {$products} AS p ON p.id=catalog.product WHERE cat.id={$_GET['category']} ORDER BY p.name ASC", AS_ARRAY); $products = array(); $products[0] = __("Select a product…", "Shopp"); foreach ($results as $result) { $products[$result->id] = $result->name; } return menuoptions($products, 0, true); }
/** * Renders the date scale filter control element * * @author Jonathan Davis * @since 1.3 * * @return void **/ protected static function scalefilter() { ?> <select name="scale" id="scale"> <?php $scale = isset($_GET['scale']) ? $_GET['scale'] : 'day'; $scales = array('hour' => __('By Hour', 'Shopp'), 'day' => __('By Day', 'Shopp'), 'week' => __('By Week', 'Shopp'), 'month' => __('By Month', 'Shopp')); echo menuoptions($scales, $scale, true); ?> </select> <?php }
/** * Displays the shipping estimate widget * * The shipping estimate widget allows shoppers to provide location * information so that shipping costs can be calculated. * * @api `shopp('cart.shipping-estimates')` * @since 1.0 * * @param string $result The output * @param array $options The options * - **class**: CSS class names to apply to the widget * - **postcode**: `on` (on, off) Show the post code field in the widget * @param ShoppCart $O The working object * @return string The markup for the shipping estimate widget **/ public static function shipping_estimates($result, $options, $O) { $defaults = array('postcode' => 'on', 'class' => 'ship-estimates', 'label' => Shopp::__('Estimate Shipping & Taxes')); $options = array_merge($defaults, $options); extract($options); if (empty($O->shipped)) { return ''; } $markets = shopp_setting('target_markets'); $Shipping = ShoppOrder()->Shipping; if (empty($markets)) { return ''; } if (!empty($Shipping->country)) { $selected = $Shipping->country; } else { $selected = ShoppBaseLocale()->country(); } $postcode = Shopp::str_true($postcode) || $O->showpostcode; $_ = '<div class="' . $class . '">'; if (count($markets) > 1) { $_ .= '<span>'; $_ .= '<select name="shipping[country]" id="shipping-country">'; $_ .= menuoptions($markets, $selected, true); $_ .= '</select>'; $_ .= '</span>'; } else { $_ .= '<input type="hidden" name="shipping[country]" id="shipping-country" value="' . key($markets) . '" />'; } if ($postcode) { $_ .= '<span>'; $_ .= '<input type="text" name="shipping[postcode]" id="shipping-postcode" size="6" value="' . $Shipping->postcode . '"' . inputattrs($options) . ' /> '; $_ .= '</span>'; $_ .= shopp('cart', 'get-update-button', array('value' => $label)); } return $_ . '</div>'; }
function shipping_meta_box($Customer) { ?> <p> <input type="text" name="shipping[address]" id="shipping-address" value="<?php echo esc_attr($Customer->Shipping->address); ?> " /><br /> <input type="text" name="shipping[xaddress]" id="shipping-xaddress" value="<?php echo esc_attr($Customer->Shipping->xaddress); ?> " /><br /> <label for="shipping-address"><?php _e('Street Address', 'Shopp'); ?> </label> </p> <p> <span> <input type="text" name="shipping[city]" id="shipping-city" value="<?php echo esc_attr($Customer->Shipping->city); ?> " size="14" /><br /> <label for="shipping-city"><?php _e('City', 'Shopp'); ?> </label> </span> <span id="shipping-state-inputs"> <select name="shipping[state]" id="shipping-state"> <?php echo menuoptions($Customer->shipping_states, $Customer->Shipping->state, true); ?> </select> <input type="text" name="shipping[state]" id="shipping-state-text" value="<?php echo esc_attr($Customer->Shipping->state); ?> " size="12" disabled="disabled" class="hidden" /> <label for="shipping-state"><?php _e('State / Province', 'Shopp'); ?> </label> </span> <span> <input type="text" name="shipping[postcode]" id="shipping-postcode" value="<?php echo esc_attr($Customer->Shipping->postcode); ?> " size="10" /><br /> <label for="shipping-postcode"><?php _e('Postal Code', 'Shopp'); ?> </label> </span> </p> <p> <span> <select name="shipping[country]" id="shipping-country"> <?php echo menuoptions($Customer->countries, $Customer->Shipping->country, true); ?> </select> <label for="shipping-country"><?php _e('Country', 'Shopp'); ?> </label> </span> </p> <br class="clear" /> <?php }
echo $name; ?> " ><?php echo $label; ?> </label></li> <?php } ?> </ul> </div> <br /> <select name="settings[report_export_format]" id="report-format"> <?php echo menuoptions($exports, shopp_setting('report_export_format'), true); ?> </select> </div> <button type="submit" id="download-button" name="download" value="export" class="button-secondary"<?php if ($Report->total < 1) { echo ' disabled="disabled"'; } ?> ><?php _e('Download', 'Shopp'); ?> </button> <div class="clear"></div> </form> </div>
include "navigation.php"; ?> <table class="form-table"> <tr class="form-required"> <th scope="row" valign="top"><label for="payment-gateway"><?php _e('Payment Gateway', 'Shopp'); ?> </label></th> <td><select name="settings[payment_gateway]" id="payment-gateway"> <option value=""><?php _e('No On-site Checkout', 'Shopp'); ?> </option> <?php echo menuoptions($gateways, $payment_gateway, true); ?> </select><br /> <?php _e('Select the payment gateway processor you will be using to process credit card transactions.', 'Shopp'); ?> </td> </tr> <tbody id="payment-settings"> <?php if (is_array($LocalProcessors)) { foreach ($LocalProcessors as &$Processor) { $Processor->settings(); } } ?>
public function box() { $this->references['types_menu'] = menuoptions(ShoppScreenDiscountEditor::types(), $this->references['Promotion']->type, true); parent::box(); }
function form($options) { $format_options = array('firstname' => __('J. Doe'), 'lastname' => __('John D.')); $location_options = array('none' => __('No location'), 'state' => __('State/Province'), 'city,state' => __('City, State/Province')); ?> <p><label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title'); ?> </label> <input type="text" name="<?php echo $this->get_field_name('title'); ?> " id="<?php echo $this->get_field_id('title'); ?> " class="widefat" value="<?php echo $options['title']; ?> "></p> <p><select name="<?php echo $this->get_field_name('abbr'); ?> "> <?php echo menuoptions($format_options, $options['abbr'], true); ?> </select><label> <?php _e('Name format', 'Shopp'); ?> </label></p> <p><label><input type="hidden" name="<?php echo $this->get_field_name('city'); ?> " value="off" /><input type="checkbox" name="<?php echo $this->get_field_name('city'); ?> " value="on" <?php echo $options['city'] == "on" ? ' checked="checked"' : ''; ?> /> <?php _e('Show city'); ?> </label><br /> <label><input type="hidden" name="<?php echo $this->get_field_name('state'); ?> " value="off" /><input type="checkbox" name="<?php echo $this->get_field_name('state'); ?> " value="on" <?php echo $options['state'] == "on" ? ' checked="checked"' : ''; ?> /> <?php _e('Show state/province'); ?> </label></p> <p> <label><input type="hidden" name="<?php echo $this->get_field_name('avatar'); ?> " value="off" /><input type="checkbox" name="<?php echo $this->get_field_name('avatar'); ?> " value="on" <?php echo $options['avatar'] == "on" ? ' checked="checked"' : ''; ?> /> <?php _e('Show Avatar'); ?> </label> <input type="text" name="<?php echo $this->get_field_name('size'); ?> " size="5" value="<?php echo $options['size']; ?> " /><label> <?php _e('pixels', 'Shopp'); ?> </label> </p> <?php }
<form action="<?php echo esc_url(add_query_arg(array_merge($_GET,array('src'=>'export_customers')),admin_url("admin.php"))); ?>" id="log" method="post"> <button type="button" id="export-settings-button" name="export-settings" class="button-secondary"><?php _e('Export Options','Ecart'); ?></button> <div id="export-settings" class="hidden"> <div id="export-columns" class="multiple-select"> <ul> <li<?php $even = true; if ($even) echo ' class="odd"'; $even = !$even; ?>><input type="checkbox" name="selectall_columns" id="selectall_columns" /><label for="selectall_columns"><strong><?php _e('Select All','Ecart'); ?></strong></label></li> <li<?php if ($even) echo ' class="odd"'; $even = !$even; ?>><input type="hidden" name="settings[customerexport_headers]" value="off" /><input type="checkbox" name="settings[customerexport_headers]" id="purchaselog_headers" value="on" /><label for="purchaselog_headers"><strong><?php _e('Include column headings','Ecart'); ?></strong></label></li> <?php $even = true; foreach ($columns as $name => $label): ?> <li<?php if ($even) echo ' class="odd"'; $even = !$even; ?>><input type="checkbox" name="settings[customerexport_columns][]" value="<?php echo $name; ?>" id="column-<?php echo $name; ?>" <?php echo in_array($name,$selected)?' checked="checked"':''; ?> /><label for="column-<?php echo $name; ?>" ><?php echo $label; ?></label></li> <?php endforeach; ?> </ul> </div><br /> <select name="settings[customerexport_format]"> <?php echo menuoptions($exports,$formatPref,true); ?> </select></div> <button type="submit" id="download-button" name="download" value="export" class="button-secondary"><?php _e('Download','Ecart'); ?></button> </form> </div> <?php endif; ?> <?php if ($page_links) echo "<div class='tablenav-pages'>$page_links</div>"; ?> <div class="clear"></div> </div> </div> <div id="start-calendar" class="calendar"></div> <div id="end-calendar" class="calendar"></div> <script type="text/javascript"> var lastexport = new Date(<?php echo date("Y,(n-1),j",$Ecart->Settings->get('customerexport_lastexport')); ?>);