Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

checkbox before checkout
 
shopi
Member
 
Total Posts:  46
Joined:  2008-02-16
 

i want that a customer agree the selling condition
befor he checkout, for this i insert a extra line and a checkbox

on review.phtml

the only missing part is the code that is checking if the checkbox is marked or not

how to do this?

-----------------------

<div id="checkout-review-load" class="default-box">
    
<?php echo $this->getChildHtml('info'?>

        
</div>

<
div class="content button-set">

//my text
    
<class="left"><?php echo $this->__(' Ich habe die '?> <a href="<?php echo $this->getUrl('agb', array('_secure'=>false)) ?>"<?php echo $this->__('AGB'?></a><?php echo $this->__(' gelesen und akzeptiert !'?>
</p>

//my check box
<class="left">
<
form action="input_checkbox.htm">
      <
input type="checkbox" name="yesagb" value="ok"><br>
 </
form>

</
p>
    <
BR>
    <
class="left"><?php echo $this->__('Forgot an Item?'?> <a href="<?php echo $this->getUrl('checkout/cart', array('_secure'=>false)) ?>"><?php   echo $this->__('Edit Your Cart'?></a></p>
    <
p>
        <
span id="review-please-wait" style="display:none;" class="opc-please-wait">
            <
img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" class="v-middle" alt=""/> &nbsp<?php echo $this->__('Submitting order information...'?> &nbsp;
        

</
span>

        <
span id="review-buttons-container" class="a-center">
            <
input type="image" src="<?php echo $this->getSkinUrl('images/btn_place_order.gif') ?>" onclick="review.save();" value="<?php echo $this->__('Place Order') ?>"/>
        </
span>
        

    </
p>
</
div>

<
script type="text/javascript">
    var 
review = new Review('<?php echo $this->getUrl('checkout/onepage/saveOrder') ?>''<?php echo $this->getUrl('checkout/onepage/success', array('_secure'=>false)) ?>');
</script>
 
Magento Community Magento Community
Magento Community
Magento Community
 
mike222
Member
 
Total Posts:  41
Joined:  2008-04-07
Austria
 

By the way, this is a very important feature here in Austria - and I think in Germany too. The user must confirm that he has read and understand the AGB (general terms and conditions).

So if anyone could help, please…

regards from Austria

 
Magento Community Magento Community
Magento Community
Magento Community
 
mzentrale1
Guru
 
Total Posts:  731
Joined:  2007-12-06
Stuttgart, Germany
 

Hi,

i did it this way:

1st: Overload layout of checkout within my own module. Module is called Termsandconditions. Within config.xml i can overwrite layout of checkout.

<frontend>
<
layout>
             <
updates>
                  <
checkout>
                        <
file>termsandconditions.xml</file>
                  </
checkout>
                  <!--<
sales>
                        <
file>termsandconditionssales.xml</file>
                  </
sales>-->
             </
updates>
        </
layout>
</
frontend>

I copied original checkout.xml and saved as termsandconditons.xml. i customized new layout like:

<block type="termsandconditions/onepage_review" name="termsandconditions.onepage.review" as="review" template="termsandconditions/onepage/review.phtml">
                    <
block type="checkout/onepage_review_info" name="checkout.onepage.review.info" as="info" template="checkout/onepage/review/info.phtml"/>
                </
block>

In my example i had to create new block for my module which is located in Termsandconditions/Block/Onepage/Review.php. This Block extends the onepage review block:

class Mage_Termsandconditions_Block_Onepage_Review extends Mage_Checkout_Block_Onepage_Review
{
....
}

2nd:
I wrote a new controller in my module which handles the data from terms and conditions and send form from my custom block to new controller:

require_once 'Mage/Checkout/controllers/OnepageController.php'
class 
Mage_Termsandconditions_OnepageController extends Mage_Checkout_OnepageController
{

Within this controller is save date from form to user session and add the data to the order using one of the checkout events. You also have to extend eav of order

I also overload adminhtml block for orders in backend to show if terms was accepted or not.

Beware of changing code from core modules, maybe your changes will be overwritten by the next update.

Hope that helps. For any addintional questions you can pm me.

EDIT// I also changed checkout.js for onepage checkout so the place order button submit my added form.

cheers

Stefan

 
Magento Community Magento Community
Magento Community
Magento Community
 
SecretR
Jr. Member
 
Avatar
Total Posts:  23
Joined:  2008-03-21
 

Extremely useful smile
Thanks Stefan. Machs gut.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top