Post by saeed1000 » Fri Dec 13, 2013 11:41 pm

hello every one
Im using opencart 1.5.5.1 with simple free responsive theme
I have an Idea for skipping step 3. when i was trying to test guest payment i saw the chekbox in step 2 that skips step3. but in logged user or registerd user it dosent shown.
so i decide to use smiler way to let registered customers skip this step.
first of all i copy this code to line 89 of payment_address.tpl

Code: Select all

<?php if ($shipping_required) { ?>
<div style="clear: both; padding-top: 15px; border-top: 1px solid #DDDDDD;">
  <?php if ($shipping_address) { ?>
  <input type="checkbox" name="shipping_address" value="1" id="shipping" checked="checked" />
  <?php } else { ?>
  <input type="checkbox" name="shipping_address" value="1" id="shipping" />
  <?php } ?>
  <label for="shipping"><?php echo $entry_shipping; ?></label>
  <br />
  <br />
  <br />
</div>
<?php } ?>
there was errors so i remove first and last line of the code ind insert it again .
(still i have error Image )


step 2 : modifying checkout.tpl
replace line 406 to 428 with this code

Code: Select all

							$.ajax({
								url: 'index.php?route=checkout/shipping_address',
								dataType: 'html',
								success: function(html) {
									$('#shipping-address .checkout-content').html(html);
									***************************************************//;
								},
								error: function(xhr, ajaxOptions, thrownError) {
									alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
								}
							});
Every thing was OK but now the shipping methods disappears( no shipping option available .... Image )
I think if i can automaticly click on proceed button in virtual, all things will be ok
so i need a command to add in line **********************// in upper code to automaticly do as proceed button in shipping_address.tpl

checkout files are in attached file
please help me to complete this procedure.

Newbie

Posts

Joined
Wed Dec 11, 2013 4:04 am

Post by saeed1000 » Sun Dec 15, 2013 12:12 am

i need a command to add in line **********************// in upper code to automaticly do as proceed button in shipping_address.tpl

Newbie

Posts

Joined
Wed Dec 11, 2013 4:04 am

Post by saeed1000 » Wed Dec 18, 2013 1:40 am

Try using this code in checkout.tpl

Code: Select all

<?php if ($shipping_required) { ?>
				var shipping_address = $('#payment-address input[name=\'skip_shipping_address\']:checked').attr('value');
				if (shipping_address) {				
					$.ajax({
						url: 'index.php?route=checkout/shipping_method',
						dataType: 'html',
						success: function(html) {
							$('#shipping-method .checkout-content').html(html);
							
							$('#payment-address .checkout-content').slideUp('slow');
							
							$('#shipping-method .checkout-content').slideDown('slow');
							
							$('#payment-address .checkout-heading a').remove();
							$('#shipping-address .checkout-heading a').remove();
							$('#shipping-method .checkout-heading a').remove();
							$('#payment-method .checkout-heading a').remove();		
															
							$('#payment-address .checkout-heading').append('<a><?php echo $text_modify; ?></a>');	
							$('#shipping-address .checkout-heading').append('<a><?php echo $text_modify; ?></a>');									
							
							$.ajax({
								url: 'index.php?route=checkout/shipping_address',
								dataType: 'html',
								success: function(html) {
									$('#shipping-address .checkout-content').html(html);
								},
								error: function(xhr, ajaxOptions, thrownError) {
									alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
								}
							});
						},
						error: function(xhr, ajaxOptions, thrownError) {
							alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
						}
					});				
				} else {
					$.ajax({
						url: 'index.php?route=checkout/shipping_address',
						dataType: 'html',
						success: function(html) {
							$('#shipping-address .checkout-content').html(html);
						
							$('#payment-address .checkout-content').slideUp('slow');
							
							$('#shipping-address .checkout-content').slideDown('slow');
							
							$('#payment-address .checkout-heading a').remove();
							$('#shipping-address .checkout-heading a').remove();
							$('#shipping-method .checkout-heading a').remove();
							$('#payment-method .checkout-heading a').remove();
							
							$('#payment-address .checkout-heading').append('<a><?php echo $text_modify; ?></a>');	
						},
						error: function(xhr, ajaxOptions, thrownError) {
							alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
						}
					});
				}
				
			
code works well in graphic but in shipping method there is no shipping method
The check box in payment_address.tpl should be checked but it is not checked
I can not fined whee is the problem.

Newbie

Posts

Joined
Wed Dec 11, 2013 4:04 am

Post by saeed1000 » Fri Dec 20, 2013 4:06 pm

Please help.
any guidance any idea may solve the problem

Newbie

Posts

Joined
Wed Dec 11, 2013 4:04 am

Post by saeed1000 » Sat Jan 11, 2014 5:10 am

thank you saeed1000
the problem solved
the right code is below

Code: Select all

			<?php if ($shipping_required) { ?>
            var shipping_address = $('#payment-address input[name=\'shipping_address\']:checked').attr('value');
            if (shipping_address) {  
				$.ajax({
						url: 'index.php?route=checkout/shipping_address',
						dataType: 'html',
						success: function(html) {
						$('#shipping-address .checkout-content').html(html);
						$("#shipping-existing select").prop("selectedIndex", $("#payment-existing select").prop("selectedIndex"));
						$('#shipping-address #button-shipping-address').click();
						$('#shipping-address #button-guest-shipping').click();
						},
						error: function(xhr, ajaxOptions, thrownError) {
							 alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
						}
				});			
               $.ajax({
			       url: 'index.php?route=checkout/shipping_method',
                  dataType: 'html',
                  success: function(html) {
                     $('#shipping-method .checkout-content').html(html);
                     $('#payment-address .checkout-content').slideUp('slow');
                     $('#shipping-method .checkout-content').slideDown('slow');
                     $('#payment-address .checkout-heading a').remove();
                     $('#shipping-address .checkout-heading a').remove();
                     $('#shipping-method .checkout-heading a').remove();
                     $('#payment-method .checkout-heading a').remove();      
                     $('#payment-address .checkout-heading').append('<a><?php echo $text_modify; ?></a>');  
                     $('#shipping-address .checkout-heading').append('<a><?php echo $text_modify; ?></a>');                           
                  },
                  error: function(xhr, ajaxOptions, thrownError) {
                     alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
                  }
               });            
            } else {
               $.ajax({
                  url: 'index.php?route=checkout/shipping_address',
                  dataType: 'html',
                  success: function(html) {
                     $('#shipping-address .checkout-content').html(html);
                  
                     $('#payment-address .checkout-content').slideUp('slow');
                     
                     $('#shipping-address .checkout-content').slideDown('slow');
                     
                     $('#payment-address .checkout-heading a').remove();
                     $('#shipping-address .checkout-heading a').remove();
                     $('#shipping-method .checkout-heading a').remove();
                     $('#payment-method .checkout-heading a').remove();
                     
                     $('#payment-address .checkout-heading').append('<a><?php echo $text_modify; ?></a>');   
                  },
                  error: function(xhr, ajaxOptions, thrownError) {
                     alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
                  }
               });
            }





still error of display in first code
Image

Newbie

Posts

Joined
Wed Dec 11, 2013 4:04 am

Post by saeed1000 » Sun Jan 26, 2014 5:00 am

Hello
The project has been finished successfully and new customized Checkout Module (based on opencart default checkout) will be available here for test.
You cat make it compatible wit your theme.
In next two day I will upload the module .
test it but before testing backup your files

Newbie

Posts

Joined
Wed Dec 11, 2013 4:04 am

Post by saeed1000 » Sun Jan 26, 2014 7:12 pm

Hello
Download link is below . plaese download the module and try this checkout.
upload checkout.zip in to the root of opencart installation folder and extract it.
This checkout will be active on default theme . below I wrote a simple way to installing and removing the module easily.

installation :
1-upload the file to the root
2-go to ../catalog/controller and rename "checkout" folder to "checkout---"
3-go to ../catalog/theme/default/template and rename "checkout" folder to "checkout---"
4- extract checkout.zip

removing :
2-go to ../catalog/controller and delete the "checkout" folder then rename "checkout---" folder to "checkout"
3-go to ../catalog/theme/default/template and delete the "checkout" folder then rename "checkout---" folder to "checkout"

At the end try it in local then install in your site.

Newbie

Posts

Joined
Wed Dec 11, 2013 4:04 am
Who is online

Users browsing this forum: Amazon [Bot] and 15 guests