Skip to content

Commit

Permalink
Variety of tweaks including buttonizing the New Customers login butto…
Browse files Browse the repository at this point in the history
…n, adding config to freeshipping calculator, bug fixes, updating reporting controller and views, and fixing default value in authnet calc
  • Loading branch information
freddirkse committed Jun 23, 2011
1 parent 0f38367 commit c74a71c
Show file tree
Hide file tree
Showing 20 changed files with 2,091 additions and 738 deletions.
9 changes: 5 additions & 4 deletions framework/datatypes/billing.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,13 @@ public function getCalcViews() {
);

$views = array();
foreach ($this->available_calculators as $calcname) {
foreach ($this->available_calculators as $key=>$calcname) {
if (file_exists($dirs[0].$calcname.'.tpl')) {
$views[$calcname] = $dirs[0].$calcname.'.tpl';
$views[$calcname]['view'] = $dirs[0].$calcname.'.tpl';
} else {
$views[$calcname] = $dirs[1].$calcname.'.tpl';
}
$views[$calcname]['view'] = $dirs[1].$calcname.'.tpl';
}
$views[$calcname]['id'] = $key;
}

return array_reverse($views);
Expand Down
17 changes: 13 additions & 4 deletions framework/datatypes/shipping.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,23 @@ public function __construct() {
$this->shippingmethod->update(array('shippingcalculator_id'=>$calcid));
}
}

if (!empty($this->available_calculators) && !empty($this->shippingmethod->shippingcalculator_id)) {
$calcname = $this->available_calculators[$this->shippingmethod->shippingcalculator_id];
if(isset($this->available_calculators[$this->shippingmethod->shippingcalculator_id]))
{
$calcname = $this->available_calculators[$this->shippingmethod->shippingcalculator_id];
}
else
{
//recently reconfigured/disabled shipping calc that was already set in the object, so default to the first one available
$key = array_shift(array_keys($this->available_calculators));
$calcname = $this->available_calculators[$key];
$this->shippingmethod->shippingcalculator_id = $key;
}
$this->calculator = new $calcname($this->shippingmethod->shippingcalculator_id);
} else {
$this->calculator = null;
}

}
$this->getRates();

} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
{control type="text" name="transaction_key" label="Transaction Key" value=$calculator->configdata.transaction_key}
{control type="text" name="password" label="Password" value=$calculator->configdata.password}
{control type="checkbox" name="testmode" label="Enable Test Mode?" value=1 checked=$calculator->configdata.testmode}
{control type="radiogroup" name="process_mode" label="Processing Mode" items="Authorize and Capture, Authorize Only" values="0,1" checked=$calculator->configdata.process_mode}
{control type="radiogroup" name="process_mode" label="Processing Mode" items="Authorize and Capture, Authorize Only" values="0,1" default=$calculator->configdata.process_mode}
</div>
<div id="tab2">
{control type="checkbox" name="accepted_cards[]" label="Master Card" value="MasterCard" checked=$calculator->configdata.accepted_cards}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,11 @@ public function configure() {
}

public function saveconfig() {
global $db;
global $db;
if (empty($this->params['id'])) return false;
$calcname = $db->selectValue('shippingcalculator', 'calculator_name', 'id='.$this->params['id']);
$calc = new $calcname($this->params['id']);
$conf = serialize($calc->parseConfig($this->params));
$conf = serialize($calc->parseConfig($this->params));
$calc->update(array('config'=>$conf));
expHistory::back();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,34 @@ class freeshippingcalculator extends shippingcalculator {
* Returns the name of the shipping calculator, for use in the Shipping Administration Module
*/
//overridden methods:
public function name() { return exponent_lang_getText('Free Shipping'); }
public function description() { return exponent_lang_getText('Use this to offer customers free shipping'); }
public function name() { return exponent_lang_getText('Free Shipping Calculator'); }
public function description() { return exponent_lang_getText('Use this to offer customers free shipping.'); }
public function hasUserForm() { return true; }
public function hasConfig() { return true; }
public function addressRequired() { return true; }
public function isSelectable() { return true; }

public $shippingmethods = array("01"=>"Free Shipping");

public function getRates($order) {
$rates = array('01'=>array('id'=>'01','title'=>'Free','cost'=>0));
public function __construct($params)
{
parent::__construct($params);
if(isset($this->configdata['free_shipping_method_default_name']))
{
$this->shippingmethods["01"] = $this->configdata['free_shipping_method_default_name'];
}
}

public function getRates($order) {
if(isset($this->configdata['free_shipping_option_default_name']))
{
$title = $this->configdata['free_shipping_option_default_name'];
}
else
{
$title = "Free";
}
$rates = array('01'=>array('id'=>'01','title'=>$title,'cost'=>0));
return $rates;
}

Expand All @@ -42,16 +59,10 @@ public function configForm() {

//process config form
function parseConfig($values) {
$config_vars = array('rate');
foreach ($config_vars as $varname) {
if ($varname == 'rate') {
$config[$varname] = isset($values[$varname]) ? preg_replace("/[^0-9.]/","",$values[$varname]) : null;
} else {
$config[$varname] = isset($values[$varname]) ? $values[$varname] : null;
}

}

$config_vars = array('free_shipping_option_default_name','free_shipping_method_default_name');
foreach ($config_vars as $varname) {
$config[$varname] = isset($values[$varname]) ? $values[$varname] : null;
}
return $config;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{*
* Copyright (c) 2004-2011 OIC Group, Inc.
* Written and Designed by Adam Kessler
*
* This file is part of Exponent
*
* Exponent is free software; you can redistribute
* it and/or modify it under the terms of the GNU
* General Public License as published by the Free
* Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* GPL: http://www.gnu.org/licenses/gpl.txt
*
*}

<div id="freeshippingcfg" class="hide exp-skin-tabview">
{script unique="authtabs" yuimodules="tabview, element"}
{literal}
var tabView = new YAHOO.widget.TabView('freeship');
YAHOO.util.Dom.removeClass("freeshippingcfg", 'hide');
var loading = YAHOO.util.Dom.getElementsByClassName('loadingdiv', 'div');
YAHOO.util.Dom.setStyle(loading, 'display', 'none');

{/literal}
{/script}
<div id="freeship" class="yui-navset">
<ul class="yui-nav">
<li class="selected"><a href="#tab1"><em>Free Shipping Settings</em></a></li>
</ul>
<div class="yui-content">
<div id="tab1">
{control type="text" name="free_shipping_method_default_name" label="Default Name for this Shipping Method" value=$calculator->configdata.free_shipping_method_default_name}
{control type="text" name="free_shipping_option_default_name" label="Default Name for the Selectable Shipping Option" value=$calculator->configdata.free_shipping_option_default_name}
</div>
</div>
</div>
</div>
<div class="loadingdiv">Loading</div>
4 changes: 2 additions & 2 deletions framework/modules/ecommerce/views/cart/checkout.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,8 @@
<div class="separate">
<h2>Payment Information</h2>
<div>
{foreach from=$billing->calculator_views item=cviews name=calcs}
{include file=$cviews}
{foreach from=$billing->calculator_views item=cviews name=calcs}
{include file=$cviews.view key=$cviews.id}
{if $smarty.foreach.calcs.last!=1}
<strong>- OR -</strong>
{/if}
Expand Down
12 changes: 9 additions & 3 deletions framework/modules/ecommerce/views/cart/confirm.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@
<h1>{ecomconfig var='checkout_title_top' default="Confirm Your Secure Order"}</h1>
<div id="cart-message">{ecomconfig var='checkout_message_top' default=""}</div>
{br}
<div class="confirmationlinks">
<a href="{if $nologin}{link controller=cart action=process nologin=1}{else}{link controller=cart action=process}{/if}" class="awesome {$smarty.const.BTN_SIZE} green next" />
{"Looks good, submit my order!"|gettext} &raquo;
</a>
<a href="{link controller=cart action=checkout}" class="awesome {$smarty.const.BTN_SIZE} yellow back" />
&laquo; {"Let me edit something"|gettext}
</a>
</div>
{br}
<div class="billinginfo">
<h2>Billing Information</h2>
<div class="payment-info">
Expand Down Expand Up @@ -234,9 +243,6 @@
&laquo; {"Let me edit something"|gettext}
</a>
</div>



<p align="center">
<div style="width:100%; margin: auto;">
{ecomconfig var='ssl_seal' default="" unescape="true"}
Expand Down

0 comments on commit c74a71c

Please sign in to comment.