Skip to content

Instantly share code, notes, and snippets.

@danvega
Created April 7, 2013 02:53
Show Gist options
  • Save danvega/5328699 to your computer and use it in GitHub Desktop.
Save danvega/5328699 to your computer and use it in GitHub Desktop.
<!---
Slatwall - An Open Source eCommerce Platform
Copyright (C) 2011 ten24, LLC
This program 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 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.
Notes:
--->
<cfparam name="rc.edit" type="string" default="" />
<cfparam name="rc.orderRequirementsList" type="string" default="" />
<cfparam name="rc.activePaymentMethods" type="array" />
<cfparam name="rc.tabindex" default="1">
<cfset local.paymentShown = false />
<cfset local.sameAsShipping = false>
<cfif isNull($.slatwall.getCurrentAccount().getPrimaryAddress())>
<cfset local.address = getBeanFactory().getBean("addressService").newAddress() />
<cfelse>
<cfset local.address = $.slatwall.getCurrentAccount().getPrimaryAddress().getAddress() />
</cfif>
<cfoutput>
<!--- show order errors --->
<div class="row-fluid">
<div class="span12">
<cfif not listFind(rc.orderRequirementsList, 'account') and not listFind(rc.orderRequirementsList, 'fulfillment')>
<form name="processOrder" method="post" action="?update=1" class="form-horizontal">
<input type="hidden" name="slatAction" value="frontend:checkout.processOrder" />
<input type="hidden" name="orderID" value="#$.slatwall.cart().getOrderID()#" />
<cfset local.orderPaymentIndex = 1 />
<div class="row-fluid">
<div class="span12">
<cf_BootstrapAddressDisplay address="#local.address#" fieldNamePrefix="billingAddress." edit="true">
</div>
</div>
<fieldset>
<legend>Payment Options</legend>
<cfloop array="#$.slatwall.cart().getOrderPayments()#" index="local.orderPayment">
<cfset params = structNew() />
<cfset params.paymentMethod = local.orderPayment.getPaymentMethod() />
<cfset params.orderPayment = local.orderPayment />
<cfset params.orderPaymentIndex = local.orderPaymentIndex />
<cfset local.orderPaymentIndex += 1 />
<cfset params.maximumAmount = $.slatwall.cart('total') />
<cfset params.paymentTerm = $.slatwall.getService("settingService").getPaymentTermByPaymentTermName("Purchase Order")>
<cfif local.orderPayment.hasErrors() or (local.orderPayment.getAmountAuthorized() eq 0 and params.paymentMethod.setting("paymentMethodCheckoutTransactionType") neq "none")>
<cfset local.paymentShown = true />
<cfset params.edit = true />
<cfelse>
<cfset params.edit = false />
</cfif>
#view("frontend:checkout/payment/#local.orderPayment.getPaymentMethodType()#", params)#
</cfloop>
<cfif not local.paymentShown>
<cfloop array="#rc.activePaymentMethods#" index="local.paymentMethod">
<cfset params = structNew() />
<cfset params.edit = true />
<cfset params.paymentMethod = local.paymentMethod />
<cfset params.orderPayment = $.slatwall.getService("paymentService").newOrderPayment() />
<cfset params.orderPaymentIndex = local.orderPaymentIndex />
<cfset params.maximumAmount = $.slatwall.cart('total') />
<cfset params.paymentTerm = $.slatwall.getService("settingService").getPaymentTermByPaymentTermName("Purchase Order")>
<cfset local.orderPaymentIndex += 1 />
#view("frontend:checkout/payment/#local.paymentMethod.getPaymentMethodType()#", params)#
</cfloop>
</cfif>
</fieldset>
<div class="row-fluid">
<div class="span12">
<br/><br/>
<fieldset>
#view('frontend:checkout/items')#
<h3>Terms Of Use</h3>
<textarea class="span11" style="height:100px">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla aliquet, velit in varius porttitor, lectus neque ultrices nisi, in hendrerit quam metus eu sem. Cras vel tincidunt neque. Integer sed tortor libero, non pellentesque est. Suspendisse vel ligula vel enim vehicula malesuada. Suspendisse tellus justo, sollicitudin in semper eu, tincidunt non diam. Mauris ac turpis lectus, ut sodales enim. Phasellus lacinia enim ac metus luctus ut vulputate ligula sagittis. Mauris nec orci in quam fermentum iaculis. Mauris tristique neque vel orci ornare euismod. Cras tempor iaculis purus at aliquam. In hac habitasse platea dictumst. Donec tellus nunc, euismod sagittis ullamcorper posuere, pretium sed turpis. Nulla facilisi. Cras venenatis sodales odio, viverra vestibulum augue iaculis ac. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Fusce pellentesque tincidunt auctor. Etiam ligula urna, rhoncus ac aliquam eget, vulputate et nisl. Sed eu sem id nisl tincidunt hendrerit. Nulla facilisi. In nisl est, imperdiet sed pellentesque at, egestas eu sem. Duis sit amet quam in nulla rhoncus semper vitae eget tortor. In tempor suscipit pharetra. Proin lacus sapien, volutpat id tristique et, egestas et odio.
</textarea>
</fieldset>
</div>
</div>
<div class="row-fluid">
<div class="" align="right">
<br/>
<button type="submit" tabindex="#rc.tabIndex++#" class="btn btn-primary placeorder">Place Order</button>
</div>
</div>
</form>
</cfif>
</div>
</div>
</cfoutput>
<script>
$(function(){
$('.placeorder').click(function(e) {
e.preventDefault();
if(confirm("Are you sure you want to place your order?")){
$('form[name="processOrder"]').submit();
return true;
}
return false;
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment