Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Can someone check my code for me?


Guest

Recommended Posts

I want to change the end of create_account_process.php so that it will go to create account success if the shopping cart is empty, and if they have something in their account, ie. they have been prompted to create an account because they want to go through checkout, to be taken straight to checkout shipping. Will this do it?

 

Change:

tep_redirect(tep_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS, '', 'SSL'));

 

to:

if ($cart->count_contents() < 1) { 

   tep_redirect(tep_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS, '', 'SSL')); 

 } 

if ($cart->count_contents() => 1) { 

   tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); 

 }

 

TIA

Link to comment
Share on other sites

looks ok to me - although I would do this instead

 

if ($cart->count_contents() > 0) {

    tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); 

    } else {

    tep_redirect(tep_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS, '', 'SSL')); 

    }

 

firstly it will be faster - and it isn't good practice to not have a default place to redirect.

Link to comment
Share on other sites

Great, thank you. I nicked it from another part of the software, changed the link and wasn't sure if I had got it quite right. I will put in what you said. :D

Link to comment
Share on other sites

Cool - works fine. Was getting parse errors at first but I had accidentally deleted the } after the bit I replaced. Once I realised and put it back, it was OK.

 

Thanks again. :D

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...