fulluvscents

Simple Checkout - for 2.3.1 (official support thread)

368 posts in this topic

It will be contributed soon. Moving the conversation here in anticipation of that.

Share this post


Link to post
Share on other sites

Some add-on contributors make their addon dependant on other addons, so to use X you have to install Y.

 

Wondering if yours has any dependancy on other addons?

Share this post


Link to post
Share on other sites

No. It is a standalone add-on written for stock osc.

 

It will work on it's own with any stock mods, but as of yet, it is not compatible with other custom add ons (except the USPS mod that I recently contributed). As compatibility packs become available they will be contributed as exactly that - compatibility packs. They will be optional and suited to fit other contributions, but will never be a core part of this contribution.

Share this post


Link to post
Share on other sites

So, just as I thought I had everything 100% complete, I ran into a bug and my heart sank. You know that feeling when you think you're done and find out you aren't. Yeah. Well, three line deletions, and we are good to go.

 

The only questions remaining are whether there are any server compatibility issues. Let me know what you run into.

 

http://addons.oscommerce.com/info/8338

Share this post


Link to post
Share on other sites

The description on the Addon page is quite lacking. Other than the followers of One Page Checkout for 2.3.1, nobody would know what's this all about. It'd be a shame if they missed this crazy good stuff.

Share this post


Link to post
Share on other sites

I'm successfully using Minimum Product Quantity addon (originally for 2.2) on oSC 2.3.1 with modifications in the stock checkout.php file. The following is the code I needed in the stock checkout:

 

//Minimum quantity code
   if(MINIMUM_ORDERS == 'true'){
  $min_order_query = tep_db_query("select p.minorder as min_quant FROM " . TABLE_PRODUCTS . " p where p.products_id = '".$products[$i]['id']."'");
while ($min_order = tep_db_fetch_array($min_order_query))  {
  if ($products[$i]['quantity'] < $min_order['min_quant'] ) {
  $products[$i]['min_quant']=$min_order['min_quant'];
  }
}
 if ($products[$i]['quantity'] < $products[$i]['min_quant'] ) {
  $products[$i]['quantity']=$products[$i]['min_quant'];
 $cart->add_cart($products[$i]['id'],$products[$i]['quantity'],$products[$i]['attributes']);
 $cart_notice = sprintf(MINIMUM_ORDER_NOTICE, $products[$i]["name"], $products[$i]["min_quant"]);
}
}
//End Minimum quantity code
//Minimum quantity code
   if ($cart_notice) {
?>
    <p class="stockWarning" align="center"><?php echo $cart_notice; ?></p>
<?php
  }
//End Minimum quantity code

 

Think it can go into your Simple Checkout? I am struggling to understand the structure due it's sheer size. My lasting gratitude for your hard work.

Share this post


Link to post
Share on other sites

I had a problem Call to undefined function fixSeoLink()

 

in checkout.php on top I added

 

 

function fixSeoLink($url){

return str_replace('&', '&', $url);

}

 

Now I go testing it

Share this post


Link to post
Share on other sites

Uh, ignore my previous post, thank you (that was for shopping_cart.php, not checkout). But since this checkout includes the ability to change quantity, I still need a way to enforce MOQ.

Edited by oxwivi

Share this post


Link to post
Share on other sites

@@bassmaga

 

fixSEO link is not needed.

 

NOTE: There is a conflict with the old OPC that I didn't think about. EVERYTHING from the template top file, that pertains to checkout.php needs to be removed.

 

And while you're at it, undo whatever you did to the checkout.php file.

 

@@oxwivi

 

You can disable the ability to change quantity, or it can be modified to work. Up to you. Looks like an easy change.

 

Yes, the description is lacking. I'm just glad to have this thing done. Have you seen the number of views that the other forum thread got? This forum is what leads people to what they're looking for. Since you can't see number of downloads from the contribution area, the forum is the next best guess at what works and what doesn't and what everyone else is relying on. I'm okay with it.

Share this post


Link to post
Share on other sites

@@fulluvscents

 

@@bassmaga

 

fixSEO link is not needed.

 

NOTE: There is a conflict with the old OPC that I didn't think about. EVERYTHING from the template top file, that pertains to checkout.php needs to be removed.

 

And while you're at it, undo whatever you did to the checkout.php file.

 

Thanks.

Share this post


Link to post
Share on other sites

@@oxwivi

 

Try this and if it works, then I need a link for the contribution that it goes to.

Find:

  else foreach($_POST['qty'] as $pID => $qty) {$cart->update_quantity($pID, $qty, $_POST['attr'][$pID]);}

Replace with:



//Minimum quantity code
else
{
foreach($_POST['qty'] as $pID => $qty)
{
if(MINIMUM_ORDERS == 'true')
{
$min_order_query = tep_db_query("select minorder, products_name from " . TABLE_PRODUCTS . ", p left join " . TABLE_PRODUCTS_DESCRIPTION . ", pd on p.products_id = pd.products_id where products_id = '". $pID ."'");
while ($min_order = tep_db_fetch_array($min_order_query))
if ($qty < $min_order['minorder'])
{
$qty=$min_order['minorder'];
$return['msg'] = sprintf(MINIMUM_ORDER_NOTICE, $min_order['products_name'], $min_order['minorder']);
$return['status'] = 'warning';
}
}
$cart->update_quantity($pID, $qty, $_POST['attr'][$pID]);
}
}
//End Minimum quantity code

Find:

cartUpdate: function()
 {
 var pID = $(this).attr('data-pID');
 $.ajax(
  {
  data: 'action=cartUpdate&' + decodeURIComponent($('#cartContent').find('[name^=qty[' + pID + ']], [name^=attr[' + pID + ']]').serialize()),
  success: function(data)
{
if (data.products == 0) {window.location = '<?php echo tep_href_link(FILENAME_SHOPPING_CART, '', 'SSL');?>';return false;}
else
 {
 checkout.cartRefresh();
 checkout.headerShortcutsRefresh();
 checkout.colsRefresh();
 checkout.totalsRefresh();
 checkout.RowsRefresh('payment');
 if (data.shipping == 'false') $('#shipping').hide();
 else  {$('#shipping').show(); checkout.RowsRefresh('shipping');checkout.AddressRefresh('shipping');}

Add After:

//Minimum quantity code
 if (data.msg != '') checkout.errMessage(field, data.status, data.msg);
//Minimum quantity code

 

EDITED : To Add brackets. Won't work without those brackets.

Edited by fulluvscents

Share this post


Link to post
Share on other sites

I found issue. When I have 1 shipping method or 1 payment method to choose and it is default checked I must check it again to make order (and I dont have any error message)

 

How can I set default country? When I set it in tep_get_country_list() doesn't result.

 

regards

Share this post


Link to post
Share on other sites

I installed the module, and it looks great. However with my UPS shipping module I needed to change the stock checkout_shipping.php page to include this code for dimensional support:

 

// BOF changes for adding class packing
 if (defined('SHIPPING_DIMENSIONS_SUPPORT') && SHIPPING_DIMENSIONS_SUPPORT == 'Ready-to-ship only') {
   $dimensions_support = 1;
 } elseif (defined('SHIPPING_DIMENSIONS_SUPPORT') && SHIPPING_DIMENSIONS_SUPPORT == 'With product dimensions') {
   $dimensions_support = 2;
 } else {
   $dimensions_support = 0;
 }

 if ($dimensions_support > 0) {
   require(DIR_WS_CLASSES . 'packing.php');
   $packing = new packing;
 }
// EOF changes for adding class packing

 

I browsed through your checkout.php file and have no idea if I can insert this code somewhere or not. (I am not a php programmer, so I am not sure where to look...)

 

Without the dimensional support the shipping quotes seem to be correct.

 

Any ideas if this snippet can be added to your code?

 

Thanks so much for tackling this project.

 

Varina

Share this post


Link to post
Share on other sites

Ugh...never mind I found the right spot to put the code. It was right at the beginning...silly me...

 

Now it works just fine!

Share this post


Link to post
Share on other sites

Issues I have found testing this contribution on my store:

 

When creating a new account, gender, and DOB are in the dialog box even though they are set to false in my admin. (note: suburb is also checked false, and it is not showing up)

 

When logged in and attempting to edit an address or enter a new address for shipping and/or billing, gender and suburb show up.

 

Not major issues, but ones I wouldn't mind fixing.

 

Thanks.

 

Varina

Share this post


Link to post
Share on other sites

@@bassmaga

Where is your shop? I'll look at the radio buttons. If the radio is checked, it should be autosetting the method. I think I might have set shipping, but not payment.

 

You can hardcode the default country very simply. There are two similar or matching lines of code at the bottom of the checkout.php page. Replace the first set of single quotes with the country id (shown as ### in the snippet below) without quotes around it. You can find that either in your database or by going to countries in your admin, then clicking on the country. Look in your browser address for cID=### That is the country id.

 

 <p><?php echo ENTRY_COUNTRY . '<br>' . tep_get_country_list('country', ###, (tep_not_null(ENTRY_COUNTRY_TEXT) ? ' class="required"' : '')); ?></p>

 

@@varina

 

I'll look at those form fields, but it probably won't be until tomorrow morning. I'd prefer to fix them than settle on "good enough".

Share this post


Link to post
Share on other sites

@@fulluvscents, I modified it as you asked. And now, either increasing or decreasing the quantity at checkout shows the loading overlay and pops a small dialog box with:

Error: parsererror

 

And doesn't change anything (the price remains the same, and navigating away from checkout doesn't show any indication that the quantity was changed).

 

Regarding the addon link, MPQ is actually a 2.2-compatible addon that I managed to make it work on 2.3.1. It also has an admin panel and stuff that I didn't need so not tested. I'll release my modified instructions in the forums sometime later (and hopefully others interested in it will test the other bits).

 

Just a passing idea.The cart area of the checkout is an excellent piece of work in and of itself. Could it be made to replace the stock shopping cart as well? Only the cart area with all the products will appear with a checkout button. Clicking the checkout button would overlay the login box and then the rest of the stuff would appear below.

 

The prices calculations are shown as part of the cart. But the shipping options and address that can affect the calculations are below it. While I can't suggest a better position, it should be given a bit of thought.

 

Lastly, there are some places where there's only one relevant button - like the Confirm button for logging in and the Confirm Order button at the checkout. Since these are always aligned to the right, it gives the impression that there's some other button which is missing (especially at the log in since the button is not fully aligned). Can't we center align them?

Share this post


Link to post
Share on other sites

@@oxwivi

It was an sql error. Try this instead.

 

//Minimum quantity code
  else
{
foreach($_POST['qty'] as $pID => $qty)
 {
 if(MINIMUM_ORDERS == 'true')
  {
  $min_order_query = tep_db_query("select minorder, products_name from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id where p.products_id = '". $pID ."'");
  while ($min_order = tep_db_fetch_array($min_order_query))
  if ($qty < $min_order['minorder'])
   {
   $qty=$min_order['minorder'];
   $return['msg'] = sprintf(MINIMUM_ORDER_NOTICE, $min_order['products_name'], $min_order['minorder']);
   $return['status'] = 'warning';
   }
  }
 $cart->update_quantity($pID, $qty, $_POST['attr'][$pID]);
 }
}
//End Minimum quantity code

 

Yes, the alignment of the buttons can be changed. The classes are defined within the <style> tag and can be modified to suit your needs. To center, try the following, replacing commented lines with new lines below.

 

 

//<div id="accountButton" class="right padrght50 hidden"><?php echo tep_draw_button(IMAGE_BUTTON_CONFIRM, 'triangle-1-e', '', 'primary'); ?></div>
<div id="accountButton" class="t-center hidden"><?php echo tep_draw_button(IMAGE_BUTTON_CONFIRM, 'triangle-1-e', '', 'primary'); ?></div>

 

 


//<div id="processCheckout" class="contentText hidden">
//<div class="right"><?php echo tep_draw_button(IMAGE_BUTTON_CONFIRM_ORDER, 'check', null, 'primary'); ?></div>
<div id="processCheckout" class="contentText hidden t-center">
<?php echo tep_draw_button(IMAGE_BUTTON_CONFIRM_ORDER, 'check', null, 'primary'); ?>

 

Sure the stock shopping cart could be replaced with the cart area of checkout. But, I think it would be a lot easier to simply replace the shopping cart section itself with the ajax cart, and leave the checkout button as is, so that when it's clicked it goes to the checkout. What you're talking about is essentially changing the shopping cart to the checkout, merging the two as one.

 

SHOPPING CART

If someone goes to cart, then the cart would show. When they click the checkout button, the checkout button would disappear and the rest of the checkout would proceed as normal. If not logged in, the cart would be overlain with the login box (but wouldn't disappear). If already logged in, then the rest of the checkout page with shipping/payment, etc, would magically appear below the cart. Yes, I like that and it could be done, although it would take a bit of thought to make it work the way it should and not like some hack job.

 

CHECKOUT

If on the other hand, they click on checkout, then it would be the checkout that we have, nothing different.

 

It's the merge that I would have difficulty with. Why not just replace the shopping cart with the ajax cart, and leave the checkout button (and express payment buttons) as is, and let it redirect to the checkout. Now, if you wanted it to be a bit smoother, you could leave the cart visible under the login dialog, but the dialog would need to be modal with an option to close the dialog, and the close "x" would need to redirect them back to the shopping cart. Something about letting the customer make changes to the cart, and running ajax, under an open dialog doesn't settle well with me.

 

Some people have different shopping carts. For example, I plan on allowing customers to change their attributes from the cart on the shopping cart page, but not on the checkout page. Some people have a quick shipping quote in their shopping cart (obtained from selecting country/state/postcode only). So, merging the two would not work for anyone who has customized options in their cart, and thus would not be a universally usable feature. But simply replacing the shopping cart wouldn't be much of an issue, since it would be a distinctly separate add-on.

 

A thought for me to ponder.

Share this post


Link to post
Share on other sites

Now all the regular quantity functions (increase, decrease) is working fine except when it comes to MPQ. When the usual functions, that does not touch upon the minimum limits, is performed, the processing overlay appears and makes the expected changes. When the quantity entered is below MOQ, the loading overlay appears and restores the quantity to the minimum after a few moments. But the loading overlay doesn't disappear and remain stuck there. The only thing I can do is refresh.

 

Thanks for the button changers. Working great. To me it looks way better.

 

I'm not much of a coder, so my ideas were just that - ideas. Did not suggest a method of implementation. I welcome whatever works best.

 

That said, my idea of how it would work was having the Ajax-based elements in a separate file, while the shopping cart/checkout page pulls in/refers to the relevant section it's displaying. (Instead of code replication in both shopping_cart and checkout)

 

Anyway, I'm guessing my idea has received a measure of acceptance on your part. Here's hoping something comes out of it. If applying your Ajax-based shopping cart is as straightforward as copying a bunch of lines from checkout.php along with some minor modifications, then I'll put it to good use immediately.

Edited by oxwivi

Share this post


Link to post
Share on other sites

@@varina

Just uploaded a couple fixes (cart quantities and optional form fields).

 

@@oxwivi

I will get back to you in a bit.

Share this post


Link to post
Share on other sites

@@oxwivi

 

Let's start with defining MINIMUM_ORDER_NOTICE in your checkout.php language file and tell me what that definition is

Share this post


Link to post
Share on other sites

Found it.

Change the second snippet of code to this. Also be sure to do the language define.

 

//Minimum quantity code
        if (data.msg != '') checkout.errMessage(data.status, data.msg);
//Minimum quantity code

Share this post


Link to post
Share on other sites

Yes, it's working. But the warning only says:

undefined undefined

 

Probably because define says:

define('MINIMUM_ORDER_NOTICE', "Minimum order amount for %s is %d. Your cart has been updated to reflect this.");

 

How can I define those variables at checkout? (%s is product name, and %d is the MOQ)

Edited by oxwivi

Share this post


Link to post
Share on other sites

By the way, editing or adding new address at the checkout.php also gives the ability to edit/add name, gender, etc. Is there any specific reason for this? In any case, those details are not shown either at the checkout page or when choosing between different addresses.

Share this post


Link to post
Share on other sites

Jetta,

 

The modifications to the checkout.php fixed my field issues. Thank you so much. You rock!

 

There are some styling changes I would like to do, but I am not sure where in the code I need to look. Could you point me in the right direction?

 

For our customers I would like to add some text to the top of the dialog boxes, above password forgotten, click here etc...

I would also like to remove the newsletter check box (we don't have a newsletter).

And change the name of the button from confirm to sign in.

I assume the color and style of the dialog boxes are near the bottom under <style>. Is there a way to call our jquery theme into the styling of the dialog? I noticed when logged in the change address or new address pulls up a different looking box that goes with my theme.

 

Also I noticed that the checkout breadcrumb isn't showing up in the header bar. Not a big deal but something I noticed.

 

Thank you so much for all your hard work!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now