Post by MulderDSM » Wed Mar 03, 2010 6:41 am

I've only got PayPal enabled, is there anyway to pre-select that radio button so the user doesn't have to select it when it's their only option?

New member

Posts

Joined
Sat Feb 20, 2010 9:57 pm

Post by jkungfu » Wed Mar 03, 2010 10:44 am

i would also like to know

selected="selected" has no effect

淄博网站建设, 淄博网站优化


Active Member

Posts

Joined
Fri Jan 01, 2010 8:03 pm


Post by rph » Wed Mar 03, 2010 11:36 am

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

Code: Select all

<input type="radio" name="payment_method" value="<?php echo $payment_method['id']; ?>" id="<?php echo $payment_method['id']; ?>" style="margin: 0px;" />
with

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'; ?>  />
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).

-Ryan


rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska

Post by Qphoria » Wed Mar 03, 2010 2:23 pm

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

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by MulderDSM » Thu Mar 04, 2010 7:01 am

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']);
....

New member

Posts

Joined
Sat Feb 20, 2010 9:57 pm

Post by markb » Tue Mar 09, 2010 7:38 pm

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

http://www.indirizzimail.com/
Vendita Elenchi Email Aziende Italiane


Newbie

Posts

Joined
Fri Dec 04, 2009 6:46 pm
Who is online

Users browsing this forum: No registered users and 87 guests