Skip to content

Commit

Permalink
Tweaks to address functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
freddirkse committed Jul 21, 2011
1 parent 864aa1c commit b9b806e
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 26 deletions.
3 changes: 0 additions & 3 deletions files/.htaccess

This file was deleted.

10 changes: 9 additions & 1 deletion framework/modules/addressbook/controllers/addressController.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,15 @@ function isSearchable() { return true; }
function showall() {
redirect_to(array("controller"=>'address',"action"=>'myaddressbook'));
}


public function edit()
{
if((isset($this->params['id']))) $record = new address(intval($this->params['id']));
else $record = null;
$config = ecomconfig::getConfig('address_allow_admins_all');
assign_to_template(array('record'=>$record,'admin_config'=>$config));
}

public function myaddressbook() {
global $user;
// check if the user is logged in.
Expand Down
13 changes: 6 additions & 7 deletions framework/modules/addressbook/views/address/edit.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,18 @@ YUI(EXPONENT.YUI3_CONFIG).use('node', function(Y) {
{control type=text name=address2 label="Apt/Suite #" value=$record->address2}
{control type=text name=city label="<span class=\"required\">*</span>City" value=$record->city}

{if $user->is_admin || $user->is_acting_admin}
{control type=state name=state label="<span class=\"required\">*</span>State/Province" includeblank="-- Choose a State -- " all_us_territories=true exclude="6,8,10,17,30,46,50" value=$record->state add_other=true}
{*control type=text name=non_us_state label="&nbsp;State/Province" value=$record->non_us_state*}
{control type=country name=country label="&nbsp;Country" value=$record->country|default:223}
{if ($user->is_admin || $user->is_acting_admin) && $admin_config == true}
{control type=state name=state label="<span class=\"required\">*</span>State/Province" includeblank="-- Choose a State -- " value=$record->state add_other=true}
{control type=text name=non_us_state label="&nbsp;Non U.S. State/Province" value=$record->non_us_state}
{control type=country name=country label="&nbsp;Country" show_all=true value=$record->country|default:223}
{else}
{control type=state name=state label="<span class=\"required\">*</span>State/Province" includeblank="-- Choose a State -- " value=$record->state}
{* control type=hidden name=country value=223 *}
{control type=state name=state label="<span class=\"required\">*</span>State/Province" includeblank="-- Choose a State -- " value=$record->state}
{control type=country name=country label="&nbsp;Country" value=$record->country}
{/if}

{control type=text name=zip label="<span class=\"required\">*</span>Zip/Postal Code" value=$record->zip}
{control type="text" name="phone" label="<span class=\"required\">*</span>Phone Number <span class=\"example\">ex: 480-555-4200</span>" value=$record->phone}
{control type="dropdown" name="address_type" label="Address Type"|gettext items="Business,Residential" default=$record->address_type|default:"Residential"}
{control type="dropdown" name="address_type" label="Address Type"|gettext items="Business,Military,Residential" default=$record->address_type|default:"Residential"}
{control type="text" name="email" label="<span class=\"required\">*</span>Email Address" value=$record->email}
{if !$user->isLoggedIn()}

Expand Down
22 changes: 18 additions & 4 deletions framework/modules/ecommerce/assets/css/invoice.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#buttons {
margin-bottom:20px;
float:right;
text-align:right;
}

#invoice {
Expand Down Expand Up @@ -103,10 +103,24 @@
height:30px;
}

#search_stringControl #related_items {
#search_stringControl #add_new_item {
position:absolute;
top:0;
left:0;
width:98%;
right:0;
width:515px;
}

#bd #search_stringControl .yui-ac-content {
max-height:400px;
width:500px;
padding-right: 15px;
overflow-y:auto;
overflow-x:hidden;
}

#invoice #create_new_order #search_stringControl #search_internal{
width:515px;
}
#invoice #create_new_order #search_stringControl #search_external{
width:515px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
{control type=hidden name=options_shown value=$product->id}
{if $product->childProduct|@count >= 1}

<div id="child-products">
<div id="child-products" class="exp-ecom-table">
<table border="0" cellspacing="0" cellpadding="0">
<thead>
<tr>
Expand Down
6 changes: 3 additions & 3 deletions framework/modules/ecommerce/views/order/create_new_order.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

<div>
<h1>Create A New Order</h1>
<div id="invoice">
<div id="create_new_order">
{form id=order_item_form name=order_item_form action=save_new_order}
Select the order type, order status, and customer.{br}{br}
{control type="dropdown" name="order_type_id" label="Order Type:" frommodel='order_type'}
Expand All @@ -34,7 +34,7 @@
{literal}

// the text box for the title
var tagInput = Y.get('#related_items');
var tagInput = Y.get('#search_internal');
var theAddressesId = Y.get('#addresses_id');
var existingRadio = Y.get('#customer_type2');

Expand Down Expand Up @@ -71,7 +71,7 @@

{/literal}
{/capture}
{control type="autocomplete" controller="order" action="search" name="related_items" value="Search customer name or email" schema="id,firstname,middlename,lastname,organization,email" searchmodel="addresses" searchoncol="firstname,lastnamename,organization,email" jsinject=$callbacks}
{control type="autocomplete" controller="order" action="search" name="search_internal" value="Search customer name or email" schema="id,firstname,middlename,lastname,organization,email" searchmodel="addresses" searchoncol="firstname,lastnamename,organization,email" jsinject=$callbacks}

{capture assign="callbacks2"}
{literal}
Expand Down
8 changes: 4 additions & 4 deletions framework/modules/ecommerce/views/order/invoice.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,10 @@
{literal}

// the text box for the title
var tagInput = Y.one('#related_items');
var tagInput = Y.one('#add_new_item');

// the UL to append to
var tagUL = Y.one('#relatedItemsList');
var tagUL = Y.one('#new_items');

// the Add Link
var tagAddToList = Y.one('#addToRelProdList');
Expand Down Expand Up @@ -374,8 +374,8 @@

{/literal}
{/capture}
{control type="autocomplete" controller="store" action="search" name="related_items" label="Add a new item" value="Search title or SKU to add an item" schema="title,id,sef_url,expFile,model" searchmodel="product" searchoncol="title,model" jsinject=$callbacks}
<div id="relatedItemsList">
{control type="autocomplete" controller="store" action="search" name="add_new_item" label="Add a new item" value="Search title or SKU to add an item" schema="title,id,sef_url,expFile,model" searchmodel="product" searchoncol="title,model" jsinject=$callbacks}
<div id="new_items">
</div>
</td>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion framework/modules/ecommerce/views/order/show.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
{permissions}
{if $permissions.manage == 1}
{printer_friendly_link class="awesome `$smarty.const.BTN_SIZE` `$smarty.const.BTN_COLOR`" text="Print Packing Slip" view="show_packing"}
<a class="awesome {$smarty.const.BTN_SIZE} {$smarty.const.BTN_COLOR}" href="{link controller='order' action='createReferenceOrder' id=$order->id}"><strong><em>Spawn Reference Order</em></strong></a>
<a class="awesome {$smarty.const.BTN_SIZE} {$smarty.const.BTN_COLOR}" href="{link controller='order' action='createReferenceOrder' id=$order->id}">Spawn Reference Order</a>
{/if}
{/permissions}
</div>
Expand Down
Empty file removed install/not_configured
Empty file.
8 changes: 6 additions & 2 deletions plugins/function.control.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@ function smarty_function_control($params,&$smarty) {
$control->items[$state->id] = isset($params['abbv']) ? $state->code : $state->name;
//}
}
if(!count($states)) $control->items[-2] = '-- Specify State Below --';
//if(!count($states)) $control->items[-2] = '-- Specify State Below --';
if (isset($params['add_other'])) $control->items[-2] = '-- Specify State Below --';
else $control->include_blank = isset($params['includeblank']) ? $params['includeblank'] : false;

// sanitize the default value. can accept as id, code abbrv or full name,
Expand All @@ -246,7 +247,10 @@ function smarty_function_control($params,&$smarty) {
//$control->items[-1] = 'ALL United States';
}

foreach($db->selectObjects('geo_country', 'active=1', 'name ASC') as $country) {
if($params['show_all']) $countries = $db->selectObjects('geo_country', null, 'name ASC');
else $countries = $db->selectObjects('geo_country', 'active=1', 'name ASC');

foreach($countries as $country) {
//if (!in_array($country->id, $not_countries)) {
$control->items[$country->id] = isset($params['abbv']) ? $country->iso_code_3letter : $country->name;
//}
Expand Down

0 comments on commit b9b806e

Please sign in to comment.