Jump to content



Photo
* * * * * 5 votes

Simple Checkout - for 2.3.1 (official support thread)


  • Please log in to reply
364 replies to this topic

#1   fulluvscents

fulluvscents
  • Members
  • 305 posts
  • Real Name:Jetta
  • Gender:Female
  • Location:Fort Wayne, Indiana

Posted 07 February 2012 - 16:01

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

#2 ONLINE   burt

burt

    Vanquisher of Demons

  • Community Team
  • 9,536 posts
  • Real Name:G Burton
  • Gender:Male
  • Location:UK/DEV/on

Posted 07 February 2012 - 16:45

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?

Responsive osCommerce, join in the fun:
http://forums.oscomm...rom-the-get-go/

--
Making your shop better, one osCommerce module at a time - get in touch, or get my newsletter every 1st of the month.

 

Big Bang Templates for 2.3.4


#3   fulluvscents

fulluvscents
  • Members
  • 305 posts
  • Real Name:Jetta
  • Gender:Female
  • Location:Fort Wayne, Indiana

Posted 07 February 2012 - 16:57

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.

#4   fulluvscents

fulluvscents
  • Members
  • 305 posts
  • Real Name:Jetta
  • Gender:Female
  • Location:Fort Wayne, Indiana

Posted 07 February 2012 - 18:09

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

#5   oxwivi

oxwivi
  • Members
  • 250 posts
  • Real Name:Oxwivi Oxwil

Posted 07 February 2012 - 19:04

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.

#6   oxwivi

oxwivi
  • Members
  • 250 posts
  • Real Name:Oxwivi Oxwil

Posted 07 February 2012 - 19:23

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.

#7   bassmaga

bassmaga
  • Members
  • 29 posts
  • Real Name:Kamil
  • Gender:Male
  • Location:Poland

Posted 07 February 2012 - 19:30

I had a problem Call to undefined function fixSeoLink()

in checkout.php on top I added


function fixSeoLink($url){
return str_replace('&amp;', '&', $url);
}

Now I go testing it

#8   oxwivi

oxwivi
  • Members
  • 250 posts
  • Real Name:Oxwivi Oxwil

Posted 07 February 2012 - 19:48

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, 07 February 2012 - 19:49.


#9   fulluvscents

fulluvscents
  • Members
  • 305 posts
  • Real Name:Jetta
  • Gender:Female
  • Location:Fort Wayne, Indiana

Posted 07 February 2012 - 20:08

@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.

#10   bassmaga

bassmaga
  • Members
  • 29 posts
  • Real Name:Kamil
  • Gender:Male
  • Location:Poland

Posted 07 February 2012 - 20:18

@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.

#11   fulluvscents

fulluvscents
  • Members
  • 305 posts
  • Real Name:Jetta
  • Gender:Female
  • Location:Fort Wayne, Indiana

Posted 07 February 2012 - 20:33

@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, 07 February 2012 - 20:39.


#12   bassmaga

bassmaga
  • Members
  • 29 posts
  • Real Name:Kamil
  • Gender:Male
  • Location:Poland

Posted 07 February 2012 - 20:52

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

#13   varina

varina
  • Members
  • 36 posts
  • Real Name:Varina Schecter
  • Gender:Female
  • Location:The Dalles, OR

Posted 07 February 2012 - 21:27

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

#14   varina

varina
  • Members
  • 36 posts
  • Real Name:Varina Schecter
  • Gender:Female
  • Location:The Dalles, OR

Posted 07 February 2012 - 21:42

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!

#15   varina

varina
  • Members
  • 36 posts
  • Real Name:Varina Schecter
  • Gender:Female
  • Location:The Dalles, OR

Posted 07 February 2012 - 22:32

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

#16   fulluvscents

fulluvscents
  • Members
  • 305 posts
  • Real Name:Jetta
  • Gender:Female
  • Location:Fort Wayne, Indiana

Posted 08 February 2012 - 01:05

@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".

#17   oxwivi

oxwivi
  • Members
  • 250 posts
  • Real Name:Oxwivi Oxwil

Posted 08 February 2012 - 10:47

@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?

#18   fulluvscents

fulluvscents
  • Members
  • 305 posts
  • Real Name:Jetta
  • Gender:Female
  • Location:Fort Wayne, Indiana

Posted 08 February 2012 - 12:45

@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.

#19   oxwivi

oxwivi
  • Members
  • 250 posts
  • Real Name:Oxwivi Oxwil

Posted 08 February 2012 - 14:15

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, 08 February 2012 - 14:27.


#20   fulluvscents

fulluvscents
  • Members
  • 305 posts
  • Real Name:Jetta
  • Gender:Female
  • Location:Fort Wayne, Indiana

Posted 08 February 2012 - 14:24

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

@oxwivi
I will get back to you in a bit.