Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Using osCommerce with 1 product


rezonat0r

Recommended Posts

First off, a big thanks to the osCommerce devs and community.

I have an installation up and running but before I go further...

 

Initially I will be using osC to sell just 1 product. So, when someone clicks "Order Now", the next thing they should see is the page for entering shipping details. No registration, etc.. How's that for bypassing 98% of the functionality? :)

 

I've looked at the PWA (Purchase Without Account) module, but it appears that will still SHOW the user a choice of creating an account.

 

So, is it possible with one "Order" button to tell osC to add the product to the cart, skip registration, and go straight to shipping info?

 

Thanks.

Link to comment
Share on other sites

As far as I know there is nothing that puts a product in the cart and goes directly to the check out but you can shorten the checkout process a couple of ways.

 

1. Get the purchase with one click contribution (would have to uninstall the PWA though I think.

http://www.oscommerce.com/community/contributions,2197

 

2. Use the code below to shorten the process. It can be used with PWA. Just takes a couple of steps out of the process

 

Open up checkout_payment.php and find:

 

CODE

// if the customer is not logged on, redirect them to the login page

if (!tep_session_is_registered('customer_id')) {

$navigation->set_snapshot();

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

}

 

Change it to:

 

CODE

// if the customer is not logged on, redirect them to the login page

if (!tep_session_is_registered('customer_id')) {

$navigation->set_snapshot();

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

}

 

Then:

 

In checkout_shipping.php change:

 

CODE

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

 

 

To:

 

CODE

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

 

 

and if you want to get rid of the "Account Created Success" window that pops up after they create their account do this:

 

In create_account.php

 

Change

CODE

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

 

to

 

CODE

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

 

 

 

 

 

 

 

 

 

 

 

 

First off, a big thanks to the osCommerce devs and community.

I have an installation up and running but before I go further...

 

Initially I will be using osC to sell just 1 product.  So, when someone clicks "Order Now", the next thing they should see is the page for entering shipping details.  No registration, etc..  How's that for bypassing 98% of the functionality?  :)

 

I've looked at the PWA (Purchase Without Account) module, but it appears that will still SHOW the user a choice of creating an account.

 

So, is it possible with one "Order" button to tell osC to add the product to the cart, skip registration, and go straight to shipping info?

 

Thanks.

Wendy James

 

Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.

Link to comment
Share on other sites

As far as I know there is nothing that puts a product in the cart and goes directly to the check out but you can shorten the checkout process a couple of ways.

 

1. Get the purchase with one click contribution (would have to uninstall the PWA though I think.

http://www.oscommerce.com/community/contributions,2197

 

2. Use the code below to shorten the process. It can be used with PWA. Just takes a couple of steps out of the process

 

Open up checkout_payment.php and find:

 

CODE

// if the customer is not logged on, redirect them to the login page

if (!tep_session_is_registered('customer_id')) {

$navigation->set_snapshot();

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

}

 

Change it to:

 

CODE

// if the customer is not logged on, redirect them to the login page

if (!tep_session_is_registered('customer_id')) {

$navigation->set_snapshot();

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

}

 

Then:

 

In checkout_shipping.php change:

 

CODE

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

To:

 

CODE

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

and if you want to get rid of the "Account Created Success" window that pops up after they create their account do this:

 

In create_account.php

 

Change

CODE

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

 

to

 

CODE

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

 

in application_top you can also change this:

 

if (DISPLAY_CART == 'true') {

$goto = FILENAME_SHOPPING_CART;

$parameters = array('action', 'cPath', 'products_id', 'pid');

 

} else {

$goto = basename($PHP_SELF);

if ($_GET['action'] == 'buy_now') {

$parameters = array('action', 'pid', 'products_id');

} else {

$parameters = array('action', 'pid');

}

}

 

to this :

 

if (DISPLAY_CART == 'true') {

$goto = FILENAME_SHOPPING_CART;

$parameters = array('action', 'cPath', 'products_id', 'pid');

} else {

if ($_GET['action'] == 'buy_now') {

$goto = FILENAME_CHECKOUT_SHIPPING;

$parameters = array('action', 'pid', 'products_id');

} else {

$goto = basename($PHP_SELF);

$parameters = array('action', 'pid');

}

}

 

which means that when pressing the buy_now button, you go directly to checkout bypassing the shopping cart or the product_info page if DISPLAY_CART is set to false.

Treasurer MFC

Link to comment
Share on other sites

Thanks! All of this looks easy and helpful. I know osCommerce is overkill for this particular site, but I guess this is a test to see how well it scales - in the downward direction.

 

I'm thinking that most of my site will be external from osCommerce - so the user will only be in osC world after they hit an "order now" button. Is there something special I should do for this link that will tell osCommerce to auto add The Product and proceed to checkout ASAP?

 

As we all know, every click the user has to make is one more reason to not complete the sale... Thanks again.

Link to comment
Share on other sites

Actually, quite a few people use osCommerce to sell 10 or less products. I have made one site for someone who only sells one product.

 

osCommerce is great no matter how many you have. :)

Good luck!

Wendy James

 

Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.

Link to comment
Share on other sites

I found if you add this line to shorten the checkout. you have to know what product you are going to sell them. Great for membership websites. They have to buy no matter what. The 1 is referencing the product id.

 

$cart->add_cart('1', $cart->get_quantity(tep_get_uprid('1', '1'))+1, '1');

to the catalog/create_accunt_php some where near the end you can chage all the 1's exept the +1 i guess thats quantity to the shopping cart straight from the info filling screen

like this :

change the line tep_redirect(tep_href_link(),",'SSL')); so that it looks for : FILENAME_CHECKOUT_PAYMENT instead of the success file.

$cart->add_cart('1', $cart->get_quantity(tep_get_uprid('1', '1'))+1, '1');	
? ? ?tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
? ?}
?}

?$breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL'));

?$content = CONTENT_CREATE_ACCOUNT;

?require(DIR_WS_TEMPLATES . TEMPLATENAME_MAIN_PAGE);

?require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

Link to comment
Share on other sites

Hmm, that was probably a stupid question! Am I right in thinking that from my external site, I could like to the product id, and include:

 

&action=buy_now

 

in the URL, and if DISPLAY_CART=false, the user goes right to checkout?

Link to comment
Share on other sites

First off, a big thanks to the osCommerce devs and community.

I have an installation up and running but before I go further...

 

Initially I will be using osC to sell just 1 product.  So, when someone clicks "Order Now", the next thing they should see is the page for entering shipping details.  No registration, etc..  How's that for bypassing 98% of the functionality?  :)

 

I've looked at the PWA (Purchase Without Account) module, but it appears that will still SHOW the user a choice of creating an account.

 

So, is it possible with one "Order" button to tell osC to add the product to the cart, skip registration, and go straight to shipping info?

 

Thanks.

 

There are two ways to do this:

ONe way is to block the following lines in all the pages:

if (!tep_session_is_registered('customer_id')) {

$navigation->set_snapshot();

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

}

 

This but will still create some probs

The second way is place a code within index.php that will by default register a dummy new registration in your data base and that member detail is used theu out.

Though you need to hid eall the related display and the related emails that atke all these values.

 

Satish Mantri

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Link to comment
Share on other sites

Thanks pecanhouse, that looks good.

 

boxtel:  Thanks, that bit of code looks key.  When you say the "buy_now" button, could this be a button that is external from osCommerce?

 

well, buy_now is simply the action parameter which is picked up in application top.

there it adds the product to the cart and either redirects to the page you were on or the shopping cart depending on that DISPLAY_CART setting in admin.

The code I gave you would bypass that and go directly to checkout shipping.

 

So yes, you could add that parameter in the url from external and it will add the product to the cart and go directly to checkout BUT in checkout shipping, if the user is not signed in, it will redirect you right back to login or (with PWA) to the order information page.

And this should be as you need to know who the person is and where the product needs to go.

Treasurer MFC

Link to comment
Share on other sites

I think I've found a solution! These were all good suggestions, each came ever so close and all provided good clues.

 

I like the Alternative Checkout contrib (a.k.a. Purchase with one click) because it combines several checkout pages (something i think should be seriously considered for MS3), but it does still require the user to have an existing login and mess around with passwords.

 

So here's what I ended up doing.

 

1. Start with a stock osC 2.2 MS2 install.

2. Install the Guest Account v2.2 contrib.

http://www.oscommerce.com/community/contri...ll/search,guest

 

3. In Admin | Configuration | My Store, set "display cart after adding product" to FALSE.

4. In the file \includes\application_top.php, starting at line 318,

REPLACE:

    if (DISPLAY_CART == 'true') {
     $goto =  FILENAME_SHOPPING_CART;
     $parameters = array('action', 'cPath', 'products_id', 'pid');
   } else {
     $goto = basename($PHP_SELF);
     if ($HTTP_GET_VARS['action'] == 'buy_now') {
       $parameters = array('action', 'pid', 'products_id');
     } else {
       $parameters = array('action', 'pid');
     }
   }

WITH:

    if (DISPLAY_CART == 'true') {
     $goto =  FILENAME_SHOPPING_CART;
     $parameters = array('action', 'cPath', 'products_id', 'pid');
   } else {
 if ($_GET['action'] == 'buy_now') {
	 $goto = FILENAME_CREATE_ACCOUNT;
	 $parameters = array('action', 'pid', 'products_id');
 } else {
	 $goto = basename($PHP_SELF);
	 $parameters = array('action', 'pid');
 }
}

5. In create_account.php, line 19,

----------

REPLACE:

if (isset($HTTP_GET_VARS['guest_account'])) $guest_account = true;

WITH:

$guest_account = true;

This forces ALL accounts to be guest.

 

When I link to a product in osC with "action=buy_now" in the URL, the next screen is the modified registration page, which now says "Enter Your Shipping Address" instead of "Create Account", and hides all knowledge of passwords, newsletters, etc. from the user. There are no "Account Created" screens or emails sent out, just good ole' purchasing screens from then on.

 

Works for me! :)

 

Now, what I would REALLY like to do for others, is let them avoid Step 5 (hard coding all accounts to be guest). But my knowledge of PHP is not great enough and I don't know how to add a "guest_account=true" parameter to the URL in this part of Step 4:

 	 $goto = FILENAME_CREATE_ACCOUNT;
	 $parameters = array('action', 'pid', 'products_id');

 

Maybe someone can help clean this up?

 

Anyhow, I think this is enough fun for one day. Gotta love OSS, there's so many ways to do things. And so little time. :P

Link to comment
Share on other sites

  • 2 weeks later...

Wendy, can you post a link to the one product store you refer to? And any others you know of?

 

Thanks

 

scottob

Actually, quite a few people use osCommerce to sell 10 or less products. I have made one site for someone who only sells one product.

 

osCommerce is great no matter how many you have. :)

Good luck!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...