Oddly enough it looks like there's already some code to do this but I'm not sure what causes it to kick off.
You can hard code it. Just replace
/catalog/view/theme/default/template/checkout/payment.tpl
/catalog/view/theme/default/template/checkout/guest_step_2.tpl
with
pp_standard is for PayPal standard but you can use any of the other working payment methods (e.g. 'pp_express' for PayPal Express, 'bank_transfer' for Bank Transfer).
You can hard code it. Just replace
/catalog/view/theme/default/template/checkout/payment.tpl
/catalog/view/theme/default/template/checkout/guest_step_2.tpl
Code: Select all
<input type="radio" name="payment_method" value="<?php echo $payment_method['id']; ?>" id="<?php echo $payment_method['id']; ?>" style="margin: 0px;" />
Code: Select all
<input type="radio" name="payment_method" value="<?php echo $payment_method['id']; ?>" id="<?php echo $payment_method['id']; ?>" style="margin: 0px;" <?php if ($payment_method['id'] == 'pp_standard') echo 'checked'; ?> />
-Ryan
This is all available if you search forums. I have a complete wiki page devoted to this:
http://wiki.opencart.com/index.php?titl ... e_Checkout
http://wiki.opencart.com/index.php?titl ... e_Checkout
Q, using your wiki page for the automatic, I was able to get the Payment single option to bypass, but the shipping one doesn't seem to buy pass. Here's the revised code I have for shipping.php starting at line 42
....
Code: Select all
$this->tax->setZone($shipping_address['country_id'], $shipping_address['zone_id']);
$this->load->model('checkout/extension');
if (0==0) { //circumvent session check
$quote_data = array();
$results = $this->model_checkout_extension->getExtensions('shipping');
foreach ($results as $result) {
$this->load->model('shipping/' . $result['key']);
$quote = $this->{'model_shipping_' . $result['key']}->getQuote($shipping_address);
if ($quote) {
$quote_data[$result['key']] = array(
'title' => $quote['title'],
'quote' => $quote['quote'],
'sort_order' => $quote['sort_order'],
'error' => $quote['error']
);
}
}
$sort_order = array();
foreach ($quote_data as $key => $value) {
$sort_order[$key] = $value['sort_order'];
}
array_multisort($sort_order, SORT_ASC, $quote_data);
$this->session->data['shipping_methods'] = $quote_data;
//Q: Autochoose shipping if using only one and it's single rate
if (count($quote_data) == 1) {
$values = array_values($quote_data);
if (count($values[0]['quote']) == 1) {
$keys = array_keys($values[0]['quote']);
$method = $values[0]['quote'][$keys[0]];
$this->session->data['shipping_method'] = $method;
$this->session->data['comment'] = '';
$this->redirect($this->url->https('checkout/payment'));
}
}//
}
$this->language->load('checkout/shipping');
if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
$shipping = explode('.', $this->request->post['shipping_method']);
Hello All
I'm using 1.3.2 and I want to do the same but the files seem to be quite different from 1.4.0, any idea what I need to change to have paypal standard set and checked by default?
It could be great if it could be hidden!
Thanks a lot!!
Mark
I'm using 1.3.2 and I want to do the same but the files seem to be quite different from 1.4.0, any idea what I need to change to have paypal standard set and checked by default?
It could be great if it could be hidden!
Thanks a lot!!
Mark
http://www.indirizzimail.com/
Vendita Elenchi Email Aziende Italiane
Who is online
Users browsing this forum: No registered users and 87 guests