Simple Checkout - for 2.3.1 (official support thread)
#1
Posted 07 February 2012 - 04:01 PM
#2
Posted 07 February 2012 - 04:45 PM
Wondering if yours has any dependancy on other addons?
Or maybe a ready made theme for your shop ??
Warning: My posts may contain Horsemeat.
#3
Posted 07 February 2012 - 04:57 PM
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
Posted 07 February 2012 - 06:09 PM
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
Posted 07 February 2012 - 07:04 PM
#6
Posted 07 February 2012 - 07:23 PM
//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
Posted 07 February 2012 - 07:30 PM
in checkout.php on top I added
function fixSeoLink($url){
return str_replace('&', '&', $url);
}
Now I go testing it
#8
Posted 07 February 2012 - 07:48 PM
Edited by oxwivi, 07 February 2012 - 07:49 PM.
#9
Posted 07 February 2012 - 08:08 PM
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
Posted 07 February 2012 - 08:18 PM
fulluvscents, on 07 February 2012 - 08:08 PM, said:
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
Posted 07 February 2012 - 08:33 PM
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 - 08:39 PM.
#12
Posted 07 February 2012 - 08:52 PM
How can I set default country? When I set it in tep_get_country_list() doesn't result.
regards
#13
Posted 07 February 2012 - 09:27 PM
// 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
Category Description, CKEditor, Customer Sort, Enhanced Contact Us, Mindsparx Admin, Modular Front Page, Modular SEO Header Tags, Multiple Products Manager, Remove Unused Images, Select Product Image Directory, Shipping Cost Estimator, Simple Checkout for 2.3.1, Store Mode, Theme Switcher, UPSXML
#14
Posted 07 February 2012 - 09:42 PM
Now it works just fine!
Category Description, CKEditor, Customer Sort, Enhanced Contact Us, Mindsparx Admin, Modular Front Page, Modular SEO Header Tags, Multiple Products Manager, Remove Unused Images, Select Product Image Directory, Shipping Cost Estimator, Simple Checkout for 2.3.1, Store Mode, Theme Switcher, UPSXML
#15
Posted 07 February 2012 - 10:32 PM
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
Category Description, CKEditor, Customer Sort, Enhanced Contact Us, Mindsparx Admin, Modular Front Page, Modular SEO Header Tags, Multiple Products Manager, Remove Unused Images, Select Product Image Directory, Shipping Cost Estimator, Simple Checkout for 2.3.1, Store Mode, Theme Switcher, UPSXML
#16
Posted 08 February 2012 - 01:05 AM
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
Posted 08 February 2012 - 10:47 AM
Quote
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
Posted 08 February 2012 - 12:45 PM
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
Posted 08 February 2012 - 02:15 PM
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 - 02:27 PM.









