Post by mikeytrw » Mon Nov 03, 2008 9:06 pm

Hi guys,

This is maybe a suggestion for version 1.x,

we should have the ability to specify customer facing options in the checkout_shipping page, that update the price accordingly.

This could be done via an AJAX request that calls a specific function in the shipping module passing in the options chosen. This function then returns the price and the page is updated automatically.

So, as well as quote() the shipping class would have a function like:

Code: Select all

  	public function AjaxQuote(){
  		//Get options
  		$options = $this->request('options','get');
  		//get anything else we need
  		$blah = $this->blah();
  		$etc = $etc->etc;
                
                $cost = $this->pickANumber();
  		
  		return json_encode($cost);  		
  	}



The original $method_data array returned by the module would need to contain an 'options' field to specify available options.

something like:

Code: Select all

  	$method_data = array(
    		'id'           => 'ordercost',
    		'title'        => $this->language->get('text_ordercost_title'),
    		'quote'        => $quote_data,
    		'tax_class_id' => $this->config->get('ordercost_tax_class_id'),
		'sort_order'   => $this->config->get('ordercost_sort_order'),
    		'error'        => false
                'options' => array(   
                                        'location'=>array(
                                                               'type'=>'select',
                                                               'options'=>array(
                                                                                     'UK_MAIN'=> 'UK Mainland',
                                                                                     'IRL_HIGH'=> 'Northern Irland and Scottish Isles')))                                                               
  	);


Which could be rendered by the checkout_shipping.tpl by using a foreach...

Code: Select all

  		foreach($method['options'] as $key=>$option){
  			switch($option['type']){
  				case 'select':
  				?>
  					<SELECT name="<?=$key?>">
						<?foreach ($option['options'] as $k=>$selectOption){?>	
							<option value="<?=$k?>"><?=$selectOption?></option>							
						<?}?>	  						
  				<?
  				break;
  			}

Or something like that....

The user could then select options and hit an update button, which submits a javascript function that grabs the form info and uses a HTTP Request to plonk it into the shipping->AjaxQuote() function.

Any of this make sense? Or am I rambling crap on a Monday morning :P

M

New member

Posts

Joined
Tue May 27, 2008 9:28 pm

Post by Qphoria » Tue Nov 04, 2008 12:19 am

mikeytrw wrote: we should have the ability to specify customer facing options in the checkout_shipping page, that update the price accordingly.

Any of this make sense? Or am I rambling crap on a Monday morning :P
What does "customer facing" mean? Is this another crazy UK/Aussie word?

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by mikeytrw » Tue Nov 04, 2008 12:44 am

What I mean by this is options on the checkout_shipping page after the cart, so the user can submit options to the shipping module to amend the shipping amount,

for example for shops in the uk a surcharge is added to customers living in northern ireland or scottish isles.

M

New member

Posts

Joined
Tue May 27, 2008 9:28 pm

Post by Qphoria » Tue Nov 04, 2008 12:53 am

eh.. i still don't get it.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by jty » Tue Nov 04, 2008 1:17 am

Qphoria wrote: What does "customer facing" mean?
This was also my first thought
Is this another crazy UK/Aussie word?
Be careful, you are outnumbered here  8)
mikeytrw wrote: for example for shops in the uk a surcharge is added to customers living in northern ireland or scottish isles.
Q, didn't you write a surcharge contribution last week or am I dreaming

jty
Active Member

Posts

Joined
Sat Aug 30, 2008 8:19 am

Post by mikeytrw » Tue Nov 04, 2008 7:11 pm

OK here's a JPG i've photoshopped up with what I mean.

I obviously didn't explain myself very well...

I want a customer to be able to change a shipping detail (ive just copied in a random tax zone select box but that could be anything US/Canada for example) and for the shipping price to update automatically on the fly - or once the customer clicks 'update' (negating the need for AJAX shenanigans).


Am I making more sense?

New member

Posts

Joined
Tue May 27, 2008 9:28 pm

Post by mikeytrw » Tue Nov 04, 2008 7:14 pm

upload folder full???

anyway heres a link on my server...
http://waracle.net/files/shipping_option.jpg

New member

Posts

Joined
Tue May 27, 2008 9:28 pm

Post by Qphoria » Tue Nov 04, 2008 8:48 pm

So you are saying:

Instead of a radio button for each shipping option, you'd rather have all the options inside a dropdown combo box on the shipping page?

This is a pretty simple styling change I think, but doesn't really give any new functionality does it?
You could probably just change all the radio buttons to combine them into 1 big select box in the tpl with little or no changes to the checkout_shipping.php controller file

If that is your site, then it looks like you already did what you want. So why not just release it as a contrib?

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by mikeytrw » Wed Nov 05, 2008 7:05 am

Hi, that is my site, but its a photoshop, otherwise i'd release it as a contrib :)
So you are saying:

Instead of a radio button for each shipping option, you'd rather have all the options inside a dropdown combo box on the shipping page?
No, once a radio button is selected, a number of options (can) appear to configur the shipping, so if you select weight based shipping, you are presented with a dropdown for USA or Canada (for example). As soon as you select one of the available options, the shipping cost updates it on the fly.

New member

Posts

Joined
Tue May 27, 2008 9:28 pm

Post by Qphoria » Wed Nov 05, 2008 7:17 am

ohhhh now I see what you are saying . this is actually something more suited to a single page checkout where you could choiose shipping and payment and the page would auto refresh either by post or ajax and return to the same singlee page.

this is planned as one of the first big new features for v0.8 and will have something like this. similar to the way the page updates the states when you choose a country on the account create screen

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by lev » Thu Nov 06, 2008 8:18 am

I get what you are saying mikey, and its very simple to do.

Just google XMLHTTP request and you will find how to add this functionality to the current checkout_shipping.tpl page.

lev
New member

Posts

Joined
Wed Apr 30, 2008 10:47 pm
Who is online

Users browsing this forum: Google [Bot] and 5 guests