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

#21   fulluvscents

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

Posted 08 February 2012 - 14:30

@oxwivi

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

#22   fulluvscents

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

Posted 08 February 2012 - 14:40

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


#23   oxwivi

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

Posted 08 February 2012 - 15:12

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, 08 February 2012 - 15:19.


#24   oxwivi

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

Posted 08 February 2012 - 15:30

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.

#25   varina

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

Posted 08 February 2012 - 17:53

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!

#26   PiLLaO

PiLLaO
  • Members
  • 159 posts
  • Real Name:Gustavo

Posted 09 February 2012 - 08:53

Great addon!! /smile.png' class='bbc_emoticon' alt=':)' />

Delete button doesn't show confirm dialog, it would be a good idea to do this.


- would work in osc 2.2?

Regards!

#27   fulluvscents

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

Posted 09 February 2012 - 14:36

@PiLLaO No, there is no way this would work in 2.2
Delete button doesn't show confirm dialog
I'm not sure where or what you are referring to. There are a few dialogs.

@oxwivi You may want to change the entire language. My server has been down for some time so I can't even get into mess with anything.
Right now you have:

$return['msg'] = sprintf(MINIMUM_ORDER_NOTICE, $min_order['products_name'], $min_order['minorder']);
and
define('MINIMUM_ORDER_NOTICE', "Minimum order amount for %s is %d. Your cart has been updated to reflect this.");
Try doing this:
$return['msg'] = MINIMUM_ORDER_NOTICE1 . $min_order['products_name'] . MINIMUM_ORDER_NOTICE2 . MINIMUM_ORDER_NOTICE3 . $min_order['minorder']
and
define('MINIMUM_ORDER_NOTICE1', "Minimum order amount for ");
define('MINIMUM_ORDER_NOTICE2', " is ");
define('MINIMUM_ORDER_NOTICE3', ". Your cart has been updated to reflect this.");
I'm not sure if it's the sprint that's not being defined, or the data.msg that's not being defined. Could be the spring isn't passing through the ajax call.
@varina
The dialog boxes are id'd as account and addresses. So search id="account" and id="addresses" without searching case sensitive. Those are your dialog divs (at the very bottom of the page). Add a new div directly inside those divs, containing the content you want and it will place it directly above the rest of the dialog.

Search the page for 'newsletter' and comment out the entire line that contains that field (I think there's only one line).

open the language/checkout.php file, search "confirm" and change it to what you want. Here's the problem though. As I stated, that button is stationary. It is the submit button for login, create account AND checkout as guest. Same button for all three. That's why I defined it as confirm (continue or submit are other options), rather than log in.

Search the checkout.php file for a line that contains something to the effect of $('.ui-dialog-.......).addClass('ui-state-highlight'); about 3/4 of the way down the page, and comment that line out. It will change the dialog to match your theme.

Edited by fulluvscents, 09 February 2012 - 14:38.


#28   PiLLaO

PiLLaO
  • Members
  • 159 posts
  • Real Name:Gustavo

Posted 09 February 2012 - 16:30

@fulluvscents when you are in checkout.php you can modify products quantity or delete pushing the red cross. If you push the red cross the product is delete directly, but if you push this cross for error... the product is delete form cart. would be interesting to show a dialog to confirm you want to delete this product.

Regards!!

#29   fulluvscents

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

Posted 09 February 2012 - 16:36

Ok. I actually considered that too. Might add it in.

#30   oxwivi

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

Posted 09 February 2012 - 17:24

@fulluvscents, still the same undefined error. I tried a few things myself, with the same results. This crazy, there's no error in the code, and yet... argh!

By the way, that wasn't quite language friendly. Not that I use anything other than English...

#31   oxwivi

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

Posted 09 February 2012 - 18:02

Okay, so I did more trials that are sensible and may help conclusively eliminate sources of error:
  • I removed $min_order['products_name'] and $min_order['minorder'] along with their references in languages file. Still undefined error.
  • Removed all variables and done this: $return['msg'] = sprintf("Your cart has been updated, etc."); Still the same error.
With this tries I was thinking to include a standard, variable-free message and add a column with MOQ. But as you can see the error is beyond me. Hope this helps. I can give you access to my account's cPanel where I'm hosting the test osC if it will help you.

#32   fulluvscents

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

Posted 09 February 2012 - 19:40

Oh, not nearly language friendly. But, worth testing. I'll play with it in a bit.

#33   varina

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

Posted 10 February 2012 - 03:21

Question about changing code from checkout_confirmation.php

I am using Paypal, and I need to change some code in the above file to make my product titles show up instead of my store name.

With the mod, checkout_confirmation.php is by passed.

I can't seem to find any code in your checkout.php that is similar to the parts I need to modify.

Here is what I need to do. It is pretty simple, but I am stumped.

2- Open catalog/checkout_confirmation.php

Find:
-----
  require('includes/application_top.php');

Add after:
----------
  $_SESSION['FixOrder'] = "";

Find: (Put the entire sentence because there are two equal sentences, the last)
-----
<?php
  } else {
?>
				  <tr>
				    <td class="main" colspan="3"><?php echo '<b>' . HEADING_PRODUCTS . '</b> <a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '"><span class="orderEdit">(' . TEXT_EDIT . ')</span></a>'; ?></td>
				  </tr>
<?php
  }
  for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {

Add after:
----------
   $_SESSION['FixOrder'] =  $_SESSION['FixOrder'] . $order->products[$i]['name'] . " x " . $order->products[$i]['qty'] . " ";

Find:
-----
    if ( (isset($order->products[$i]['attributes'])) && (sizeof($order->products[$i]['attributes']) > 0) ) {
	  for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
	    echo '<br><nobr><small>&nbsp;<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'] . '</i></small></nobr>';
	  }
    }

Replace with this:
------------------
    if ( (isset($order->products[$i]['attributes'])) && (sizeof($order->products[$i]['attributes']) > 0) ) {
	  for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
	    echo '<br><nobr><small>&nbsp;<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'] . '</i></small></nobr>';
   $_SESSION['FixOrder'] =  $_SESSION['FixOrder'] . "(". $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'] .")";
	  }
    }
   $_SESSION['FixOrder'] =  $_SESSION['FixOrder']  ." | ";

Otherwise, everything is working great. We did a few test checkouts, and haven't encountered any issues.

On a funny note:

One time my hubby tried to edit and have a quantity of 2 for a product in the checkout (all of our items are unique, so that is not possible) and it threw him for a loop...he finally hit refresh and it took him back to the cart...silly men...

Anyways...hopefully my little problem isn't too hard to resolve.

-V

#34   fulluvscents

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

Posted 10 February 2012 - 14:23

@oxwivi

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.


If you go to my account, view or edit address book entries, and add address (or edit address), it'll show the exact same thing. Wrote this to mimic the stock forms. I'm gonna look back into that language define in a bit. I'm a little baffled by it.

@PiLLaO

To add the confirm button:

Find:
cartDelete: function()
  {
  var row = $(this).parent();
  $.ajax(
   {
   data: 'action=cartDelete&pID=' + $(this).attr('data-pID'),
   success: function(data)
	{
	if (data.products == 0) {window.location = '<?php echo tep_href_link(FILENAME_SHOPPING_CART, '', 'SSL');?>';return false;}
	else
	 {
	 row.remove();
	 checkout.headerShortcutsRefresh();
	 checkout.colsRefresh();
	 checkout.totalsRefresh();
	 checkout.RowsRefresh('payment');
	 if (data.shipping == 'false') $('#shipping').hide();
	 else  {$('#shipping').show(); checkout.RowsRefresh('shipping');checkout.AddressRefresh('shipping');}
	 }
	}
   });
  },

change to:
cartDelete: function()
  {
		if (confirm('<?php echo CONFIRM_DELETE ;?>'))
		 {
   var row = $(this).parent();
   $.ajax(
	{
	data: 'action=cartDelete&pID=' + $(this).attr('data-pID'),
	success: function(data)
	 {
	 if (data.products == 0) {window.location = '<?php echo tep_href_link(FILENAME_SHOPPING_CART, '', 'SSL');?>';return false;}
	 else
	  {
	  row.remove();
	  checkout.headerShortcutsRefresh();
	  checkout.colsRefresh();
	  checkout.totalsRefresh();
	  checkout.RowsRefresh('payment');
	  if (data.shipping == 'false') $('#shipping').hide();
	  else  {$('#shipping').show(); checkout.RowsRefresh('shipping');checkout.AddressRefresh('shipping');}
	  }
	 }
	});
		 }
  },

open the checkout.php language file, and add the definition:

define('CONFIRM_DELETE', 'Are you sure you want to remove this item?');

@varina
Here are your updated instructions. If they work, let me know and I'll add it as a compatibility feature.

2- Open catalog/checkout_confirmation.php
Find:
-----
require('includes/application_top.php');
Add after:
----------
  $_SESSION['FixOrder'] = "";
Find: (Put the entire sentence because there are two equal sentences, the last)
-----
   for ($i=0, $n=sizeof($products); $i<$n; $i++)
	{
Add after:
----------
   $_SESSION['FixOrder'] =  $_SESSION['FixOrder'] . $products[$i]['name'] . " x " . $products[$i]['qty'] . " ";
Find:
-----
	if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes']))
	 while (list($option, $value) = each($products[$i]['attributes']))
	  {
	  echo tep_draw_hidden_field('attr[' . $products[$i]['id'] . '][' . $option . ']', $value);
	  $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . (int)$products[$i]['id'] . "' and pa.options_id = '" . (int)$option . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . (int)$value . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . (int)$languages_id . "' and poval.language_id = '" . (int)$languages_id . "'");
	  $attributes_values = tep_db_fetch_array($attributes);
	  $productAttributes .= '<br /><small><i> - ' . $attributes_values['products_options_name'] . ' ' . $attributes_values['products_options_values_name'] . '</i></small>';
	  }
Replace with this:
------------------
	if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes']))
	 while (list($option, $value) = each($products[$i]['attributes']))
	  {
	  echo tep_draw_hidden_field('attr[' . $products[$i]['id'] . '][' . $option . ']', $value);
	  $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . (int)$products[$i]['id'] . "' and pa.options_id = '" . (int)$option . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . (int)$value . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . (int)$languages_id . "' and poval.language_id = '" . (int)$languages_id . "'");
	  $attributes_values = tep_db_fetch_array($attributes);
	  $productAttributes .= '<br /><small><i> - ' . $attributes_values['products_options_name'] . ' ' . $attributes_values['products_options_values_name'] . '</i></small>';
	  $_SESSION['FixOrder'] =  $_SESSION['FixOrder'] . "(". $attributes_values['products_options_name'] . ': ' . $attributes_values['products_options_values_name'] .")";
	  }
	$_SESSION['FixOrder'] =  $_SESSION['FixOrder']  ." | ";

Edited to change code for Varina.

Edited by fulluvscents, 10 February 2012 - 14:29.


#35   fulluvscents

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

Posted 10 February 2012 - 15:24

@oxwivi

Umm, yeah, so I made some changes to my file that you didn't have, and that's why it worked for me, and not you.

Download the newest changes and replace the checkout.php file (modified as needed).

Then, the codes that I've last given you should work correctly.

For recap:

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) $cart->update_quantity($pID, $qty, $_POST['attr'][$pID]);}
   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

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');}
	 }
	}
   });
  },

Replace with:

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();
//Minimum quantity code
	 if (data.msg != '') checkout.errMessage(data.status, data.msg);
//Minimum quantity code
	 else  {$('#shipping').show(); checkout.RowsRefresh('shipping');checkout.AddressRefresh('shipping');}
	 }
	}
   });
  },


#36   burt

burt

    Vanquisher of Demons

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

Posted 10 February 2012 - 15:52

It's really great and refreshing to see someone who wanted something so actually went ahead and made it. Excellent.

I have not yet had time to test it, I will try to find the time over the weekend.
IF YOU MAKE A POST REQUESTING HELP...please state the exact version of osCommerce that you are using. THANKS
 
Big Bang Templates for 2.3 osCommerce - 2.3.1 > 2.3.4 - Buy One, Get One Free
 
--
Making your osCommerce better, one module at a time - get in touch.

#37   PiLLaO

PiLLaO
  • Members
  • 159 posts
  • Real Name:Gustavo

Posted 10 February 2012 - 16:18

@fulluvscents Perfect!! /smile.png' class='bbc_emoticon' alt=':)' />

#38   fulluvscents

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

Posted 10 February 2012 - 16:42

@varina

I also uploaded a fix to the breadcrumb issue.

AAAAAAAAAAAAAAAAAHHHHHHHHHHHHHHHHHHHHHHHHH!!

I do believe this thing is bug free. Now, THAT is refreshing.

if I missed anything, then please let me know / remind me.

@varina & @oxwivi Tell me how those last compatibility instructions work for you. When I have working instructions for merging other contributions, I'll get them uploaded and cross referenced with the other contribs.

#39   oxwivi

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

Posted 10 February 2012 - 18:38

Thou art awesome in every sense of the word. Though you did say that you dislike your hard work being freely used, you really overreached yourself to help us out. This is experience has increased my preference in open-source and made me want to contribute back many times over.

Like I said before the addon in question was Minimum Product Quantity, with it's latest release in the last decade for osC 2.2. Will try to ascertain that all the function works with 2.3.1 and release tweaked codes and updated instructions.

#40   fulluvscents

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

Posted 10 February 2012 - 19:29

Oh, okay then. If you get a 2.3.1 version going and upload it, then just send the compatibility instructions my way, and I'll add it to my files.

And NO, it isn't about the work being freely used. I have no problem sharing. It's about vultures waiting around for free contributions that they can take credit for and profit from. For example, this nice piece of work. Yes, I'm calling a pig a pig and a POS a POS.



With ezOSC's ONE-PAGE Checkout........

Don't Forget! ezOSC stands behind every piece of software we develop!



That mod was developed by itwebexperts, and hacked by me and several others. I never took credit for developing it. But, I'll be a son of a ....., when someone takes credit for developing THIS checkout, I think we just might have some issues. So yeah, vultures. If you're gonna get paid for MY work, you better at least give credit where it's due.

And yes, that was my rant for the day.


Edited by fulluvscents, 10 February 2012 - 19:37.